Struct x86_64::addr::PhysAddr [−][src]
#[repr(transparent)]pub struct PhysAddr(_);
Expand description
A 64-bit physical memory address.
This is a wrapper type around an u64
, so it is always 8 bytes, even when compiled
on non 64-bit systems. The
TryFrom
trait can be used for performing conversions
between u64
and usize
.
On x86_64
, only the 52 lower bits of a physical address can be used. The top 12 bits need
to be zero. This type guarantees that it always represents a valid physical address.
Implementations
impl PhysAddr
[src]
impl PhysAddr
[src]pub const fn new_truncate(addr: u64) -> PhysAddr
[src]
pub const fn new_truncate(addr: u64) -> PhysAddr
[src]Creates a new physical address, throwing bits 52..64 away.
pub const unsafe fn new_unsafe(addr: u64) -> PhysAddr
[src]
pub const unsafe fn new_unsafe(addr: u64) -> PhysAddr
[src]Creates a new physical address, without any checks.
Safety
You must make sure bits 52..64 are zero. This is not checked.
pub fn try_new(addr: u64) -> Result<PhysAddr, PhysAddrNotValid>
[src]
pub fn try_new(addr: u64) -> Result<PhysAddr, PhysAddrNotValid>
[src]Tries to create a new physical address.
Fails if any bits in the range 52 to 64 are set.
pub const fn is_null(self) -> bool
[src]
pub const fn is_null(self) -> bool
[src]Convenience method for checking if a physical address is null.
pub fn align_up<U>(self, align: U) -> Self where
U: Into<u64>,
[src]
pub fn align_up<U>(self, align: U) -> Self where
U: Into<u64>,
[src]Aligns the physical address upwards to the given alignment.
See the align_up
function for more information.
pub fn align_down<U>(self, align: U) -> Self where
U: Into<u64>,
[src]
pub fn align_down<U>(self, align: U) -> Self where
U: Into<u64>,
[src]Aligns the physical address downwards to the given alignment.
See the align_down
function for more information.
pub fn is_aligned<U>(self, align: U) -> bool where
U: Into<u64>,
[src]
pub fn is_aligned<U>(self, align: U) -> bool where
U: Into<u64>,
[src]Checks whether the physical address has the demanded alignment.
Trait Implementations
impl AddAssign<u64> for PhysAddr
[src]
impl AddAssign<u64> for PhysAddr
[src]fn add_assign(&mut self, rhs: u64)
[src]
fn add_assign(&mut self, rhs: u64)
[src]Performs the +=
operation. Read more
impl AddAssign<usize> for PhysAddr
[src]
impl AddAssign<usize> for PhysAddr
[src]fn add_assign(&mut self, rhs: usize)
[src]
fn add_assign(&mut self, rhs: usize)
[src]Performs the +=
operation. Read more
impl Ord for PhysAddr
[src]
impl Ord for PhysAddr
[src]impl PartialOrd<PhysAddr> for PhysAddr
[src]
impl PartialOrd<PhysAddr> for PhysAddr
[src]fn partial_cmp(&self, other: &PhysAddr) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &PhysAddr) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl SubAssign<u64> for PhysAddr
[src]
impl SubAssign<u64> for PhysAddr
[src]fn sub_assign(&mut self, rhs: u64)
[src]
fn sub_assign(&mut self, rhs: u64)
[src]Performs the -=
operation. Read more
impl SubAssign<usize> for PhysAddr
[src]
impl SubAssign<usize> for PhysAddr
[src]fn sub_assign(&mut self, rhs: usize)
[src]
fn sub_assign(&mut self, rhs: usize)
[src]Performs the -=
operation. Read more