]>
Commit | Line | Data |
---|---|---|
1 | /** Page table and page directory flags. | |
2 | * | |
3 | * From intel-sys.pdf. | |
4 | * | |
5 | * @author Jacob Potter (jdpotter) | |
6 | */ | |
7 | ||
8 | #ifndef _VM_FLAGS_H | |
9 | #define _VM_FLAGS_H | |
10 | ||
11 | #define PTE_FOR(x) (((unsigned int)(x) >> 12) & 0x3FF) | |
12 | #define PDE_FOR(x) ((unsigned int)(x) >> 22) | |
13 | #define ADDR_12_MASK(x) ((unsigned int)(x) & ~((1 << 12) - 1)) | |
14 | #define ADDR_22_MASK(x) ((unsigned int)(x) & ~((1 << 22) - 1)) | |
15 | #define LOWER_12(x) ((unsigned int)(x) & ((1 << 12) - 1)) | |
16 | #define LOWER_22(x) ((unsigned int)(x) & ((1 << 22) - 1)) | |
17 | ||
18 | #define PDE_4M_ADDR_SHIFT 22 | |
19 | #define PTE_4K_ADDR_SHIFT 12 | |
20 | #define PDE_TABLE_ADDR_SHIFT 12 | |
21 | #define PTE_FRAME_ADDR_MASK (~((1 << PTE_4K_ADDR_SHIFT) - 1)) | |
22 | #define PDE_TABLE_ADDR_MASK (~((1 << PDE_TABLE_ADDR_SHIFT) - 1)) | |
23 | ||
24 | #define PDE_ATTRIB_INDEX (1 << 12) | |
25 | #define PDE_GLOBAL (1 << 8) | |
26 | #define PDE_PAGE_SIZE (1 << 7) | |
27 | #define PDE_DIRTY (1 << 6) | |
28 | #define PDE_ACCESSED (1 << 5) | |
29 | #define PDE_NO_CACHE (1 << 4) | |
30 | #define PDE_WRITE_THROUGH (1 << 3) | |
31 | #define PDE_USER (1 << 2) | |
32 | #define PDE_READ_WRITE (1 << 1) | |
33 | #define PDE_PRESENT (1 << 0) | |
34 | ||
35 | #define PTE_GLOBAL (1 << 8) | |
36 | #define PTE_ATTRIB_INDEX (1 << 7) | |
37 | #define PTE_DIRTY (1 << 6) | |
38 | #define PTE_ACCESSED (1 << 5) | |
39 | #define PTE_NO_CACHE (1 << 4) | |
40 | #define PTE_WRITE_THROUGH (1 << 3) | |
41 | #define PTE_USER (1 << 2) | |
42 | #define PTE_READ_WRITE (1 << 1) | |
43 | #define PTE_PRESENT (1 << 0) | |
44 | ||
45 | #endif /* _VM_FLAGS_H */ |