Struct Page
#[repr(C)]pub struct Page<S = Size4KiB>where
S: PageSize,{
start_address: VirtAddr,
size: PhantomData<S>,
}Expand description
A virtual memory page.
Fields§
§start_address: VirtAddr§size: PhantomData<S>Implementations§
§impl<S> Page<S>where
S: PageSize,
impl<S> Page<S>where
S: PageSize,
pub const fn from_start_address(
address: VirtAddr,
) -> Result<Page<S>, AddressNotAligned>
pub const fn from_start_address( address: VirtAddr, ) -> Result<Page<S>, AddressNotAligned>
Returns the page that starts at the given virtual address.
Returns an error if the address is not correctly aligned (i.e. is not a valid page start).
pub const unsafe fn from_start_address_unchecked(
start_address: VirtAddr,
) -> Page<S>
pub const unsafe fn from_start_address_unchecked( start_address: VirtAddr, ) -> Page<S>
Returns the page that starts at the given virtual address.
§Safety
The address must be correctly aligned.
pub const fn containing_address(address: VirtAddr) -> Page<S>
pub const fn containing_address(address: VirtAddr) -> Page<S>
Returns the page that contains the given virtual address.
pub const fn start_address(self) -> VirtAddr
pub const fn start_address(self) -> VirtAddr
Returns the start address of the page.
pub const fn p4_index(self) -> PageTableIndex
pub const fn p4_index(self) -> PageTableIndex
Returns the level 4 page table index of this page.
pub const fn p3_index(self) -> PageTableIndex
pub const fn p3_index(self) -> PageTableIndex
Returns the level 3 page table index of this page.
pub const fn page_table_index(self, level: PageTableLevel) -> PageTableIndex
pub const fn page_table_index(self, level: PageTableLevel) -> PageTableIndex
Returns the table index of this page at the specified level.
pub const fn range(start: Page<S>, end: Page<S>) -> PageRange<S> ⓘ
pub const fn range(start: Page<S>, end: Page<S>) -> PageRange<S> ⓘ
Returns a range of pages, exclusive end.
pub const fn range_inclusive(
start: Page<S>,
end: Page<S>,
) -> PageRangeInclusive<S> ⓘ
pub const fn range_inclusive( start: Page<S>, end: Page<S>, ) -> PageRangeInclusive<S> ⓘ
Returns a range of pages, inclusive end.
§impl<S> Page<S>where
S: NotGiantPageSize,
impl<S> Page<S>where
S: NotGiantPageSize,
pub const fn p2_index(self) -> PageTableIndex
pub const fn p2_index(self) -> PageTableIndex
Returns the level 2 page table index of this page.
§impl Page<Size1GiB>
impl Page<Size1GiB>
pub const fn from_page_table_indices_1gib(
p4_index: PageTableIndex,
p3_index: PageTableIndex,
) -> Page<Size1GiB>
pub const fn from_page_table_indices_1gib( p4_index: PageTableIndex, p3_index: PageTableIndex, ) -> Page<Size1GiB>
Returns the 1GiB memory page with the specified page table indices.
§impl Page<Size2MiB>
impl Page<Size2MiB>
pub const fn from_page_table_indices_2mib(
p4_index: PageTableIndex,
p3_index: PageTableIndex,
p2_index: PageTableIndex,
) -> Page<Size2MiB>
pub const fn from_page_table_indices_2mib( p4_index: PageTableIndex, p3_index: PageTableIndex, p2_index: PageTableIndex, ) -> Page<Size2MiB>
Returns the 2MiB memory page with the specified page table indices.
§impl Page
impl Page
pub const fn from_page_table_indices(
p4_index: PageTableIndex,
p3_index: PageTableIndex,
p2_index: PageTableIndex,
p1_index: PageTableIndex,
) -> Page
pub const fn from_page_table_indices( p4_index: PageTableIndex, p3_index: PageTableIndex, p2_index: PageTableIndex, p1_index: PageTableIndex, ) -> Page
Returns the 4KiB memory page with the specified page table indices.
pub const fn p1_index(self) -> PageTableIndex
pub const fn p1_index(self) -> PageTableIndex
Returns the level 1 page table index of this page.
Trait Implementations§
§impl<S> AddAssign<u64> for Page<S>where
S: PageSize,
impl<S> AddAssign<u64> for Page<S>where
S: PageSize,
§fn add_assign(&mut self, rhs: u64)
fn add_assign(&mut self, rhs: u64)
+= operation. Read moreimpl<S> Copy for Page<S>
impl<S> Eq for Page<S>
§impl<S> Ord for Page<S>
impl<S> Ord for Page<S>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
§impl<S> PartialOrd for Page<S>where
S: PartialOrd + PageSize,
impl<S> PartialOrd for Page<S>where
S: PartialOrd + PageSize,
§impl<S> Step for Page<S>where
S: PageSize,
Available on crate feature step_trait only.
impl<S> Step for Page<S>where
S: PageSize,
step_trait only.§fn steps_between(start: &Page<S>, end: &Page<S>) -> (usize, Option<usize>)
fn steps_between(start: &Page<S>, end: &Page<S>) -> (usize, Option<usize>)
step_trait)start to end
like Iterator::size_hint(). Read more§fn forward_checked(start: Page<S>, count: usize) -> Option<Page<S>>
fn forward_checked(start: Page<S>, count: usize) -> Option<Page<S>>
step_trait)§fn backward_checked(start: Page<S>, count: usize) -> Option<Page<S>>
fn backward_checked(start: Page<S>, count: usize) -> Option<Page<S>>
step_trait)§fn forward_overflowing(start: Page<S>, count: usize) -> (Page<S>, bool)
fn forward_overflowing(start: Page<S>, count: usize) -> (Page<S>, bool)
step_trait)self count times along with a boolean tracking whether overflow
occurred. Read more§fn backward_overflowing(start: Page<S>, count: usize) -> (Page<S>, bool)
fn backward_overflowing(start: Page<S>, count: usize) -> (Page<S>, bool)
step_trait)self count times along with a boolean tracking whether overflow
occurred. Read moreSource§fn forward(start: Self, count: usize) -> Self
fn forward(start: Self, count: usize) -> Self
step_trait)Source§unsafe fn forward_unchecked(start: Self, count: usize) -> Self
unsafe fn forward_unchecked(start: Self, count: usize) -> Self
step_trait)Source§fn backward(start: Self, count: usize) -> Self
fn backward(start: Self, count: usize) -> Self
step_trait)Source§unsafe fn backward_unchecked(start: Self, count: usize) -> Self
unsafe fn backward_unchecked(start: Self, count: usize) -> Self
step_trait)impl<S> StructuralPartialEq for Page<S>
Auto Trait Implementations§
impl<S> Freeze for Page<S>
impl<S> RefUnwindSafe for Page<S>where
S: RefUnwindSafe,
impl<S> Send for Page<S>where
S: Send,
impl<S> Sync for Page<S>where
S: Sync,
impl<S> Unpin for Page<S>where
S: Unpin,
impl<S> UnsafeUnpin for Page<S>
impl<S> UnwindSafe for Page<S>where
S: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more