]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/boot/amd64/boot_paging.h
Inital import
[l4.git] / kernel / fiasco / src / boot / amd64 / boot_paging.h
1 #ifndef BOOT_PAGING_H
2 #define BOOT_PAGING_H
3
4 #include "types.h"
5
6 enum
7 {
8   PAGE_SIZE                     = (1 << 12),
9   PAGE_MASK                     = (PAGE_SIZE - 1),
10   SUPERPAGE_SIZE                = (1 << 21),
11   SUPERPAGE_MASK                = (SUPERPAGE_SIZE - 1),
12   PD_SIZE                       = (1 << 30),
13   PD_MASK                       = (PD_SIZE - 1),
14   PDP_SIZE                      = (1LL << 39),
15   PDP_MASK                      = (PDP_SIZE - 1),
16 };
17
18 static inline int
19 superpage_aligned(Address x)
20 { return (x & SUPERPAGE_MASK) == 0; }
21
22 static inline int
23 pd_aligned(Address x)
24 { return (x & PD_MASK) == 0; }
25
26 static inline int
27 pdp_aligned(Address x)
28 { return (x & PDP_MASK) == 0; }
29
30 static inline Address trunc_page(Address x)
31 { return x & ~PAGE_MASK; }
32
33 static inline Address round_page(Address x)
34 { return (x + PAGE_MASK) & ~PAGE_MASK; }
35
36 static inline Address round_superpage(Address x)
37 { return (x + SUPERPAGE_MASK) & ~SUPERPAGE_MASK; }
38
39 #endif