clean: simplify code

This commit is contained in:
Starnakin 2024-11-20 16:26:33 +01:00
parent 94b2fa340c
commit 0c280d971b

View File

@ -68,12 +68,11 @@ static void add_frame_node(multiboot_memory_map_t *mmmt)
// KERNEL code partially on the block
if (HEAP_START >= zone) {
const uint32_t len = mmmt->len -
((uint64_t)&_kernel_end - HEAP_END) -
(uint64_t)zone;
const uint32_t start_space =
CEIL(HEAP_START, PAGE_SIZE) * PAGE_SIZE;
const uint32_t len = mmmt->len - (start_space - (uint32_t)zone);
mmmt->len = CEIL(len, PAGE_SIZE) * PAGE_SIZE;
zone =
(void *)((uint32_t)CEIL(HEAP_START, PAGE_SIZE) * PAGE_SIZE);
zone = (void *)start_space;
}
init_page_table(frame_zones_page_table, 0);
@ -90,9 +89,9 @@ static void add_frame_node(multiboot_memory_map_t *mmmt)
/** 8 is cause we are using uint8_t
nb_frame = size / (PAGE_SIZE + 1 / 8)
cause we are using non decimal number
nb_frame = ((size * 8) / (PAGE_SIZE * 8 + 1)) / 8
nb_frame = ((size * 8) / (PAGE_SIZE * 8 + 1))
*/
const uint32_t nb_frame = ((mmmt->len * 8) / (PAGE_SIZE * 8 + 1)) - 1;
const uint32_t nb_frame = ((mmmt->len * 8) / (PAGE_SIZE * 8 + 1));
current->first_free_frame = 0;
current->next = NULL;