From 416f08ee8791aeeb15e216650711f2a84e6f8114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matteo=20Gm=C3=BCr?= Date: Tue, 5 Nov 2024 10:15:25 +0000 Subject: Read cr3 register instead of translating page table level 4 virtual address --- arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'arch') 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 :( -- cgit v1.2.3