From 56ae91e11f8a67fe31b310b8ed6d7889f354f391 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Thu, 1 Sep 2022 07:05:38 +0200 Subject: [PATCH] ZealBooter: Properly set kernel->mem_physical_space --- zealbooter/zealbooter.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/zealbooter/zealbooter.c b/zealbooter/zealbooter.c index b8b64de3..b036a561 100644 --- a/zealbooter/zealbooter.c +++ b/zealbooter/zealbooter.c @@ -224,6 +224,8 @@ void _start(void) { kernel->mem_E801[0] = E801.lowermem; kernel->mem_E801[1] = E801.uppermem; + kernel->mem_physical_space = 0; + for (size_t i = 0; i < memmap_request.response->entry_count; i++) { struct limine_memmap_entry *entry = memmap_request.response->entries[i]; @@ -247,8 +249,16 @@ void _start(void) { kernel->mem_E820[i].base = (void *)entry->base; kernel->mem_E820[i].len = entry->length; kernel->mem_E820[i].type = our_type; + + if (kernel->mem_physical_space < entry->base + entry->length) { + kernel->mem_physical_space = entry->base + entry->length; + } } + kernel->mem_E820[memmap_request.response->entry_count].type = 0; + + kernel->mem_physical_space = ALIGN_UP(kernel->mem_physical_space, 0x200000); + void *sys_gdt_ptr = (void *)&kernel->sys_gdt_ptr - (uintptr_t)module_kernel->address; sys_gdt_ptr += final_address;