-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathptentry.h
60 lines (51 loc) · 1.47 KB
/
ptentry.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
#ifndef PT_ENTRY_H
#define PT_ENTRY_H
#include "types.h"
/**
* This structure refers to the state of a virtual page.
*
* A virtual address 'va' has a three-part structure as follows:
*
* +--------10------+-------10-------+---------12----------+
* | Page Directory | Page Table | Offset within Page |
* | Index | Index | |
* +----------------+----------------+---------------------+
* \--- PDX(va) --/ \--- PTX(va) --/
*
* A page table entry has a structure as follows:
*
* +---------------20----------------+---------12----------+
* | Physical Page | Status Bits |
* | Number | |
* +----------------+----------------+---------------------+
**/
struct pt_entry
{
/**
* Page directory index (10 bits) of this virtual page
*/
uint pdx : 10;
/**
* Page Table index (10 bits) of this virtual page
*/
uint ptx : 10;
/**
* Physical Page Number (20 bits) allocated to this virutal page
*/
uint ppage : 20;
/**
* This field (1 bit) should be set to 1 if PTE_P == 1, otherwise 0
*/
uint present : 1;
/**
* This field (1 bit) should be set to 1 if PTE_W == 1, otherwise 0
*/
uint writable : 1;
uint user : 1;
/**
* This field (1 bit) should be set to 1 if this page is currently encrypted, otherwise 0
*/
uint encrypted : 1;
uint ref : 1;
};
#endif // __PT_ENTRY_H__