From c6dd37dcc503fae00b76298258eb706ff64ff40d Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Tue, 18 Apr 2017 12:35:19 +0200 Subject: [PATCH] Turn page of old P4 into guard page --- src/memory/paging/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/memory/paging/mod.rs b/src/memory/paging/mod.rs index 73b0d531..06843620 100644 --- a/src/memory/paging/mod.rs +++ b/src/memory/paging/mod.rs @@ -196,4 +196,11 @@ pub fn remap_the_kernel(allocator: &mut A, boot_info: &BootInformation) let old_table = active_table.switch(new_table); println!("NEW TABLE!!!"); + + // turn the old p4 page into a guard page + let old_p4_page = Page::containing_address( + old_table.p4_frame.start_address() + ); + active_table.unmap(old_p4_page, allocator); + println!("guard page at {:#x}", old_p4_page.start_address()); }