fix: free frame use right addr

This commit is contained in:
Starnakin 2024-11-20 16:25:31 +01:00
parent 3bc05604db
commit ec3a038a36

View File

@ -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;