Test unmap function

This commit is contained in:
Philipp Oppermann
2015-12-09 14:35:46 +01:00
parent cf5ea7664e
commit 8bb09f47f8
2 changed files with 31 additions and 1 deletions

View File

@@ -140,7 +140,7 @@ impl RecursivePageTable {
let frame = p1[page.p1_index()].pointed_frame().unwrap();
p1[page.p1_index()].set_unused();
// TODO free p(1,2,3) table if empty
allocator.deallocate_frame(frame);
//allocator.deallocate_frame(frame);
}
}
@@ -167,4 +167,14 @@ pub fn test_paging<A>(allocator: &mut A)
page_table.map_to(page, frame, EntryFlags::empty(), allocator);
println!("Some = {:?}", page_table.translate(addr));
println!("next free frame: {:?}", allocator.allocate_frame());
// test unmap
println!("{:#x}", unsafe {
*(Page::containing_address(addr).start_address() as *const u64)
});
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)
});
}