diff options
| author | Matteo Gmür <matteo.gmuer1@ost.ch> | 2024-11-05 10:15:25 +0000 |
|---|---|---|
| committer | Matteo Gmür <matteo.gmuer1@ost.ch> | 2024-11-05 10:15:25 +0000 |
| commit | 416f08ee8791aeeb15e216650711f2a84e6f8114 (patch) | |
| tree | 7c703d17a82875b8ec9fc5f2d32dac040f8e5f2e | |
| parent | dc80a11864444cae275e9e7be9ae120a92433034 (diff) | |
| download | teachos-416f08ee8791aeeb15e216650711f2a84e6f8114.tar.xz teachos-416f08ee8791aeeb15e216650711f2a84e6f8114.zip | |
Read cr3 register instead of translating page table level 4 virtual address
| -rw-r--r-- | arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp | 14 |
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 :( |
