wip: frame_allocator working pretty good (?)

core: remove physical allocatory
This commit is contained in:
2024-11-19 16:57:19 +01:00
parent e8fd6c55eb
commit 3315d85e0c
14 changed files with 61 additions and 471 deletions

View File

@ -53,10 +53,11 @@ static void add_frame_node(multiboot_memory_map_t *mmmt)
init_page_table(frame_zones_page_table, 0);
page_directory[1022] =
((uint32_t)frame_zones_page_table - HEAP_END) | 0x03;
frame_zones_page_table[index++] =
frame_zones_page_table[index] =
((uint32_t)zone & PAGE_MASK) | INIT_FLAGS;
struct frame_zone *current =
(struct frame_zone *)GET_PAGE_ADDR(1022, 0);
(struct frame_zone *)GET_PAGE_ADDR(1022, index++);
memset(current, 0, sizeof(struct frame_zone));
current->addr = (void *)mmmt->addr;
current->frame_table = (uint32_t *)current + sizeof(struct frame_zone);
@ -68,16 +69,18 @@ static void add_frame_node(multiboot_memory_map_t *mmmt)
frame_zones_page_table[index] =
((uint32_t)zone + PAGE_SIZE & PAGE_MASK) | INIT_FLAGS;
// glhf reading this bozo
current->len = mmmt->len;
current->size = (mmmt->len - (sizeof(struct frame_zone) +
(mmmt->len / PAGE_SIZE) / 32));
current->remaining_frames = current->size / PAGE_SIZE;
current->first_free_frame = 0;
current->next = NULL;
struct frame_zone *it = head;
if (!it) {
if (!head) {
head = current;
return;
}
struct frame_zone *it = head;
while (it->next)
it = it->next;
it->next = current;