From 7d90b6e9c25d2a609f2d7ac4b790e8fdc18f2126 Mon Sep 17 00:00:00 2001 From: Erin Date: Mon, 18 Sep 2017 22:33:49 -0500 Subject: [PATCH] memory: return the active page table after remapping the kernel --- src/arch/x86_64/memory/paging/mod.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/arch/x86_64/memory/paging/mod.rs b/src/arch/x86_64/memory/paging/mod.rs index ca4cdfd..3640cce 100644 --- a/src/arch/x86_64/memory/paging/mod.rs +++ b/src/arch/x86_64/memory/paging/mod.rs @@ -13,7 +13,7 @@ mod table; mod mapper; mod temporary_page; -use self::entry::*; +pub use self::entry::*; use self::table::{Table, Level4}; use self::temporary_page::TemporaryPage; use self::mapper::Mapper; @@ -180,7 +180,9 @@ impl Iterator for PageIter { /// Remap the kernel pub fn remap_kernel(allocator: &mut A, boot_info: &BootInformation) - where A: FrameAllocator { + -> ActivePageTable + where A: FrameAllocator +{ let mut scratch_page = TemporaryPage::new(Page { index: 0xabadcafe }, allocator); @@ -228,10 +230,12 @@ 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."); + 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()); + + active_table }