Struct memory::PhysicalAddress
pub struct PhysicalAddress(/* private fields */);
Expand description
A physical memory address, which is a usize
under the hood.
Implementations§
§impl PhysicalAddress
impl PhysicalAddress
pub 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.
pub 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.
pub const fn zero() -> PhysicalAddress
pub const fn zero() -> PhysicalAddress
Creates a new PhysicalAddress
with a value 0.
pub 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§
§impl Add<usize> for PhysicalAddress
impl Add<usize> for PhysicalAddress
§type Output = PhysicalAddress
type Output = PhysicalAddress
The resulting type after applying the
+
operator.§fn add(self, rhs: usize) -> PhysicalAddress
fn add(self, rhs: usize) -> PhysicalAddress
Performs the
+
operation. Read more§impl Add<PhysicalAddress> for PhysicalAddress
impl Add<PhysicalAddress> for PhysicalAddress
§type Output = PhysicalAddress
type Output = PhysicalAddress
The resulting type after applying the
+
operator.§fn add(self, rhs: PhysicalAddress) -> PhysicalAddress
fn add(self, rhs: PhysicalAddress) -> PhysicalAddress
Performs the
+
operation. Read more§impl AddAssign<usize> for PhysicalAddress
impl AddAssign<usize> for PhysicalAddress
§fn add_assign(&mut self, rhs: usize)
fn add_assign(&mut self, rhs: usize)
Performs the
+=
operation. Read more§impl AddAssign<PhysicalAddress> for PhysicalAddress
impl AddAssign<PhysicalAddress> for PhysicalAddress
§fn add_assign(&mut self, rhs: PhysicalAddress)
fn add_assign(&mut self, rhs: PhysicalAddress)
Performs the
+=
operation. Read more§impl Binary for PhysicalAddress
impl Binary for PhysicalAddress
§impl BitAnd<PhysicalAddress> for PhysicalAddress
impl BitAnd<PhysicalAddress> for PhysicalAddress
§type Output = PhysicalAddress
type Output = PhysicalAddress
The resulting type after applying the
&
operator.§fn bitand(self, rhs: PhysicalAddress) -> PhysicalAddress
fn bitand(self, rhs: PhysicalAddress) -> PhysicalAddress
Performs the
&
operation. Read more§impl BitAndAssign<PhysicalAddress> for PhysicalAddress
impl BitAndAssign<PhysicalAddress> for PhysicalAddress
§fn bitand_assign(&mut self, rhs: PhysicalAddress)
fn bitand_assign(&mut self, rhs: PhysicalAddress)
Performs the
&=
operation. Read more§impl BitOr<PhysicalAddress> for PhysicalAddress
impl BitOr<PhysicalAddress> for PhysicalAddress
§type Output = PhysicalAddress
type Output = PhysicalAddress
The resulting type after applying the
|
operator.§fn bitor(self, rhs: PhysicalAddress) -> PhysicalAddress
fn bitor(self, rhs: PhysicalAddress) -> PhysicalAddress
Performs the
|
operation. Read more§impl BitOrAssign<PhysicalAddress> for PhysicalAddress
impl BitOrAssign<PhysicalAddress> for PhysicalAddress
§fn bitor_assign(&mut self, rhs: PhysicalAddress)
fn bitor_assign(&mut self, rhs: PhysicalAddress)
Performs the
|=
operation. Read more§impl BitXor<PhysicalAddress> for PhysicalAddress
impl BitXor<PhysicalAddress> for PhysicalAddress
§type Output = PhysicalAddress
type Output = PhysicalAddress
The resulting type after applying the
^
operator.§fn bitxor(self, rhs: PhysicalAddress) -> PhysicalAddress
fn bitxor(self, rhs: PhysicalAddress) -> PhysicalAddress
Performs the
^
operation. Read more§impl BitXorAssign<PhysicalAddress> for PhysicalAddress
impl BitXorAssign<PhysicalAddress> for PhysicalAddress
§fn bitxor_assign(&mut self, rhs: PhysicalAddress)
fn bitxor_assign(&mut self, rhs: PhysicalAddress)
Performs the
^=
operation. Read more§impl Clone for PhysicalAddress
impl Clone for PhysicalAddress
§fn clone(&self) -> PhysicalAddress
fn clone(&self) -> PhysicalAddress
Returns a copy 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 more§impl Debug for PhysicalAddress
impl Debug for PhysicalAddress
§impl Default for PhysicalAddress
impl Default for PhysicalAddress
§fn default() -> PhysicalAddress
fn default() -> PhysicalAddress
Returns the “default value” for a type. Read more
§impl Display for PhysicalAddress
impl Display for PhysicalAddress
§impl Hash for PhysicalAddress
impl Hash for PhysicalAddress
§impl Into<usize> for PhysicalAddress
impl Into<usize> for PhysicalAddress
§impl LowerHex for PhysicalAddress
impl LowerHex for PhysicalAddress
§impl Octal for PhysicalAddress
impl Octal for PhysicalAddress
§impl Ord for PhysicalAddress
impl Ord for PhysicalAddress
§impl PartialEq<PhysicalAddress> for PhysicalAddress
impl PartialEq<PhysicalAddress> for PhysicalAddress
§fn eq(&self, other: &PhysicalAddress) -> bool
fn eq(&self, other: &PhysicalAddress) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.§impl PartialOrd<PhysicalAddress> for PhysicalAddress
impl PartialOrd<PhysicalAddress> for PhysicalAddress
§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
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more§impl Pointer for PhysicalAddress
impl Pointer for PhysicalAddress
§impl Sub<usize> for PhysicalAddress
impl Sub<usize> for PhysicalAddress
§type Output = PhysicalAddress
type Output = PhysicalAddress
The resulting type after applying the
-
operator.§fn sub(self, rhs: usize) -> PhysicalAddress
fn sub(self, rhs: usize) -> PhysicalAddress
Performs the
-
operation. Read more§impl Sub<PhysicalAddress> for PhysicalAddress
impl Sub<PhysicalAddress> for PhysicalAddress
§type Output = PhysicalAddress
type Output = PhysicalAddress
The resulting type after applying the
-
operator.§fn sub(self, rhs: PhysicalAddress) -> PhysicalAddress
fn sub(self, rhs: PhysicalAddress) -> PhysicalAddress
Performs the
-
operation. Read more§impl SubAssign<usize> for PhysicalAddress
impl SubAssign<usize> for PhysicalAddress
§fn sub_assign(&mut self, rhs: usize)
fn sub_assign(&mut self, rhs: usize)
Performs the
-=
operation. Read more§impl SubAssign<PhysicalAddress> for PhysicalAddress
impl SubAssign<PhysicalAddress> for PhysicalAddress
§fn sub_assign(&mut self, rhs: PhysicalAddress)
fn sub_assign(&mut self, rhs: PhysicalAddress)
Performs the
-=
operation. Read more§impl UpperHex for PhysicalAddress
impl UpperHex for PhysicalAddress
impl Copy for PhysicalAddress
impl Eq for PhysicalAddress
impl FromBytes for PhysicalAddress
impl StructuralEq for PhysicalAddress
impl StructuralPartialEq for PhysicalAddress
Auto Trait Implementations§
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