From 796ce76185b00feb86f6b4f738ac6f953c247116 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 16 Mar 2026 22:30:39 +0100 Subject: arch/x86_64: begin new allocator draft --- arch/x86_64/CMakeLists.txt | 1 + .../include/arch/memory/higher_half_mapper.hpp | 19 ++++++++++++++ arch/x86_64/src/memory/higher_half_mapper.cpp | 29 ++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 arch/x86_64/include/arch/memory/higher_half_mapper.hpp create mode 100644 arch/x86_64/src/memory/higher_half_mapper.cpp diff --git a/arch/x86_64/CMakeLists.txt b/arch/x86_64/CMakeLists.txt index 7bcf7c2..41932c9 100644 --- a/arch/x86_64/CMakeLists.txt +++ b/arch/x86_64/CMakeLists.txt @@ -28,6 +28,7 @@ target_sources("x86_64" PRIVATE # Memory management "src/memory/kernel_mapper.cpp" + "src/memory/higher_half_mapper.cpp" "src/memory/mmu.cpp" "src/memory/page_table.cpp" "src/memory/region_allocator.cpp" diff --git a/arch/x86_64/include/arch/memory/higher_half_mapper.hpp b/arch/x86_64/include/arch/memory/higher_half_mapper.hpp new file mode 100644 index 0000000..66fb58b --- /dev/null +++ b/arch/x86_64/include/arch/memory/higher_half_mapper.hpp @@ -0,0 +1,19 @@ +#ifndef TEACHOS_X86_64_HIGHER_HALF_MAPPER_HPP +#define TEACHOS_X86_64_HIGHER_HALF_MAPPER_HPP + +#include "kapi/memory.hpp" +namespace arch::memory +{ + + struct higher_half_mapper : kapi::memory::page_mapper + { + auto map(kapi::memory::page page, kapi::memory::frame frame, flags flags) -> std::byte * override; + + auto unmap(kapi::memory::page page) -> void override; + + auto try_unmap(kapi::memory::page page) noexcept -> bool override; + }; + +} // namespace arch::memory + +#endif \ No newline at end of file diff --git a/arch/x86_64/src/memory/higher_half_mapper.cpp b/arch/x86_64/src/memory/higher_half_mapper.cpp new file mode 100644 index 0000000..9fe3c89 --- /dev/null +++ b/arch/x86_64/src/memory/higher_half_mapper.cpp @@ -0,0 +1,29 @@ +#include "arch/memory/higher_half_mapper.hpp" + +#include "kapi/memory.hpp" + +#include + +namespace arch::memory +{ + + auto higher_half_mapper::map(kapi::memory::page page, kapi::memory::frame frame, flags flags) -> std::byte * + { + static_cast(page); + static_cast(frame); + static_cast(flags); + return nullptr; + } + + auto higher_half_mapper::unmap(kapi::memory::page page) -> void + { + static_cast(page); + } + + auto higher_half_mapper::try_unmap(kapi::memory::page page) noexcept -> bool + { + static_cast(page); + return false; + } + +} // namespace arch::memory \ No newline at end of file -- cgit v1.2.3