mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Remove paging testing code again
This commit is contained in:
@@ -53,8 +53,6 @@ pub extern fn rust_main(multiboot_information_address: usize) {
|
|||||||
kernel_start as usize, kernel_end as usize, multiboot_start,
|
kernel_start as usize, kernel_end as usize, multiboot_start,
|
||||||
multiboot_end, memory_map_tag.memory_areas());
|
multiboot_end, memory_map_tag.memory_areas());
|
||||||
|
|
||||||
memory::test_paging(&mut frame_allocator);
|
|
||||||
|
|
||||||
loop{}
|
loop{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ impl FrameAllocator for AreaFrameAllocator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn deallocate_frame(&mut self, _frame: Frame) {
|
fn deallocate_frame(&mut self, _frame: Frame) {
|
||||||
//unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
pub use self::area_frame_allocator::AreaFrameAllocator;
|
pub use self::area_frame_allocator::AreaFrameAllocator;
|
||||||
pub use self::paging::test_paging;
|
|
||||||
use self::paging::PhysicalAddress;
|
use self::paging::PhysicalAddress;
|
||||||
|
|
||||||
mod area_frame_allocator;
|
mod area_frame_allocator;
|
||||||
|
|||||||
@@ -155,30 +155,3 @@ impl ActivePageTable {
|
|||||||
//allocator.deallocate_frame(frame);
|
//allocator.deallocate_frame(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn test_paging<A>(allocator: &mut A)
|
|
||||||
where A: FrameAllocator
|
|
||||||
{
|
|
||||||
let mut page_table = unsafe { ActivePageTable::new() };
|
|
||||||
|
|
||||||
let addr = 42 * 512 * 512 * 4096; // 42th P3 entry
|
|
||||||
let page = Page::containing_address(addr);
|
|
||||||
let frame = allocator.allocate_frame().expect("no more frames");
|
|
||||||
println!("None = {:?}, map to {:?}",
|
|
||||||
page_table.translate(addr),
|
|
||||||
frame);
|
|
||||||
page_table.map_to(page, frame, EntryFlags::empty(), allocator);
|
|
||||||
println!("Some = {:?}", page_table.translate(addr));
|
|
||||||
println!("next free frame: {:?}", allocator.allocate_frame());
|
|
||||||
|
|
||||||
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)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user