-
Notifications
You must be signed in to change notification settings - Fork 1
/
pte.h
140 lines (76 loc) · 1.77 KB
/
pte.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
//
// Created by moiz on 2/15/20.
//
#ifndef ASSEMBLER_TEST_PTE_H
#define ASSEMBLER_TEST_PTE_H
#include <cstdint>
namespace RISCV_EMULATOR {
class Pte32 {
public:
Pte32();
Pte32(uint32_t pte_value);
Pte32 &operator=(uint32_t pte_value);
uint32_t GetValue() const;
uint32_t GetPpn() const;
uint32_t GetPpn1() const;
uint32_t GetPpn0() const;
uint32_t GetRsw() const;
uint32_t GetD() const;
uint32_t GetA() const;
uint32_t GetG() const;
uint32_t GetU() const;
uint32_t GetX() const;
uint32_t GetW() const;
uint32_t GetR() const;
uint32_t GetV() const;
void SetPpn(uint32_t);
void SetRsw(uint32_t);
void SetD(int value);
void SetA(int value);
void SetG(int value);
void SetU(int value);
void SetX(int value);
void SetW(int value);
void SetR(int value);
void SetV(int value);
bool IsLeaf() const;
bool IsValid() const;
private:
uint32_t pte_;
};
class Pte64 {
public:
Pte64();
Pte64(uint64_t pte_value);
Pte64 &operator=(uint64_t pte_value);
uint64_t GetValue() const;
uint32_t GetPpn() const;
uint32_t GetPpn2() const;
uint32_t GetPpn1() const;
uint32_t GetPpn0() const;
uint32_t GetRsw() const;
uint32_t GetD() const;
uint32_t GetA() const;
uint32_t GetG() const;
uint32_t GetU() const;
uint32_t GetX() const;
uint32_t GetW() const;
uint32_t GetR() const;
uint32_t GetV() const;
void SetPpn(uint64_t);
void SetRsw(uint32_t);
void SetD(int value);
void SetA(int value);
void SetG(int value);
void SetU(int value);
void SetX(int value);
void SetW(int value);
void SetR(int value);
void SetV(int value);
bool IsLeaf() const;
bool IsValid() const;
private:
uint64_t pte_;
};
} // namespace RISCV_EMULATOR
#endif //ASSEMBLER_TEST_PTE_H