From e3de0bdced81720fd904ff38d7c62fc55764c42f Mon Sep 17 00:00:00 2001 From: dzwdz Date: Tue, 20 Jul 2021 19:24:53 +0200 Subject: global PAGE_MASK define it's pretty useful, so it makes sense to define it alongside PAGE_SIZE --- src/kernel/mem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/kernel/mem.c') 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) { -- cgit v1.2.3