From d83db2e66907e911e8fbf6f8d7145334738cb028 Mon Sep 17 00:00:00 2001 From: Erin Date: Tue, 6 Jun 2017 14:35:57 -0500 Subject: [PATCH] Use the old p4 table's page as a guard page --- src/arch/x86_64/memory/paging/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/arch/x86_64/memory/paging/mod.rs b/src/arch/x86_64/memory/paging/mod.rs index 4bce232..5ab1ce2 100644 --- a/src/arch/x86_64/memory/paging/mod.rs +++ b/src/arch/x86_64/memory/paging/mod.rs @@ -203,4 +203,8 @@ pub fn remap_kernel(allocator: &mut A, boot_info: &BootInformation) let old_table = active_table.switch(new_table); info!("Successfully switched to new page table."); + // Create a guard page in place of the old P4 table's page + let old_p4_page = Page::containing_address(old_table.p4_frame.start_address()); + active_table.unmap(old_p4_page, allocator); + info!("guard page established at {:#x}", old_p4_page.start_address()); }