[][src]Struct x86_64::addr::PhysAddr

#[repr(transparent)]pub struct PhysAddr(_);

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 UsizeConversions 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]

pub fn new(addr: u64) -> PhysAddr[src]

Creates a new physical address.

Panics if a bit in the range 52 to 64 is set.

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]

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]

Tries to create a new physical address.

Fails if any bits in the range 52 to 64 are set.

pub const fn zero() -> PhysAddr[src]

Creates a physical address that points to 0.

pub const fn as_u64(self) -> u64[src]

Converts the address to an u64.

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]

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]

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]

Checks whether the physical address has the demanded alignment.

Trait Implementations

impl Add<u64> for PhysAddr[src]

type Output = Self

The resulting type after applying the + operator.

impl Add<usize> for PhysAddr[src]

type Output = Self

The resulting type after applying the + operator.

impl AddAssign<u64> for PhysAddr[src]

impl AddAssign<usize> for PhysAddr[src]

impl Binary for PhysAddr[src]

impl Clone for PhysAddr[src]

impl Copy for PhysAddr[src]

impl Debug for PhysAddr[src]

impl Eq for PhysAddr[src]

impl LowerHex for PhysAddr[src]

impl Octal for PhysAddr[src]

impl Ord for PhysAddr[src]

impl PartialEq<PhysAddr> for PhysAddr[src]

impl PartialOrd<PhysAddr> for PhysAddr[src]

impl StructuralEq for PhysAddr[src]

impl StructuralPartialEq for PhysAddr[src]

impl Sub<PhysAddr> for PhysAddr[src]

type Output = u64

The resulting type after applying the - operator.

impl Sub<u64> for PhysAddr[src]

type Output = Self

The resulting type after applying the - operator.

impl Sub<usize> for PhysAddr[src]

type Output = Self

The resulting type after applying the - operator.

impl SubAssign<u64> for PhysAddr[src]

impl SubAssign<usize> for PhysAddr[src]

impl UpperHex for PhysAddr[src]

Auto Trait Implementations

impl Send for PhysAddr

impl Sync for PhysAddr

impl Unpin for PhysAddr

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.