Skip to main content

PteAllocator

Struct PteAllocator 

Source
pub struct PteAllocator<'a, PTE, Mapper, Error>
where PTE: FromPrimitive + PrimInt + Unsigned, Mapper: PageTableMapper<PTE, Error>,
{ pub mapper: &'a mut Mapper, pub format: &'a PageFormat<'a, PTE>, pub mask: Option<PTE>, pub error: PhantomData<Error>, }
Expand description

The PteAllocator struct is an implementation of a crate::walker::PageWalkerMut used to allocate pages and the underlying page tables for a given virtual address range. This is used by the AddressSpace::allocate_range method.

Fields§

§mapper: &'a mut Mapper

The page table mapper.

§format: &'a PageFormat<'a, PTE>

The page format.

§mask: Option<PTE>

The mask to set for pages.

§error: PhantomData<Error>

A marker for Error.

Trait Implementations§

Source§

impl<'a, PTE, Mapper, Error> PageWalkerMut<PTE, Error> for PteAllocator<'a, PTE, Mapper, Error>
where PTE: FromPrimitive + PrimInt + Unsigned, Mapper: PageTableMapper<PTE, Error>,

Source§

fn read_pte(&self, phys_addr: PTE) -> Result<PTE, Error>

Reads the PTE at the given physical address.

Source§

fn write_pte(&mut self, phys_addr: PTE, value: PTE) -> Result<(), Error>

Writes the PTE to the given physical address.

Source§

fn handle_pte_hole( &mut self, index: usize, _range: Range<usize>, pte: &mut PTE, ) -> Result<(), Error>

Allocates the page or page table for the current level as we are handling PTE holes. If the mask is set to None, then this function only allocates page tables.

Source§

fn handle_pte( &mut self, _page_type: PteType, _range: Range<usize>, _pte: &mut PTE, ) -> Result<(), Error>

This callback handles the current PTE unconditionally and is given the PteType, the virtual address range and a mutable reference to the PTE. The implementation of this callback is optional.
Source§

fn handle_post_pte( &mut self, _level: usize, _range: Range<usize>, _pte: &mut PTE, ) -> Result<(), Error>

This callback handles the PTE of a page table after recursing the page table hierarchy, and is given the level, the virtual address and a mutable reference to the PTE. The implementation of this callback is optional.

Auto Trait Implementations§

§

impl<'a, PTE, Mapper, Error> Freeze for PteAllocator<'a, PTE, Mapper, Error>
where PTE: Freeze,

§

impl<'a, PTE, Mapper, Error> RefUnwindSafe for PteAllocator<'a, PTE, Mapper, Error>
where Mapper: RefUnwindSafe, PTE: RefUnwindSafe, Error: RefUnwindSafe,

§

impl<'a, PTE, Mapper, Error> Send for PteAllocator<'a, PTE, Mapper, Error>
where Mapper: Send, PTE: Send + Sync, Error: Send,

§

impl<'a, PTE, Mapper, Error> Sync for PteAllocator<'a, PTE, Mapper, Error>
where Mapper: Sync, PTE: Sync, Error: Sync,

§

impl<'a, PTE, Mapper, Error> Unpin for PteAllocator<'a, PTE, Mapper, Error>
where PTE: Unpin, Error: Unpin,

§

impl<'a, PTE, Mapper, Error> UnsafeUnpin for PteAllocator<'a, PTE, Mapper, Error>
where PTE: UnsafeUnpin,

§

impl<'a, PTE, Mapper, Error> !UnwindSafe for PteAllocator<'a, PTE, Mapper, Error>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.