pub struct Page<P = Page4K>where
P: PageSize,{ /* private fields */ }
Expand description
A Page
is a chunk of virtual memory aligned to a page boundary (default 4KiB) given by the P
parameter.
Implementations§
§impl Page<Page4K>
impl Page<Page4K>
pub const fn containing_address(addr: VirtualAddress) -> Page<Page4K>
pub const fn containing_address(addr: VirtualAddress) -> Page<Page4K>
Returns the 4KiB Page
containing the given VirtualAddress
.
pub const fn align_up(&self, alignment_4k_pages: usize) -> Page<Page4K>
pub const fn align_up(&self, alignment_4k_pages: usize) -> Page<Page4K>
Returns a new Page
that is aligned up from this Page
to the nearest multiple of alignment_4k_pages
.
pub const fn from_4k_into_generic<P>(self) -> Page<P>where
P: PageSize,
pub const fn from_4k_into_generic<P>(self) -> Page<P>where P: PageSize,
Converts a known 4K-sized Page
into a
Page<P>
with a generic PageSize
parameter.
§impl Page<Page2M>
impl Page<Page2M>
pub const fn containing_address_2mb(addr: VirtualAddress) -> Page<Page2M>
pub const fn containing_address_2mb(addr: VirtualAddress) -> Page<Page2M>
Returns the 2MiB huge Page
containing the given VirtualAddress
.
pub const fn from_2m_into_generic<P>(self) -> Page<P>where
P: PageSize,
pub const fn from_2m_into_generic<P>(self) -> Page<P>where P: PageSize,
Converts a known 2M-sized Page
into a
Page<P>
with a generic PageSize
parameter.
§impl Page<Page1G>
impl Page<Page1G>
pub const fn containing_address_1gb(addr: VirtualAddress) -> Page<Page1G>
pub const fn containing_address_1gb(addr: VirtualAddress) -> Page<Page1G>
Returns the 1GiB huge Page
containing the given VirtualAddress
.
pub const fn from_1g_into_generic<P>(self) -> Page<P>where
P: PageSize,
pub const fn from_1g_into_generic<P>(self) -> Page<P>where P: PageSize,
Converts a known 1G-sized Page
into a
Page<P>
with a generic PageSize
parameter.
§impl<P> Page<P>where
P: PageSize,
impl<P> Page<P>where P: PageSize,
pub const fn start_address(&self) -> VirtualAddress
pub const fn start_address(&self) -> VirtualAddress
Returns the VirtualAddress
at the start of this Page
.
pub const fn page_size(&self) -> MemChunkSize
pub const fn page_size(&self) -> MemChunkSize
Returns the size of this Page
.
§impl<P> Page<P>where
P: PageSize,
impl<P> Page<P>where P: PageSize,
pub const fn p4_index(&self) -> usize
pub const fn p4_index(&self) -> usize
Returns the 9-bit part of this Page
’s VirtualAddress
that is the index into the P4 page table entries list.
pub const fn p3_index(&self) -> usize
pub const fn p3_index(&self) -> usize
Returns the 9-bit part of this Page
’s VirtualAddress
that is the index into the P3 page table entries list.
pub const fn p2_index(&self) -> usize
pub const fn p2_index(&self) -> usize
Returns the 9-bit part of this Page
’s VirtualAddress
that is the index into the P2 page table entries list.
pub const fn p1_index(&self) -> usize
pub const fn p1_index(&self) -> usize
Returns the 9-bit part of this Page
’s VirtualAddress
that is the index into the P1 page table entries list.
Using this returned usize
value as an index into the P1 entries list will give you the final PTE,
from which you can extract the mapped Frame
using PageTableEntry::pointed_frame()
.
Trait Implementations§
§impl<P> AddAssign<usize> for Page<P>where
P: PageSize,
impl<P> AddAssign<usize> for Page<P>where P: PageSize,
§fn add_assign(&mut self, rhs: usize)
fn add_assign(&mut self, rhs: usize)
+=
operation. Read more§impl<P> Ord for Page<P>where
P: Ord + PageSize,
impl<P> Ord for Page<P>where P: Ord + PageSize,
§impl<P> PartialOrd<Page<P>> for Page<P>where
P: PartialOrd<P> + PageSize,
impl<P> PartialOrd<Page<P>> for Page<P>where P: PartialOrd<P> + PageSize,
§fn partial_cmp(&self, other: &Page<P>) -> Option<Ordering>
fn partial_cmp(&self, other: &Page<P>) -> Option<Ordering>
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 more§impl<P> Step for Page<P>where
P: PageSize,
impl<P> Step for Page<P>where P: PageSize,
§fn steps_between(start: &Page<P>, end: &Page<P>) -> Option<usize>
fn steps_between(start: &Page<P>, end: &Page<P>) -> Option<usize>
step_trait
)§fn forward_checked(start: Page<P>, count: usize) -> Option<Page<P>>
fn forward_checked(start: Page<P>, count: usize) -> Option<Page<P>>
step_trait
)§fn backward_checked(start: Page<P>, count: usize) -> Option<Page<P>>
fn backward_checked(start: Page<P>, count: usize) -> Option<Page<P>>
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
)§impl<P> SubAssign<usize> for Page<P>where
P: PageSize,
impl<P> SubAssign<usize> for Page<P>where P: PageSize,
§fn sub_assign(&mut self, rhs: usize)
fn sub_assign(&mut self, rhs: usize)
-=
operation. Read more