page_table_generic

Struct PageTableRef

Source
pub struct PageTableRef<'a, P: GenericPTE, const LEN: usize, const LEVEL: usize> {
    pub level: usize,
    /* 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.

Fields§

§level: usize

Implementations§

Source§

impl<'a, P: GenericPTE, const LEN: usize, const LEVEL: usize> PageTableRef<'_, P, LEN, LEVEL>

Source

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

Source§

impl<'a, P: GenericPTE, const LEN: usize, const LEVEL: usize> PageTableRef<'a, P, LEN, LEVEL>

Source

pub fn paddr(&self) -> usize

Source

pub unsafe fn new_with_level( level: usize, access: &mut impl Access, ) -> PagingResult<PageTableRef<'static, P, LEN, LEVEL>>

New page table and returns a reference to it.

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

§Panics

Panics if level is not supported.

§Errors

This function will return an error if allocating memory fails.

§Safety

table should be deallocated manually.

Source

pub fn from_ref( value: &'a [P; LEN], level: usize, access: &mut impl Access, ) -> Self

Source

pub fn entry_size(&self) -> usize

Source

pub fn get_pte_mut( &mut self, vaddr: *const u8, access: &mut impl Access, ) -> Option<&mut P>

Source

pub fn walk<F: Fn(&WalkInfo<P>)>(&self, f: F, access: &impl Access)

Trait Implementations§

Source§

impl<'a, P: Clone + GenericPTE, const LEN: usize, const LEVEL: usize> Clone for PageTableRef<'a, P, LEN, LEVEL>

Source§

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

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<P: GenericPTE, const LEN: usize, const LEVEL: usize> PageTableFn for PageTableRef<'_, P, LEN, LEVEL>

Source§

unsafe fn map( &mut self, cfg: &MapConfig, page_level: usize, access: &mut impl Access, ) -> PagingResult

Map a page or block of memory. Read more
Source§

unsafe fn new(access: &mut impl Access) -> PagingResult<Self>

Create a new page table. Read more
Source§

fn level_entry_size(&self, level: usize) -> usize

Source§

fn detect_page_level(&self, vaddr: *const u8, size: usize) -> usize

Source§

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

Source§

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. Read more
Source§

impl<'a, P: Copy + GenericPTE, const LEN: usize, const LEVEL: usize> Copy for PageTableRef<'a, P, LEN, LEVEL>

Auto Trait Implementations§

§

impl<'a, P, const LEN: usize, const LEVEL: usize> Freeze for PageTableRef<'a, P, LEN, LEVEL>

§

impl<'a, P, const LEN: usize, const LEVEL: usize> RefUnwindSafe for PageTableRef<'a, P, LEN, LEVEL>
where P: RefUnwindSafe,

§

impl<'a, P, const LEN: usize, const LEVEL: usize> Send for PageTableRef<'a, P, LEN, LEVEL>

§

impl<'a, P, const LEN: usize, const LEVEL: usize> Sync for PageTableRef<'a, P, LEN, LEVEL>

§

impl<'a, P, const LEN: usize, const LEVEL: usize> Unpin for PageTableRef<'a, P, LEN, LEVEL>

§

impl<'a, P, const LEN: usize, const LEVEL: usize> UnwindSafe for PageTableRef<'a, P, LEN, LEVEL>
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.