summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/kernel/arch/generic.h1
-rw-r--r--src/kernel/mem.c3
2 files changed, 2 insertions, 2 deletions
diff --git a/src/kernel/arch/generic.h b/src/kernel/arch/generic.h
index 22efe58..7ce3d46 100644
--- a/src/kernel/arch/generic.h
+++ b/src/kernel/arch/generic.h
@@ -6,6 +6,7 @@
// i have no idea where else to put it
// some code assumes that it's a power of 2
#define PAGE_SIZE 4096
+#define PAGE_MASK (PAGE_SIZE - 1)
// linker.ld
extern char _bss_end;
diff --git a/src/kernel/mem.c b/src/kernel/mem.c
index 1fce506..5684bb7 100644
--- a/src/kernel/mem.c
+++ b/src/kernel/mem.c
@@ -7,13 +7,12 @@ static void *highest_page;
void mem_init(struct kmain_info *info) {
// finds the highest used page, and starts allocating pages above it
void *highest = &_bss_end;
- size_t page_mask = PAGE_SIZE - 1;
if (highest < info->init.at + info->init.size)
highest = info->init.at + info->init.size;
// align up to PAGE_SIZE
- highest_page = (void*)(((uintptr_t)highest + page_mask) & ~page_mask);
+ highest_page = (void*)(((uintptr_t)highest + PAGE_MASK) & ~PAGE_MASK);
}
void *page_alloc(size_t pages) {