summaryrefslogtreecommitdiff
path: root/api/kernel/memory/paging.h
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2021-06-02 13:52:02 +0000
committerAda Christine <adachristine18@gmail.com>2021-06-02 13:52:02 +0000
commit4971aa814d0ef52707503cc2138c67c4c5662b54 (patch)
tree7c794e50f9dd5ad680b0bccde0a8eed29b499f5d /api/kernel/memory/paging.h
parent298ff8e784769588c9e39ffa5b50a8391216c43d (diff)
cast address and offset calculations
Diffstat (limited to 'api/kernel/memory/paging.h')
-rw-r--r--api/kernel/memory/paging.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/api/kernel/memory/paging.h b/api/kernel/memory/paging.h
index 3f16930..fc1aa45 100644
--- a/api/kernel/memory/paging.h
+++ b/api/kernel/memory/paging.h
@@ -28,6 +28,6 @@
#define pte_index_bits(l) (PAGE_OFFSET_BITS + PAGE_MAP_BITS * (l - 1))
#define pte_index(v, l) (((uintptr_t)v >> pte_index_bits(l)) & PAGE_TABLE_INDEX_MASK)
#define page_size(l) (1 << pte_index_bits(l))
-#define page_address(a, l) (a & ~(page_size(l) - 1))
-#define page_offset(a, l) (a & (page_size(l) - 1))
+#define page_address(a, l) ((uintptr_t)a & ~(page_size(l) - 1))
+#define page_offset(a, l) ((uintptr_t)a & (page_size(l) - 1))
#define page_count(s, l) (((s + page_size(l) - 1) & ~(page_size(l) - 1)) / page_size(l))