diff options
| -rw-r--r-- | arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp | 2 | ||||
| -rw-r--r-- | arch/x86_64/src/kernel/main.cpp | 9 |
2 files changed, 6 insertions, 5 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 f980451..897ae06 100644 --- a/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp +++ b/arch/x86_64/include/arch/memory/paging/kernel_mapper.hpp @@ -48,6 +48,8 @@ namespace teachos::arch::memory::paging inactive_page_table new_table{frame.value(), active_table, temporary_page}; remap_elf_kernel_sections(new_table, temporary_page, active_table); auto const old_table = switch_active_page_table(new_table); + // Turn old level 4 page table, mapped by assembler code into stack guard page. + // Only works if the identity mapped page tables by assembler are right above the stack. auto const old_level_4_page = virtual_page::containing_address(old_table.page_table_level_4_frame.start_address()); active_table.unmap_page(allocator, old_level_4_page); diff --git a/arch/x86_64/src/kernel/main.cpp b/arch/x86_64/src/kernel/main.cpp index 8c68a49..8a73630 100644 --- a/arch/x86_64/src/kernel/main.cpp +++ b/arch/x86_64/src/kernel/main.cpp @@ -35,11 +35,10 @@ namespace teachos::arch::kernel video::vga::text::write("Kernel remapping successfull", video::vga::text::common_attributes::green_on_black); } - // TODO: Seems to work correctly, Level 4 Index 0, Level 3 Index 0, Level 2 Index 0, Level 1 Index 184 = 753667 from - // mapping vga is still mapped - // set(CMAKE_POSITION_INDEPENDENT_CODE ON), should enable position independent code, but mapping still does not work - // with same error? - // Can we change the gcc call? gcc -fPIC -c mylibrary.cpp + // TODO: Why is identity mapping multiboot2 information structure with new kernel not required and + // allocator.allocate_frame still works? + // TODO: Fix unmapping old level 4 page table and turn it into guard page, use Stack Probes for stack allocation if + // possible. // TODO: Map heap virtual pages with active table |
