Update post-10 code for changes in x86_64 0.5.0

We no longer need a custom translate function as we can directly use MapperAllSizes::translate_addr.
This commit is contained in:
Philipp Oppermann
2019-03-09 12:40:27 +01:00
parent 57998ea4f8
commit 10c4d0509d

View File

@@ -39,17 +39,6 @@ pub fn init_frame_allocator(
BootInfoFrameAllocator { frames } BootInfoFrameAllocator { frames }
} }
/// Returns the physical address for the given virtual address, or `None` if
/// the virtual address is not mapped.
pub fn translate_addr(addr: u64, recursive_page_table: &RecursivePageTable) -> Option<PhysAddr> {
let addr = VirtAddr::new(addr);
let page: Page = Page::containing_address(addr);
// perform the translation
let frame = recursive_page_table.translate_page(page);
frame.map(|frame| frame.start_address() + u64::from(addr.page_offset()))
}
pub fn create_example_mapping( pub fn create_example_mapping(
recursive_page_table: &mut RecursivePageTable, recursive_page_table: &mut RecursivePageTable,
frame_allocator: &mut impl FrameAllocator<Size4KiB>, frame_allocator: &mut impl FrameAllocator<Size4KiB>,