wip: frame_allocator working pretty good (?)
core: remove physical allocatory
This commit is contained in:
@ -46,11 +46,10 @@ void *alloc_pages(size_t size)
|
||||
return NULL;
|
||||
}
|
||||
for (size_t i = index; i - (size_t)index < nb_pages; i++) {
|
||||
void *frame = alloc_frames(PAGE_SIZE);
|
||||
void *frame = alloc_frame();
|
||||
if (!frame) {
|
||||
for (size_t j = index; j < i; j++)
|
||||
free_frames((void *)(page_table[j] >> 12),
|
||||
PAGE_SIZE);
|
||||
free_frame((void *)(page_table[j] >> 12));
|
||||
return NULL;
|
||||
}
|
||||
page_table[i] = ((uint32_t)frame & PAGE_MASK) | INIT_FLAGS;
|
||||
@ -83,7 +82,7 @@ int free_pages(void *page_ptr, size_t size)
|
||||
kprintf(KERN_WARNING "Page already free\n");
|
||||
return -2;
|
||||
}
|
||||
free_frames((void *)(page_table[i] & PAGE_MASK), PAGE_SIZE);
|
||||
free_frame((void *)(page_table[i] & PAGE_MASK));
|
||||
page_table[i] = i << 12;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user