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
pub const PAGE_SHIFT: usize = 12;
pub const PAGE_SIZE: usize = 1 << PAGE_SHIFT;
pub const PAGE_MASK: usize = !(PAGE_SIZE - 1);
pub const PADDR_BITS: usize = 52;
pub const VADDR_BITS: usize = 48;
pub const PADDR_MASK: usize = (1 << PADDR_BITS) - 1;
pub const VADDR_MASK: usize = (1 << VADDR_BITS) - 1;
pub const L1_MASK: usize = (1 << L2_PAGETABLE_SHIFT) - 1;
pub const L1_PAGETABLE_SHIFT: usize = PAGE_SHIFT;
pub const L2_PAGETABLE_SHIFT: usize = 21;
pub const L3_PAGETABLE_SHIFT: usize = 30;
pub const L4_PAGETABLE_SHIFT: usize = 39;
pub const L1_PAGETABLE_ENTRIES: usize = 512;
pub const L2_PAGETABLE_ENTRIES: usize = 512;
pub const L3_PAGETABLE_ENTRIES: usize = 512;
pub const L4_PAGETABLE_ENTRIES: usize = 512;
pub const PAGETABLE_LEVELS: usize = 4;
pub const PAGE_PRESENT: usize = 0x001;
pub const PAGE_RW: usize = 0x002;
pub const PAGE_USER: usize = 0x004;
pub const PAGE_PWT: usize = 0x008;
pub const PAGE_PCD: usize = 0x010;
pub const PAGE_ACCESSED: usize = 0x020;
pub const PAGE_DIRTY: usize = 0x040;
pub const PAGE_PAT: usize = 0x080;
pub const PAGE_PSE: usize = 0x080;
pub const PAGE_GLOBAL: usize = 0x100;
pub const L1_PROT: usize = PAGE_PRESENT | PAGE_RW | PAGE_ACCESSED | PAGE_USER;
pub const L1_PROT_RO: usize = PAGE_PRESENT | PAGE_ACCESSED | PAGE_USER;
pub const L2_PROT: usize = PAGE_PRESENT | PAGE_RW | PAGE_ACCESSED | PAGE_DIRTY | PAGE_USER;
pub const L3_PROT: usize = PAGE_PRESENT | PAGE_RW | PAGE_ACCESSED | PAGE_DIRTY | PAGE_USER;
pub const L4_PROT: usize = PAGE_PRESENT | PAGE_RW | PAGE_ACCESSED | PAGE_DIRTY | PAGE_USER;
pub const PT_PROT: [usize; 4] = [L1_PROT, L2_PROT, L3_PROT, L4_PROT];
pub const MAX_MEM_SIZE: usize = 512 << 30;
pub const VIRT_DEMAND_AREA: usize = 0x0000100000000000;
pub const DEMAND_MAP_PAGES: usize = 0x8000000;