aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2025-11-18 18:14:30 +0100
committerFelix Morgner <felix.morgner@ost.ch>2025-11-18 18:14:30 +0100
commit49dcbdaaca348784d7fa05e12a06123f4dc252ec (patch)
treee49d3892b7f3e0c8ed62dcadb9e0ec1bd12caf40
parent31c5f011b2c7b4cc65d4017d92c2fe0bdf7f4ba6 (diff)
downloadteachos-49dcbdaaca348784d7fa05e12a06123f4dc252ec.tar.xz
teachos-49dcbdaaca348784d7fa05e12a06123f4dc252ec.zip
x86_64/memory: perform slight cleanup
-rw-r--r--arch/x86_64/include/x86_64/memory/region_allocator.hpp12
-rw-r--r--arch/x86_64/src/kapi/memory.cpp5
2 files changed, 13 insertions, 4 deletions
diff --git a/arch/x86_64/include/x86_64/memory/region_allocator.hpp b/arch/x86_64/include/x86_64/memory/region_allocator.hpp
index 4a18a0f..3ddc8b6 100644
--- a/arch/x86_64/include/x86_64/memory/region_allocator.hpp
+++ b/arch/x86_64/include/x86_64/memory/region_allocator.hpp
@@ -20,8 +20,20 @@ namespace teachos::memory::x86_64
{
struct memory_information
{
+ //! The memory range occupied by the loaded kernel image. This includes all sections that are marked as occupying
+ //! space in the kernel executable. The internal structure of this area is more described in a more fine-grained
+ //! manner by the ELF symbol information provided in the Multiboot2 information by the loader.
std::pair<physical_address, physical_address> image_range;
+
+ //! The memory range occupied by the loader supplied Multiboot2 information structure. In general, this
+ //! information is allocated somewhere in the range of the loaded image, but the loader protocol does not
+ //! guarantee this. It is thus imperative to be able to handle the cases where the loader chooses to allocate the
+ //! information structure outside of the image range.
std::pair<physical_address, physical_address> mbi_range;
+
+ //! The loader supplied map of memory regions. These include available, unavailable, and reclaimable regions. In
+ //! general, only frames that are located in non-reserved (as in available) regions should be allocated for page
+ //! storage.
multiboot2::memory_map memory_map;
};
diff --git a/arch/x86_64/src/kapi/memory.cpp b/arch/x86_64/src/kapi/memory.cpp
index e05fde9..aa3eb58 100644
--- a/arch/x86_64/src/kapi/memory.cpp
+++ b/arch/x86_64/src/kapi/memory.cpp
@@ -27,15 +27,12 @@ namespace teachos::memory
auto create_memory_information() -> x86_64::region_allocator::memory_information
{
auto const & mbi = boot::x86_64::multiboot_information_pointer.get();
- auto map = mbi->memory_map();
- // NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic)
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()}),
- .memory_map = map};
- // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic)
+ .memory_map = mbi->memory_map()};
};
auto create_early_frame_allocator()