fix: free frame use right addr
This commit is contained in:
parent
3bc05604db
commit
ec3a038a36
@ -7,8 +7,6 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#define MAX_TLB_ENTRIES 32
|
|
||||||
|
|
||||||
static int16_t find_next_block(size_t nb_pages, uint16_t *pd_index_ptr,
|
static int16_t find_next_block(size_t nb_pages, uint16_t *pd_index_ptr,
|
||||||
uint32_t **page_table_ptr)
|
uint32_t **page_table_ptr)
|
||||||
{
|
{
|
||||||
@ -49,7 +47,7 @@ void *alloc_pages(size_t size)
|
|||||||
void *frame = alloc_frame();
|
void *frame = alloc_frame();
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
for (size_t j = index; j < i; j++)
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
page_table[i] = ((uint32_t)frame & PAGE_MASK) | INIT_FLAGS;
|
page_table[i] = ((uint32_t)frame & PAGE_MASK) | INIT_FLAGS;
|
||||||
|
Loading…
Reference in New Issue
Block a user