diff options
Diffstat (limited to 'arch/x86_64/kapi/memory.cpp')
| -rw-r--r-- | arch/x86_64/kapi/memory.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/arch/x86_64/kapi/memory.cpp b/arch/x86_64/kapi/memory.cpp index d9fbe28..f29afe8 100644 --- a/arch/x86_64/kapi/memory.cpp +++ b/arch/x86_64/kapi/memory.cpp @@ -121,10 +121,7 @@ namespace kapi::memory [[maybe_unused]] auto remap_bootloader_modules(page_mapper & mapper) -> void { - auto modules = boot::bootstrap_information.mbi->modules(); - - for (auto module : modules) - { + std::ranges::for_each(boot::bootstrap_information.mbi->modules(), [&mapper](auto const & module) { auto module_physical_start = physical_address{module.start_address}; auto module_virtual_start = linear_address{module.start_address + std::bit_cast<std::uintptr_t>(&arch::boot::TEACHOS_VMA)}; @@ -135,9 +132,9 @@ namespace kapi::memory { auto page = page::containing(module_virtual_start) + i; auto frame = frame::containing(module_physical_start) + i; - mapper.map(page, frame, page_mapper::flags::writable); + mapper.map(page, frame, page_mapper::flags::writable | page_mapper::flags::supervisor_only); } - } + }); } [[maybe_unused]] auto handoff_to_kernel_pmm(frame_allocator & new_allocator) -> void @@ -176,9 +173,7 @@ namespace kapi::memory std::ranges::for_each(std::views::iota(mbi_start, mbi_end), [&](auto frame) { new_allocator.mark_used(frame); }); - auto modules = boot::bootstrap_information.mbi->modules(); - for (auto module : modules) - { + std::ranges::for_each(boot::bootstrap_information.mbi->modules(), [&](auto const & module) { auto module_physical_start = physical_address{module.start_address}; auto module_size = module.end_address - module.start_address; auto module_start = frame::containing(module_physical_start); @@ -186,7 +181,7 @@ namespace kapi::memory std::ranges::for_each(std::views::iota(module_start, module_end), [&](auto frame) { new_allocator.mark_used(frame); }); - } + }); } } // namespace |
