summaryrefslogtreecommitdiff
path: root/src/kernel/mem.c
diff options
context:
space:
mode:
authordzwdz2021-07-20 19:24:53 +0200
committerdzwdz2021-07-20 19:24:53 +0200
commite3de0bdced81720fd904ff38d7c62fc55764c42f (patch)
tree30413c8bfaca5867305d94c7a0acadaba756b361 /src/kernel/mem.c
parent269789863caed846c7f776d4ac0d63a0ad5aa6c9 (diff)
global PAGE_MASK define
it's pretty useful, so it makes sense to define it alongside PAGE_SIZE
Diffstat (limited to 'src/kernel/mem.c')
-rw-r--r--src/kernel/mem.c3
1 files changed, 1 insertions, 2 deletions
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) {