diff options
Diffstat (limited to 'arch/x86_64/kapi')
| -rw-r--r-- | arch/x86_64/kapi/memory.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/x86_64/kapi/memory.cpp b/arch/x86_64/kapi/memory.cpp index 48aab9f..e704408 100644 --- a/arch/x86_64/kapi/memory.cpp +++ b/arch/x86_64/kapi/memory.cpp @@ -189,7 +189,7 @@ namespace kapi::memory auto mbi_size = boot::bootstrap_information.mbi->size_bytes(); auto mbi_address = physical_address{mbi_base & ~std::bit_cast<std::uintptr_t>(&arch::boot::TEACHOS_VMA)}; auto mbi_start = frame::containing(mbi_address); - auto mbi_end = frame::containing(physical_address{mbi_address.raw() + mbi_size}) + 1; + auto mbi_end = frame::containing(mbi_address + mbi_size) + 1; std::ranges::for_each(std::views::iota(mbi_start, mbi_end), [&](auto frame) { new_allocator.mark_used(frame); }); } @@ -211,7 +211,10 @@ namespace kapi::memory region_based_allocator.emplace(collect_memory_information()); allocation_buffer.emplace(&*region_based_allocator); - recursive_page_mapper.emplace(*allocation_buffer); + set_frame_allocator(*allocation_buffer); + + recursive_page_mapper.emplace(); + set_page_mapper(*recursive_page_mapper); kstd::println("[x86_64:MEM] Preparing new paging hierarchy."); @@ -227,9 +230,6 @@ namespace kapi::memory cr3.frame(new_pml4_frame); arch::cpu::cr3::write(cr3); - set_frame_allocator(*allocation_buffer); - set_page_mapper(*recursive_page_mapper); - auto memory_map = boot::bootstrap_information.mbi->memory_map(); auto highest_byte = std::ranges::max(std::views::transform( std::views::filter(memory_map.regions(), |
