page_table_generic

Struct PageTableRef

Source
pub struct PageTableRef<'a, P: PTEArch> { /* private fields */ }
Expand description

A reference to a page table.

LEN is the number of entries in a page table. LEVEL is the max level of the page table.

Implementations§

Source§

impl<'a, P: PTEArch> PageTableRef<'a, P>

Source

pub fn create_empty(access: &mut impl Access) -> PagingResult<Self>

Creates a new page table reference.

Source

pub fn new_with_level( level: usize, access: &mut impl Access, ) -> PagingResult<Self>

New page table and returns a reference to it.

level is level of this page, should from 1 to up.

Source

pub fn from_addr(addr: usize, level: usize) -> Self

Source

pub fn level(&self) -> usize

Source

pub fn paddr(&self) -> usize

Source

pub unsafe fn map_region_with_handle( &mut self, cfg: MapConfig, size: usize, allow_block: bool, access: &mut impl Access, on_page_mapped: Option<&impl Fn(*const u8)>, ) -> PagingResult

Map a contiguous virtual memory region to a contiguous physical memory region with the given mapping flags.

The virtual and physical memory regions start with vaddr and paddr respectively. The region size is size. The addresses and size must be aligned to 4K, otherwise it will return Err(PagingError::NotAligned).

When allow_huge is true, it will try to map the region with huge pages if possible. Otherwise, it will map the region with 4K pages.

Source

pub unsafe fn map_region( &mut self, config: MapConfig, size: usize, allow_block: bool, access: &mut impl Access, ) -> PagingResult<()>

.

§Errors

This function will return an error if .

§Safety

.

Source

pub fn as_slice(&self, access: &impl Access) -> &'a [Pte<P>]

Source

pub fn release(&mut self, access: &mut impl Access)

Source

pub fn entry_size(&self) -> usize

Source

pub fn table_size(&self) -> usize

Source

pub fn iter_all<A: Access>( &self, access: &'a A, ) -> impl Iterator<Item = PTEInfo> + 'a

Trait Implementations§

Source§

impl<'a, P: Clone + PTEArch> Clone for PageTableRef<'a, P>

Source§

fn clone(&self) -> PageTableRef<'a, P>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, P: Copy + PTEArch> Copy for PageTableRef<'a, P>

Auto Trait Implementations§

§

impl<'a, P> Freeze for PageTableRef<'a, P>

§

impl<'a, P> RefUnwindSafe for PageTableRef<'a, P>
where P: RefUnwindSafe,

§

impl<'a, P> Send for PageTableRef<'a, P>

§

impl<'a, P> Sync for PageTableRef<'a, P>

§

impl<'a, P> Unpin for PageTableRef<'a, P>

§

impl<'a, P> UnwindSafe for PageTableRef<'a, P>
where P: RefUnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.