diff --git a/src/memory.rs b/src/memory.rs index c64b72d4..1e84256e 100644 --- a/src/memory.rs +++ b/src/memory.rs @@ -1,8 +1,6 @@ use bootloader::bootinfo::{MemoryMap, MemoryRegionType}; use x86_64::{ - structures::paging::{ - FrameAllocator, Mapper, OffsetPageTable, Page, PageTable, PhysFrame, Size4KiB, - }, + structures::paging::{FrameAllocator, OffsetPageTable, PageTable, PhysFrame, Size4KiB}, PhysAddr, VirtAddr, }; @@ -35,24 +33,6 @@ unsafe fn active_level_4_table(physical_memory_offset: VirtAddr) -> &'static mut &mut *page_table_ptr // unsafe } -/// Creates an example mapping for the given page to frame `0xb8000`. -pub fn create_example_mapping( - page: Page, - mapper: &mut OffsetPageTable, - frame_allocator: &mut impl FrameAllocator, -) { - use x86_64::structures::paging::PageTableFlags as Flags; - - let frame = PhysFrame::containing_address(PhysAddr::new(0xb8000)); - let flags = Flags::PRESENT | Flags::WRITABLE; - - let map_to_result = unsafe { - // FIXME: this is not safe, we do it only for testing - mapper.map_to(page, frame, flags, frame_allocator) - }; - map_to_result.expect("map_to failed").flush(); -} - /// A FrameAllocator that always returns `None`. pub struct EmptyFrameAllocator;