diff options
Diffstat (limited to 'arch/x86_64/src/kapi/memory.cpp')
| -rw-r--r-- | arch/x86_64/src/kapi/memory.cpp | 12 |
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); |
