pub struct Mapper { /* private fields */ }
Implementations§
source§impl Mapper
impl Mapper
sourcepub fn dump_pte(&self, virtual_address: VirtualAddress)
pub fn dump_pte(&self, virtual_address: VirtualAddress)
Dumps all page table entries at all four page table levels for the given VirtualAddress
,
and also shows their PteFlags
.
The page table details are written to the log as an info
message.
sourcepub fn translate(
&self,
virtual_address: VirtualAddress
) -> Option<PhysicalAddress>
pub fn translate( &self, virtual_address: VirtualAddress ) -> Option<PhysicalAddress>
Translates a VirtualAddress
to a PhysicalAddress
by walking the page tables.
sourcepub fn translate_page(&self, page: Page) -> Option<Frame>
pub fn translate_page(&self, page: Page) -> Option<Frame>
Translates a virtual memory Page
to a physical memory Frame
by walking the page tables.
Note that this only supports translating a 4K page into a 4K frame, but it still correctly handles the cases where huge pages are used in the page tables.
sourcepub fn map_allocated_pages_to<P, FL>(
&mut self,
pages: AllocatedPages,
frames: AllocatedFrames<P>,
flags: FL
) -> Result<MappedPages, &'static str>where
P: PageSize,
FL: Into<PteFlagsArch>,
pub fn map_allocated_pages_to<P, FL>( &mut self, pages: AllocatedPages, frames: AllocatedFrames<P>, flags: FL ) -> Result<MappedPages, &'static str>where P: PageSize, FL: Into<PteFlagsArch>,
Maps the given virtual AllocatedPages
to the given physical AllocatedFrames
.
Consumes the given AllocatedPages
and returns a MappedPages
object which contains those AllocatedPages
.
sourcepub fn map_allocated_pages<FL: Into<PteFlagsArch>>(
&mut self,
pages: AllocatedPages,
flags: FL
) -> Result<MappedPages, &'static str>
pub fn map_allocated_pages<FL: Into<PteFlagsArch>>( &mut self, pages: AllocatedPages, flags: FL ) -> Result<MappedPages, &'static str>
Maps the given 4K-sized AllocatedPages
to randomly chosen (allocated) physical frames.
Consumes the given AllocatedPages
and returns a MappedPages
object which contains those AllocatedPages
.
Note on huge pages
This function only supports 4K-sized pages, not huge pages.
To use huge pages, you must provide the huge frames and call Self::map_allocated_pages_to()
.