Struct memory::Mapper

source ·
pub struct Mapper { /* private fields */ }

Implementations§

source§

impl Mapper

source

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.

source

pub fn translate( &self, virtual_address: VirtualAddress ) -> Option<PhysicalAddress>

Translates a VirtualAddress to a PhysicalAddress by walking the page tables.

source

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.

source

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.

source

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().

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.