Struct x86_64::structures::paging::mapper::MappedPageTable
source · pub struct MappedPageTable<'a, P: PageTableFrameMapping> { /* private fields */ }Expand description
A Mapper implementation that relies on a PhysAddr to VirtAddr conversion function.
This type requires that the all physical page table frames are mapped to some virtual
address. Normally, this is done by mapping the complete physical address space into
the virtual address space at some offset. Other mappings between physical and virtual
memory are possible too, as long as they can be calculated as an PhysAddr to
VirtAddr closure.
Implementations§
source§impl<'a, P: PageTableFrameMapping> MappedPageTable<'a, P>
impl<'a, P: PageTableFrameMapping> MappedPageTable<'a, P>
sourcepub unsafe fn new(
level_4_table: &'a mut PageTable,
page_table_frame_mapping: P
) -> Self
pub unsafe fn new( level_4_table: &'a mut PageTable, page_table_frame_mapping: P ) -> Self
Creates a new MappedPageTable that uses the passed PageTableFrameMapping for converting virtual
to physical addresses.
Safety
This function is unsafe because the caller must guarantee that the passed page_table_frame_mapping
PageTableFrameMapping is correct. Also, the passed level_4_table must point to the level 4 page table
of a valid page table hierarchy. Otherwise this function might break memory safety, e.g.
by writing to an illegal memory location.
sourcepub fn level_4_table(&mut self) -> &mut PageTable
pub fn level_4_table(&mut self) -> &mut PageTable
Returns a mutable reference to the wrapped level 4 PageTable instance.
sourcepub fn page_table_frame_mapping(&self) -> &P
pub fn page_table_frame_mapping(&self) -> &P
Returns the PageTableFrameMapping used for converting virtual to physical addresses.