Struct memory_structs::PhysicalAddress
source · pub struct PhysicalAddress(/* private fields */);Expand description
A physical memory address, which is a usize under the hood.
Implementations§
source§impl PhysicalAddress
impl PhysicalAddress
sourcepub fn new(addr: usize) -> Option<PhysicalAddress>
pub fn new(addr: usize) -> Option<PhysicalAddress>
Creates a new PhysicalAddress, returning an error if the address is not canonical.
This is useful for checking whether an address is valid before using it.
For example, on x86_64, virtual addresses are canonical
if their upper bits (64:48] are sign-extended from bit 47,
and physical addresses are canonical if their upper bits (64:52] are 0.
sourcepub const fn new_canonical(addr: usize) -> PhysicalAddress
pub const fn new_canonical(addr: usize) -> PhysicalAddress
Creates a new PhysicalAddress that is guaranteed to be canonical.
sourcepub const fn zero() -> PhysicalAddress
pub const fn zero() -> PhysicalAddress
Creates a new PhysicalAddress with a value 0.
sourcepub const fn value(&self) -> usize
pub const fn value(&self) -> usize
Returns the underlying usize value for this PhysicalAddress.
sourcepub const fn frame_offset(&self) -> usize
pub const fn frame_offset(&self) -> usize
Returns the offset from the 4K frame boundary specified by this `PhysicalAddress.
For example, for the address 0xFFFF_1578, this will return 0x578,
the least significant 12 bits (12:0] of this PhysicalAddress.
Trait Implementations§
source§impl Add<usize> for PhysicalAddress
impl Add<usize> for PhysicalAddress
§type Output = PhysicalAddress
type Output = PhysicalAddress
+ operator.source§impl Add<PhysicalAddress> for PhysicalAddress
impl Add<PhysicalAddress> for PhysicalAddress
§type Output = PhysicalAddress
type Output = PhysicalAddress
+ operator.source§fn add(self, rhs: PhysicalAddress) -> PhysicalAddress
fn add(self, rhs: PhysicalAddress) -> PhysicalAddress
+ operation. Read moresource§impl AddAssign<usize> for PhysicalAddress
impl AddAssign<usize> for PhysicalAddress
source§fn add_assign(&mut self, rhs: usize)
fn add_assign(&mut self, rhs: usize)
+= operation. Read moresource§impl AddAssign<PhysicalAddress> for PhysicalAddress
impl AddAssign<PhysicalAddress> for PhysicalAddress
source§fn add_assign(&mut self, rhs: PhysicalAddress)
fn add_assign(&mut self, rhs: PhysicalAddress)
+= operation. Read moresource§impl Binary for PhysicalAddress
impl Binary for PhysicalAddress
source§impl BitAnd<PhysicalAddress> for PhysicalAddress
impl BitAnd<PhysicalAddress> for PhysicalAddress
§type Output = PhysicalAddress
type Output = PhysicalAddress
& operator.source§fn bitand(self, rhs: PhysicalAddress) -> PhysicalAddress
fn bitand(self, rhs: PhysicalAddress) -> PhysicalAddress
& operation. Read moresource§impl BitAndAssign<PhysicalAddress> for PhysicalAddress
impl BitAndAssign<PhysicalAddress> for PhysicalAddress
source§fn bitand_assign(&mut self, rhs: PhysicalAddress)
fn bitand_assign(&mut self, rhs: PhysicalAddress)
&= operation. Read moresource§impl BitOr<PhysicalAddress> for PhysicalAddress
impl BitOr<PhysicalAddress> for PhysicalAddress
§type Output = PhysicalAddress
type Output = PhysicalAddress
| operator.source§fn bitor(self, rhs: PhysicalAddress) -> PhysicalAddress
fn bitor(self, rhs: PhysicalAddress) -> PhysicalAddress
| operation. Read moresource§impl BitOrAssign<PhysicalAddress> for PhysicalAddress
impl BitOrAssign<PhysicalAddress> for PhysicalAddress
source§fn bitor_assign(&mut self, rhs: PhysicalAddress)
fn bitor_assign(&mut self, rhs: PhysicalAddress)
|= operation. Read moresource§impl BitXor<PhysicalAddress> for PhysicalAddress
impl BitXor<PhysicalAddress> for PhysicalAddress
§type Output = PhysicalAddress
type Output = PhysicalAddress
^ operator.source§fn bitxor(self, rhs: PhysicalAddress) -> PhysicalAddress
fn bitxor(self, rhs: PhysicalAddress) -> PhysicalAddress
^ operation. Read moresource§impl BitXorAssign<PhysicalAddress> for PhysicalAddress
impl BitXorAssign<PhysicalAddress> for PhysicalAddress
source§fn bitxor_assign(&mut self, rhs: PhysicalAddress)
fn bitxor_assign(&mut self, rhs: PhysicalAddress)
^= operation. Read moresource§impl Clone for PhysicalAddress
impl Clone for PhysicalAddress
source§fn clone(&self) -> PhysicalAddress
fn clone(&self) -> PhysicalAddress
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
source§impl Display for PhysicalAddress
impl Display for PhysicalAddress
source§impl Hash for PhysicalAddress
impl Hash for PhysicalAddress
source§impl Into<usize> for PhysicalAddress
impl Into<usize> for PhysicalAddress
source§impl LowerHex for PhysicalAddress
impl LowerHex for PhysicalAddress
source§impl Octal for PhysicalAddress
impl Octal 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,
source§impl PartialEq<PhysicalAddress> for PhysicalAddress
impl PartialEq<PhysicalAddress> for PhysicalAddress
source§fn eq(&self, other: &PhysicalAddress) -> bool
fn eq(&self, other: &PhysicalAddress) -> bool
self and other values to be equal, and is used
by ==.source§impl PartialOrd<PhysicalAddress> for PhysicalAddress
impl PartialOrd<PhysicalAddress> for PhysicalAddress
source§fn partial_cmp(&self, other: &PhysicalAddress) -> Option<Ordering>
fn partial_cmp(&self, other: &PhysicalAddress) -> 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 moresource§impl Pointer for PhysicalAddress
impl Pointer for PhysicalAddress
source§impl Sub<usize> for PhysicalAddress
impl Sub<usize> for PhysicalAddress
§type Output = PhysicalAddress
type Output = PhysicalAddress
- operator.source§impl Sub<PhysicalAddress> for PhysicalAddress
impl Sub<PhysicalAddress> for PhysicalAddress
§type Output = PhysicalAddress
type Output = PhysicalAddress
- operator.source§fn sub(self, rhs: PhysicalAddress) -> PhysicalAddress
fn sub(self, rhs: PhysicalAddress) -> PhysicalAddress
- operation. Read moresource§impl SubAssign<usize> for PhysicalAddress
impl SubAssign<usize> for PhysicalAddress
source§fn sub_assign(&mut self, rhs: usize)
fn sub_assign(&mut self, rhs: usize)
-= operation. Read moresource§impl SubAssign<PhysicalAddress> for PhysicalAddress
impl SubAssign<PhysicalAddress> for PhysicalAddress
source§fn sub_assign(&mut self, rhs: PhysicalAddress)
fn sub_assign(&mut self, rhs: PhysicalAddress)
-= operation. Read more