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>
impl<'a, P: PTEArch> PageTableRef<'a, P>
Sourcepub fn create_empty(access: &mut impl Access) -> PagingResult<Self>
pub fn create_empty(access: &mut impl Access) -> PagingResult<Self>
Creates a new page table reference.
Sourcepub fn new_with_level(
level: usize,
access: &mut impl Access,
) -> PagingResult<Self>
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.
pub fn from_addr(addr: usize, level: usize) -> Self
pub fn level(&self) -> usize
pub fn paddr(&self) -> usize
Sourcepub 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
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.
Sourcepub unsafe fn map_region(
&mut self,
config: MapConfig,
size: usize,
allow_block: bool,
access: &mut impl Access,
) -> PagingResult<()>
pub unsafe fn map_region( &mut self, config: MapConfig, size: usize, allow_block: bool, access: &mut impl Access, ) -> PagingResult<()>
pub fn as_slice(&self, access: &impl Access) -> &'a [Pte<P>]
pub fn release(&mut self, access: &mut impl Access)
pub fn entry_size(&self) -> usize
pub fn table_size(&self) -> usize
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>
impl<'a, P: Clone + PTEArch> Clone for PageTableRef<'a, P>
Source§fn clone(&self) -> PageTableRef<'a, P>
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreimpl<'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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)