#[repr(transparent)]pub struct PhysicalPage<S: PageSize>(MemoryPage<S>);Expand description
Physical memory page base for size S.
A PhysicalPage<S> represents the page-aligned base of a physical page
of size S (S::SIZE bytes). It is a thin wrapper over MemoryPage<S>
with physical-address intent.
§Semantics
base()returns the page base as aPhysicalAddress.join(off)combines this base with aMemoryAddressOffset<S>to form a fullPhysicalAddress.
§Invariants
- The low
S::SHIFTbits of the base are always zero (page aligned).
§Examples
let pa = PhysicalAddress::new(0x0000_0008_1234_5678);
let pp = pa.page::<Size2M>();
assert_eq!(pp.base().as_u64() & (Size2M::SIZE - 1), 0);
let pa2 = pp.join(pa.offset::<Size2M>());
assert_eq!(pa2.as_u64(), pa.as_u64());Tuple Fields§
§0: MemoryPage<S>Implementations§
Source§impl<S: PageSize> PhysicalPage<S>
impl<S: PageSize> PhysicalPage<S>
pub const fn from_addr(p: PhysicalAddress) -> Self
pub const fn from_page(p: MemoryPage<S>) -> Self
pub const fn base(self) -> PhysicalAddress
pub const fn join(self, off: MemoryAddressOffset<S>) -> PhysicalAddress
Trait Implementations§
Source§impl<S: Clone + PageSize> Clone for PhysicalPage<S>
impl<S: Clone + PageSize> Clone for PhysicalPage<S>
Source§fn clone(&self) -> PhysicalPage<S>
fn clone(&self) -> PhysicalPage<S>
Returns a duplicate 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 moreSource§impl<S: PageSize> Debug for PhysicalPage<S>
impl<S: PageSize> Debug for PhysicalPage<S>
Source§impl<S> From<MemoryPage<S>> for PhysicalPage<S>where
S: PageSize,
impl<S> From<MemoryPage<S>> for PhysicalPage<S>where
S: PageSize,
Source§fn from(p: MemoryPage<S>) -> Self
fn from(p: MemoryPage<S>) -> Self
Converts to this type from the input type.
Source§impl<S> From<PhysicalPage<S>> for PhysicalAddresswhere
S: PageSize,
impl<S> From<PhysicalPage<S>> for PhysicalAddresswhere
S: PageSize,
Source§fn from(value: PhysicalPage<S>) -> Self
fn from(value: PhysicalPage<S>) -> Self
Converts to this type from the input type.
Source§impl<S: Ord + PageSize> Ord for PhysicalPage<S>
impl<S: Ord + PageSize> Ord for PhysicalPage<S>
Source§fn cmp(&self, other: &PhysicalPage<S>) -> Ordering
fn cmp(&self, other: &PhysicalPage<S>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<S: PartialOrd + PageSize> PartialOrd for PhysicalPage<S>
impl<S: PartialOrd + PageSize> PartialOrd for PhysicalPage<S>
impl<S: Copy + PageSize> Copy for PhysicalPage<S>
impl<S: Eq + PageSize> Eq for PhysicalPage<S>
impl<S: PageSize> StructuralPartialEq for PhysicalPage<S>
Auto Trait Implementations§
impl<S> Freeze for PhysicalPage<S>
impl<S> RefUnwindSafe for PhysicalPage<S>where
S: RefUnwindSafe,
impl<S> Send for PhysicalPage<S>where
S: Send,
impl<S> Sync for PhysicalPage<S>where
S: Sync,
impl<S> Unpin for PhysicalPage<S>where
S: Unpin,
impl<S> UnwindSafe for PhysicalPage<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
Mutably borrows from an owned value. Read more