Struct driverkit::PAddr

source ·
pub struct PAddr(pub u64);
Expand description

A wrapper for a physical address.

Tuple Fields§

§0: u64

Implementations§

source§

impl PAddr

source

pub fn as_u64(self) -> u64

Convert to u64

source

pub fn as_usize(self) -> usize

Convert to usize

source

pub const fn zero() -> PAddr

Physical Address zero.

source

pub fn is_zero(self) -> bool

Is zero?

source

pub fn split(&self) -> (u32, u32)

Split PAddr into lower and higher 32-bits.

source

pub fn base_page_offset(self) -> u64

Offset within the 4 KiB page.

source

pub fn large_page_offset(self) -> u64

Offset within the 2 MiB page.

source

pub fn huge_page_offset(self) -> u64

Offset within the 1 GiB page.

source

pub fn align_down_to_base_page(self) -> PAddr

Return address of nearest 4 KiB page (lower or equal than self).

source

pub fn align_down_to_large_page(self) -> PAddr

Return address of nearest 2 MiB page (lower or equal than self).

source

pub fn align_down_to_huge_page(self) -> PAddr

Return address of nearest 1 GiB page (lower or equal than self).

source

pub fn align_up_to_base_page(self) -> PAddr

Return address of nearest 4 KiB page (higher or equal than self).

source

pub fn align_up_to_large_page(self) -> PAddr

Return address of nearest 2 MiB page (higher or equal than self).

source

pub fn align_up_to_huge_page(self) -> PAddr

Return address of nearest 1 GiB page (higher or equal than self).

source

pub fn is_base_page_aligned(self) -> bool

Is this address aligned to a 4 KiB page?

source

pub fn is_large_page_aligned(self) -> bool

Is this address aligned to a 2 MiB page?

source

pub fn is_huge_page_aligned(self) -> bool

Is this address aligned to a 1 GiB page?

source

pub fn is_aligned<U>(self, align: U) -> boolwhere U: Into<u64> + Copy,

Is this address aligned to align?

Note

align must be a power of two.

Trait Implementations§

source§

impl Add<PAddr> for PAddr

§

type Output = PAddr

The resulting type after applying the + operator.
source§

fn add(self, rhs: PAddr) -> <PAddr as Add<PAddr>>::Output

Performs the + operation. Read more
source§

impl Add<u64> for PAddr

§

type Output = PAddr

The resulting type after applying the + operator.
source§

fn add(self, rhs: u64) -> <PAddr as Add<u64>>::Output

Performs the + operation. Read more
source§

impl Add<usize> for PAddr

§

type Output = PAddr

The resulting type after applying the + operator.
source§

fn add(self, rhs: usize) -> <PAddr as Add<usize>>::Output

Performs the + operation. Read more
source§

impl AddAssign<PAddr> for PAddr

source§

fn add_assign(&mut self, other: PAddr)

Performs the += operation. Read more
source§

impl AddAssign<u64> for PAddr

source§

fn add_assign(&mut self, offset: u64)

Performs the += operation. Read more
source§

impl Binary for PAddr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter.
source§

impl BitAnd<PAddr> for PAddr

§

type Output = PAddr

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: PAddr) -> PAddr

Performs the & operation. Read more
source§

impl BitAnd<u64> for PAddr

§

type Output = u64

The resulting type after applying the & operator.
source§

fn bitand(self, rhs: u64) -> <PAddr as BitAnd<u64>>::Output

Performs the & operation. Read more
source§

impl BitOr<PAddr> for PAddr

§

type Output = PAddr

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: PAddr) -> <PAddr as BitOr<PAddr>>::Output

Performs the | operation. Read more
source§

impl BitOr<u64> for PAddr

§

type Output = u64

The resulting type after applying the | operator.
source§

fn bitor(self, rhs: u64) -> <PAddr as BitOr<u64>>::Output

Performs the | operation. Read more
source§

impl Clone for PAddr

source§

fn clone(&self) -> PAddr

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for PAddr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl Display for PAddr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl From<i32> for PAddr

