#[repr(transparent)]pub struct PhysicalAddress(MemoryAddress);Expand description
Physical memory address.
A thin wrapper around MemoryAddress that denotes physical addresses
(host RAM / MMIO). Like VirtualAddress, this type carries intent and
prevents accidental VA↔PA mix-ups.
§Semantics
- Use
PhysicalAddress::page/PhysicalAddress::offset/PhysicalAddress::splitto derive the page base and in-page offset for a concretePageSize. - Combine a
PhysicalPage<S>with aMemoryAddressOffset<S>usingPhysicalPage::jointo reconstruct the originalPhysicalAddress.
§Notes
- Page-table entries often store a page-aligned physical base (low
S::SHIFTbits cleared) plus per-entry flag bits; usesplit::<S>()to reason about base vs. offset explicitly.
§Examples
let pa = PhysicalAddress::new(0x0000_0010_2000_0042);
let (pp, off) = pa.split::<Size4K>();
assert_eq!(pp.base().as_u64() & (Size4K::SIZE - 1), 0);
assert_eq!(pp.join(off).as_u64(), pa.as_u64());Tuple Fields§
§0: MemoryAddressImplementations§
Source§impl PhysicalAddress
impl PhysicalAddress
pub fn from_nonnull<T>(ptr: NonNull<T>) -> Self
pub fn from_ptr<T>(ptr: *const T) -> Self
pub const fn new(v: u64) -> Self
pub const fn as_u64(self) -> u64
pub const fn page<S: PageSize>(self) -> PhysicalPage<S>
pub const fn offset<S: PageSize>(self) -> MemoryAddressOffset<S>
pub const fn split<S: PageSize>( self, ) -> (PhysicalPage<S>, MemoryAddressOffset<S>)
Trait Implementations§
Source§impl Clone for PhysicalAddress
impl Clone for PhysicalAddress
Source§fn clone(&self) -> PhysicalAddress
fn clone(&self) -> PhysicalAddress
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 Debug for PhysicalAddress
impl Debug for PhysicalAddress
Source§impl Default for PhysicalAddress
impl Default for PhysicalAddress
Source§fn default() -> PhysicalAddress
fn default() -> PhysicalAddress
Returns the “default value” for a type. Read more
Source§impl Display for PhysicalAddress
impl Display for PhysicalAddress
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 From<u64> for PhysicalAddress
impl From<u64> for PhysicalAddress
Source§impl Hash for PhysicalAddress
impl Hash for PhysicalAddress
Source§impl Ord for PhysicalAddress
impl Ord for PhysicalAddress
Source§fn cmp(&self, other: &PhysicalAddress) -> Ordering
fn cmp(&self, other: &PhysicalAddress) -> 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 PartialEq for PhysicalAddress
impl PartialEq for PhysicalAddress
Source§impl PartialOrd for PhysicalAddress
impl PartialOrd for PhysicalAddress
impl Copy for PhysicalAddress
impl Eq for PhysicalAddress
impl StructuralPartialEq for PhysicalAddress
Auto Trait Implementations§
impl Freeze for PhysicalAddress
impl RefUnwindSafe for PhysicalAddress
impl Send for PhysicalAddress
impl Sync for PhysicalAddress
impl Unpin for PhysicalAddress
impl UnwindSafe for PhysicalAddress
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