fix: page alloc return frame addr instead page addr
This commit is contained in:
parent
3372e386f5
commit
9dc9002f00
@ -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)
|
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;
|
uint16_t j;
|
||||||
for (j = 0;
|
for (j = 0;
|
||||||
page_table_entries[i + j] >> 12 == i + j && j < nb_pages;
|
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;
|
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)
|
int free_pages(void *page_ptr, size_t size)
|
||||||
|
Loading…
Reference in New Issue
Block a user