#[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: PartialOrd + PageSize> PartialOrd for Page<S>
impl<S: PartialOrd + PageSize> PartialOrd for Page<S>
Source§impl<S: PageSize> Step for Page<S>
impl<S: PageSize> Step for Page<S>
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