From ec3a038a36fad48ddadff91eb6d20553ef80a39f Mon Sep 17 00:00:00 2001 From: Starnakin Date: Wed, 20 Nov 2024 16:25:31 +0100 Subject: [PATCH] fix: free frame use right addr --- src/memory/page.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/memory/page.c b/src/memory/page.c index 6e38ffa..c8c32d2 100644 --- a/src/memory/page.c +++ b/src/memory/page.c @@ -7,8 +7,6 @@ #include "memory.h" #include "utils.h" -#define MAX_TLB_ENTRIES 32 - static int16_t find_next_block(size_t nb_pages, uint16_t *pd_index_ptr, uint32_t **page_table_ptr) { @@ -49,7 +47,7 @@ void *alloc_pages(size_t size) void *frame = alloc_frame(); if (!frame) { for (size_t j = index; j < i; j++) - free_frame((void *)(page_table[j] >> 12)); + free_frame((void *)(page_table[j] & PAGE_MASK)); return NULL; } page_table[i] = ((uint32_t)frame & PAGE_MASK) | INIT_FLAGS;