aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/kapi/memory.cpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2025-12-01 19:32:19 +0100
committerFelix Morgner <felix.morgner@ost.ch>2025-12-01 19:32:19 +0100
commit203355e51690073e571d4906d53f2494c3dad41b (patch)
tree538180b7d5fbaf4327394521c02d403537314c6b /arch/x86_64/src/kapi/memory.cpp
parent005d7ea3df29e736750d409b816caa29cf9bab2f (diff)
downloadteachos-203355e51690073e571d4906d53f2494c3dad41b.tar.xz
teachos-203355e51690073e571d4906d53f2494c3dad41b.zip
x86_64/memory: prepare scoped_mapping extraction
Diffstat (limited to 'arch/x86_64/src/kapi/memory.cpp')
-rw-r--r--arch/x86_64/src/kapi/memory.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86_64/src/kapi/memory.cpp b/arch/x86_64/src/kapi/memory.cpp
index f34729a..920c82b 100644
--- a/arch/x86_64/src/kapi/memory.cpp
+++ b/arch/x86_64/src/kapi/memory.cpp
@@ -10,6 +10,7 @@
#include "x86_64/memory/page_table.hpp"
#include "x86_64/memory/paging_root.hpp"
#include "x86_64/memory/region_allocator.hpp"
+#include "x86_64/memory/scoped_mapping.hpp"
#include <multiboot2/information.hpp>
@@ -140,8 +141,19 @@ namespace teachos::memory
auto allocator = create_early_frame_allocator();
enable_cpu_protections();
+
+ // TODO: remove
inject_faux_pml4(allocator);
+ // TODO: implement
+ auto temporary_mapper = x86_64::scoped_mapping{linear_address{unused_page_address}, allocator};
+ auto new_pml4_frame = allocator.allocate();
+
+ auto new_plm4 = temporary_mapper.map_as<x86_64::page_table>(
+ *new_pml4_frame, x86_64::page_table::entry::flags::present | x86_64::page_table::entry::flags::writable);
+ (*new_plm4)[510].frame(new_pml4_frame.value(),
+ x86_64::page_table::entry::flags::present | x86_64::page_table::entry::flags::writable);
+
// paging::kernel_mapper kernel(allocator, memory_information);
// kernel.remap_kernel();
// video::vga::text::write("Kernel remapping successful", video::vga::text::common_attributes::green_on_black);