aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64
diff options
context:
space:
mode:
authorMatteo Gmür <matteo.gmuer1@ost.ch>2024-11-05 10:15:25 +0000
committerMatteo Gmür <matteo.gmuer1@ost.ch>2024-11-05 10:15:25 +0000
commit416f08ee8791aeeb15e216650711f2a84e6f8114 (patch)
tree7c703d17a82875b8ec9fc5f2d32dac040f8e5f2e /arch/x86_64
parentdc80a11864444cae275e9e7be9ae120a92433034 (diff)
downloadteachos-416f08ee8791aeeb15e216650711f2a84e6f8114.tar.xz
teachos-416f08ee8791aeeb15e216650711f2a84e6f8114.zip
Read cr3 register instead of translating page table level 4 virtual address
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp14
1 files changed, 1 insertions, 13 deletions
diff --git a/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp b/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp
index 9803050..67d1673 100644
--- a/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp
+++ b/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp
@@ -69,19 +69,7 @@ namespace teachos::arch::memory::paging
auto remap_elf_kernel_sections(inactive_page_table inactive_table, temporary_page & temporary_page,
active_page_table & active_table) -> void
{
- auto const physical_address = active_table.translate_address(cpu::PAGE_TABLE_LEVEL_4_ADDRESS);
- exception_handling::assert(physical_address.has_value(),
- "[Kernel Mapper] Physical address for active table not mapped");
-
- auto const backup = allocator::physical_frame::containing_address(physical_address.value());
- auto const backup2 = allocator::physical_frame::containing_address(cpu::read_cr3_register());
- cpu::write_cr3_register(0x221000);
- auto const backup3 = cpu::read_cr3_register();
-
- if (backup == backup2 && backup3 == 0x221000)
- {
- }
-
+ auto const backup = allocator::physical_frame::containing_address(cpu::read_cr3_register());
auto page_table_level4 = temporary_page.map_table_frame(backup, active_table);
// TODO: Page Table Level 4 is invalid, all entries point to non-existent memory :(