From db928db0b54e8495ae017d63932e5d8c39b29dda Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 31 Dec 2015 18:25:13 +0100 Subject: [PATCH] Unmap the old P4 page to create a basic guard page for the kernel stack --- src/memory/paging/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/memory/paging/mod.rs b/src/memory/paging/mod.rs index d3c906e3..54c4ef1f 100644 --- a/src/memory/paging/mod.rs +++ b/src/memory/paging/mod.rs @@ -223,4 +223,8 @@ pub fn remap_the_kernel(allocator: &mut A, boot_info: &BootInformation) let old_table = active_table.switch(new_table); println!("NEW TABLE!!!"); + + 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()); }