source§

fn from(num: i32) -> PAddr

Converts to this type from the input type.
source§

impl From<u64> for PAddr

source§

fn from(num: u64) -> PAddr

Converts to this type from the input type.
source§

impl From<usize> for PAddr

source§

fn from(num: usize) -> PAddr

Converts to this type from the input type.
source§

impl Hash for PAddr

source§

fn hash<H>(&self, state: &mut H)where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Into<u64> for PAddr

source§

fn into(self) -> u64

Converts this type into the (usually inferred) input type.
source§

impl Into<usize> for PAddr

source§

fn into(self) -> usize

Converts this type into the (usually inferred) input type.
source§

impl LowerHex for PAddr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter.
source§

impl Octal for PAddr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter.
source§

impl Ord for PAddr

source§

fn cmp(&self, other: &PAddr) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<PAddr> for PAddr

source§

fn eq(&self, other: &PAddr) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<PAddr> for PAddr

source§

fn partial_cmp(&self, other: &PAddr) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Pointer for PAddr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter.
source§

impl Rem<PAddr> for PAddr

§

type Output = PAddr

The resulting type after applying the % operator.
source§

fn rem(self, rhs: PAddr) -> <PAddr as Rem<PAddr>>::Output

Performs the % operation. Read more
source§

impl Rem<u64> for PAddr

§

type Output = u64

The resulting type after applying the % operator.
source§

fn rem(self, rhs: u64) -> <PAddr as Rem<u64>>::Output

Performs the % operation. Read more
source§

impl Rem<usize> for PAddr

§

type Output = u64

The resulting type after applying the % operator.
source§

fn rem(self, rhs: usize) -> <PAddr as Rem<usize>>::Output

Performs the % operation. Read more
source§

impl Shr<u64> for PAddr

§

type Output = u64

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: u64) -> <PAddr as Shr<u64>>::Output

Performs the >> operation. Read more
source§

impl Step for PAddr

source§

fn steps_between(start: &PAddr, end: &PAddr) -> Option<usize>

🔬This is a nightly-only experimental API. (step_trait)
Returns the number of successor steps required to get from start to end. Read more
source§

fn forward_checked(start: PAddr, count: usize) -> Option<PAddr>

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the successor of self count times. Read more
source§

fn backward_checked(start: PAddr, count: usize) -> Option<PAddr>

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the predecessor of self count times. Read more
source§

fn forward(start: Self, count: usize) -> Self

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the successor of self count times. Read more
source§

unsafe fn forward_unchecked(start: Self, count: usize) -> Self

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the successor of self count times. Read more
source§

fn backward(start: Self, count: usize) -> Self

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the predecessor of self count times. Read more
source§

unsafe fn backward_unchecked(start: Self, count: usize) -> Self

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the predecessor of self count times. Read more
source§

impl Sub<PAddr> for PAddr

§

type Output = PAddr

The resulting type after applying the - operator.
source§

fn sub(self, rhs: PAddr) -> <PAddr as Sub<PAddr>>::Output

Performs the - operation. Read more
source§

impl Sub<u64> for PAddr

§

type Output = PAddr

The resulting type after applying the - operator.
source§

fn sub(self, rhs: u64) -> <PAddr as Sub<u64>>::Output

Performs the - operation. Read more
source§

impl Sub<usize> for PAddr

§

type Output = PAddr

The resulting type after applying the - operator.
source§

fn sub(self, rhs: usize) -> <PAddr as Sub<usize>>::Output

Performs the - operation. Read more
source§

impl UpperHex for PAddr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter.
source§

impl Copy for PAddr

source§

impl Eq for PAddr

source§

impl StructuralEq for PAddr

source§

impl StructuralPartialEq for PAddr

Auto Trait Implementations§

§

impl RefUnwindSafe for PAddr

§

impl Send for PAddr

§

impl Sync for PAddr

§

impl Unpin for PAddr

§

impl UnwindSafe for PAddr

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.