diff --git a/src/memory/page.c b/src/memory/page.c index 8707c3e..7579ad3 100644 --- a/src/memory/page.c +++ b/src/memory/page.c @@ -13,7 +13,7 @@ extern uint32_t page_table_entries[PT_SIZE] __attribute__((aligned(4096))); static int16_t find_next_block(size_t nb_pages) { - for (uint16_t i = 0; i < PT_SIZE; i++) { + for (uint16_t i = 1; i < PT_SIZE; i++) { uint16_t j; for (j = 0; page_table_entries[i + j] >> 12 == i + j && j < nb_pages; @@ -46,7 +46,7 @@ void *alloc_pages(size_t size) } page_table_entries[i] = (uint32_t)frame << 12 | INIT_FLAGS; } - return (void *)(page_table_entries[index] >> 12); + return (void *)(index * PAGE_SIZE); } int free_pages(void *page_ptr, size_t size)