#[repr(C)]pub struct Page<S: PageSize = Size4KiB> { /* private fields */ }
Expand description
A virtual memory page.
Implementations§
source§impl<S: PageSize> Page<S>
impl<S: PageSize> Page<S>
sourcepub const fn from_start_address(
address: VirtAddr
) -> Result<Self, AddressNotAligned>
pub const fn from_start_address( address: VirtAddr ) -> Result<Self, 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).
sourcepub const unsafe fn from_start_address_unchecked(
start_address: VirtAddr
) -> Self
pub const unsafe fn from_start_address_unchecked( start_address: VirtAddr ) -> Self
Returns the page that starts at the given virtual address.
§Safety
The address must be correctly aligned.
sourcepub const fn containing_address(address: VirtAddr) -> Self
pub const fn containing_address(address: VirtAddr) -> Self
Returns the page that contains the given virtual address.
sourcepub const fn start_address(self) -> VirtAddr
pub const fn start_address(self) -> VirtAddr
Returns the start address of the page.
sourcepub const fn p4_index(self) -> PageTableIndex
pub const fn p4_index(self) -> PageTableIndex
Returns the level 4 page table index of this page.
sourcepub const fn p3_index(self) -> PageTableIndex
pub const fn p3_index(self) -> PageTableIndex
Returns the level 3 page table index of this page.
sourcepub 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.
sourcepub const fn range(start: Self, end: Self) -> PageRange<S> ⓘ
pub const fn range(start: Self, end: Self) -> PageRange<S> ⓘ
Returns a range of pages, exclusive end
.
sourcepub const fn range_inclusive(start: Self, end: Self) -> PageRangeInclusive<S> ⓘ
pub const fn range_inclusive(start: Self, end: Self) -> PageRangeInclusive<S> ⓘ
Returns a range of pages, inclusive end
.
source§impl<S: NotGiantPageSize> Page<S>
impl<S: NotGiantPageSize> Page<S>
sourcepub const fn p2_index(self) -> PageTableIndex
pub const fn p2_index(self) -> PageTableIndex
Returns the level 2 page table index of this page.
source§impl Page<Size1GiB>
impl Page<Size1GiB>
sourcepub const fn from_page_table_indices_1gib(
p4_index: PageTableIndex,
p3_index: PageTableIndex
) -> Self
pub const fn from_page_table_indices_1gib( p4_index: PageTableIndex, p3_index: PageTableIndex ) -> Self
Returns the 1GiB memory page with the specified page table indices.
source§impl Page<Size2MiB>
impl Page<Size2MiB>
sourcepub const fn from_page_table_indices_2mib(
p4_index: PageTableIndex,
p3_index: PageTableIndex,
p2_index: PageTableIndex
) -> Self
pub const fn from_page_table_indices_2mib( p4_index: PageTableIndex, p3_index: PageTableIndex, p2_index: PageTableIndex ) -> Self
Returns the 2MiB memory page with the specified page table indices.
source§impl Page<Size4KiB>
impl Page<Size4KiB>
sourcepub const fn from_page_table_indices(
p4_index: PageTableIndex,
p3_index: PageTableIndex,
p2_index: PageTableIndex,
p1_index: PageTableIndex
) -> Self
pub const fn from_page_table_indices( p4_index: PageTableIndex, p3_index: PageTableIndex, p2_index: PageTableIndex, p1_index: PageTableIndex ) -> Self
Returns the 4KiB memory page with the specified page table indices.
sourcepub 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§
source§impl<S: PageSize> AddAssign<u64> for Page<S>
impl<S: PageSize> AddAssign<u64> for Page<S>
source§fn add_assign(&mut self, rhs: u64)
fn add_assign(&mut self, rhs: u64)
+=
operation. Read moresource§impl<S: Ord + PageSize> Ord for Page<S>
impl<S: Ord + PageSize> Ord for Page<S>
source§impl<S: PartialEq + PageSize> PartialEq for Page<S>
impl<S: PartialEq + PageSize> PartialEq for Page<S>
source§impl<S: PartialOrd + PageSize> PartialOrd for Page<S>
impl<S: PartialOrd + PageSize> PartialOrd for Page<S>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<S: PageSize> Step for Page<S>
Available on crate feature step_trait
only.
impl<S: PageSize> Step for Page<S>
step_trait
only.source§fn steps_between(start: &Self, end: &Self) -> Option<usize>
fn steps_between(start: &Self, end: &Self) -> Option<usize>
step_trait
)source§fn forward_checked(start: Self, count: usize) -> Option<Self>
fn forward_checked(start: Self, count: usize) -> Option<Self>
step_trait
)source§fn backward_checked(start: Self, count: usize) -> Option<Self>
fn backward_checked(start: Self, count: usize) -> Option<Self>
step_trait
)source§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
)source§impl<S: PageSize> SubAssign<u64> for Page<S>
impl<S: PageSize> SubAssign<u64> for Page<S>
source§fn sub_assign(&mut self, rhs: u64)
fn sub_assign(&mut self, rhs: u64)
-=
operation. Read more