diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2025-11-28 16:06:15 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2025-11-28 16:06:15 +0100 |
| commit | 1db039ca1c67e8daba8b5ec6d5158cb2110e1410 (patch) | |
| tree | 0e90979d364a29bd21f46642e1a7eac9fbe19caa /arch/x86_64/src/kapi/memory.cpp | |
| parent | 75dccce516db9ee4a43108015f78a9e99b21144f (diff) | |
| download | teachos-1db039ca1c67e8daba8b5ec6d5158cb2110e1410.tar.xz teachos-1db039ca1c67e8daba8b5ec6d5158cb2110e1410.zip | |
x86_64: port basic page and page table abstractions
Diffstat (limited to 'arch/x86_64/src/kapi/memory.cpp')
| -rw-r--r-- | arch/x86_64/src/kapi/memory.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/x86_64/src/kapi/memory.cpp b/arch/x86_64/src/kapi/memory.cpp index 3848fb8..99dcb5c 100644 --- a/arch/x86_64/src/kapi/memory.cpp +++ b/arch/x86_64/src/kapi/memory.cpp @@ -12,6 +12,7 @@ #include <multiboot2/information.hpp> #include <atomic> +#include <span> namespace teachos::memory { @@ -25,11 +26,12 @@ namespace teachos::memory auto create_memory_information() -> x86_64::region_allocator::memory_information { auto const & mbi = boot::bootstrap_information.mbi; + auto mbi_span = std::span{std::bit_cast<std::byte *>(mbi), mbi->size_bytes()}; + auto image_span = std::span{&boot::x86_64::_start_physical, &boot::x86_64::_end_physical}; - return {.image_range = std::make_pair(physical_address{&boot::x86_64::_start_physical}, - physical_address{&boot::x86_64::_end_physical}), - .mbi_range = std::make_pair(physical_address{std::bit_cast<std::byte *>(mbi)}, - physical_address{std::bit_cast<std::byte *>(mbi) + mbi->size_bytes()}), + return {.image_range = + std::make_pair(physical_address{&image_span.front()}, physical_address{&image_span.back()}), + .mbi_range = std::make_pair(physical_address{&mbi_span.front()}, physical_address{&mbi_span.back()}), .memory_map = mbi->memory_map()}; }; |
