Fix unmap function by flushing the TLB

This commit is contained in:
Philipp Oppermann
2015-12-09 15:03:29 +01:00
parent 8bb09f47f8
commit 75264e7cac
4 changed files with 20 additions and 4 deletions

View File

@@ -21,6 +21,7 @@ extern crate spin;
extern crate multiboot2;
#[macro_use]
extern crate bitflags;
extern crate x86;
#[macro_use]
mod vga_buffer;

View File

@@ -139,6 +139,7 @@ impl RecursivePageTable {
.expect("mapping code does not support huge pages");
let frame = p1[page.p1_index()].pointed_frame().unwrap();
p1[page.p1_index()].set_unused();
unsafe { ::x86::tlb::flush(page.start_address() )};
// TODO free p(1,2,3) table if empty
//allocator.deallocate_frame(frame);
}
@@ -174,7 +175,4 @@ pub fn test_paging<A>(allocator: &mut A)
});
page_table.unmap(Page::containing_address(addr), allocator);
println!("None = {:?}", page_table.translate(addr));
println!("{:#x}", unsafe {
*(Page::containing_address(addr).start_address() as *const u64)
});
}