]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/boot/ia32/boot_paging.h
9e899161a1364a7776ede381972c97f50ea1bac2
[l4.git] / kernel / fiasco / src / boot / ia32 / 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 << 22),
11   SUPERPAGE_MASK                = (SUPERPAGE_SIZE - 1),
12 };
13
14 static inline int
15 superpage_aligned(Address x)
16 { return (x & SUPERPAGE_MASK) == 0; }
17
18 static inline Address trunc_superpage(Address x)
19 { return x & ~SUPERPAGE_MASK; }
20
21 static inline Address trunc_page(Address x)
22 { return x & ~PAGE_MASK; }
23
24 static inline Address round_page(Address x)
25 { return (x + PAGE_MASK) & ~PAGE_MASK; }
26
27 static inline Address round_superpage(Address x)
28 { return (x + SUPERPAGE_MASK) & ~SUPERPAGE_MASK; }
29
30 #endif