From: Amelia Coutard Date: Sun, 8 May 2022 19:45:23 +0000 (+0200) Subject: Moved the past_the_end page of the page allocator to the c++ code, and made it and... X-Git-Url: https://git.ameliathe1st.gay/?a=commitdiff_plain;h=887a12176f5502e2924bc673fa591c293624acef;p=voyage-au-centre-des-fichiers.git Moved the past_the_end page of the page allocator to the c++ code, and made it and the page allocator globals --- diff --git a/src/boot.S b/src/boot.S index 1bdfdba..f113d37 100644 --- a/src/boot.S +++ b/src/boot.S @@ -94,8 +94,6 @@ PDPT_high: .skip 0x1000 - 16 .section .bss .align 0x1000 -.globl page_list_one_past_end -page_list_one_past_end: .skip 0x1000 PML4T: .skip 0x1000 phys_mem_map: .skip 0x1000 * 128 - 8 .align 16 diff --git a/src/kernel.cpp b/src/kernel.cpp index b1293dd..5799f46 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -28,6 +28,10 @@ void remove_some_mem(os::phys_ptr mem_start, } } +os::paging::page one_past_end_page_for_page_allocator; +os::paging::page_allocator page_allocator(os::phys_ptr(reinterpret_cast(&one_past_end_page_for_page_allocator) - 0xFFFFFFFF80000000)); + + extern "C" void kmain(unsigned long magic, os::phys_ptr info) { os::assert(magic == 0x36D76289, "Incorrect magic number: wasn't booted with multiboot2."); @@ -35,11 +39,6 @@ extern "C" void kmain(unsigned long magic, os::phys_ptr ram_ptr = nullptr; - asm("mov $page_list_one_past_end - 0xFFFFFFFF80000000,%0" : "=ri"(ram_ptr)); - return ram_ptr; - })()}; const os::phys_ptr kernel_start = ([]() { os::phys_ptr ptr = nullptr; asm("mov $_kernel_phys_start,%0" : "=ri"(ptr)); @@ -87,10 +86,10 @@ extern "C" void kmain(unsigned long magic, os::phys_ptr struct paging_table<-1> { - std::uint8_t contents[0x1000]; + std::uint8_t contents[0x1000] = {0}; }; using PML4T = paging_table<3>;