aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/include/sys.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/include/sys.h')
-rw-r--r--src/kernel/include/sys.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/kernel/include/sys.h b/src/kernel/include/sys.h
index 944df96..61bfc59 100644
--- a/src/kernel/include/sys.h
+++ b/src/kernel/include/sys.h
@@ -75,9 +75,10 @@ static inline void invlpg(void* addr) {
#define PAGE_SIZE 0x1000
#define PAGE_MASK 0xFFFFF000
-#define PAGE_ALIGN_DOWN(x) (((size_t)x) & PAGE_MASK)
-#define PAGE_ALIGN_UP(x) ((((size_t)x)&(~PAGE_MASK)) == 0 ? ((size_t)x) : (((size_t)x) & PAGE_MASK) + PAGE_SIZE)
-#define PAGE_ID(x) (((size_t)x) / PAGE_SIZE)
+#define PAGE_ALIGNED(x) ((((size_t)(x)) & (~PAGE_MASK)) == 0)
+#define PAGE_ALIGN_DOWN(x) (((size_t)(x)) & PAGE_MASK)
+#define PAGE_ALIGN_UP(x) ((((size_t)(x))&(~PAGE_MASK)) == 0 ? ((size_t)x) : (((size_t)x) & PAGE_MASK) + PAGE_SIZE)
+#define PAGE_ID(x) (((size_t)(x)) / PAGE_SIZE)
#define PAGE_SHIFT 12
#define PT_SHIFT 10
// PAGE_SHIFT + PT_SHIFT + PT_SHIFT = 32