Struct PhysicalAddress

1.0.0 · Source
#[repr(transparent)]
pub struct PhysicalAddress<const ALIGN: usize = 1> { pub addr: usize, }
Expand description

A physical memory address of alignment ALIGN

Fields§

§addr: usize
🔬This is a nightly-only experimental API. (kernel_memory_addr_access)

Implementations§

Source§

impl<const ALIGN: usize> PhysicalAddress<ALIGN>

1.0.0 (const: 1.0.0) · Source

pub const fn new(addr: usize) -> Self

Creates a new PhysicalAddress, panicking if the alignment is incorrect

Source

pub const fn to_virtual(self) -> VirtualAddress<ALIGN>

🔬This is a nightly-only experimental API. (kernel_physical_page_offset #1)

Converts a PhysicalAddress into a VirtualAddress via the physical page map region

1.0.0 (const: 1.0.0) · Source

pub const unsafe fn align_unchecked<const NEW_ALIGN: usize>( self, ) -> PhysicalAddress<NEW_ALIGN>

Forces a PhysicalAddress to have a specific alignment

§Safety

The address must be already aligned to the new alignment

1.0.0 (const: 1.0.0) · Source

pub const fn align_down<const NEW_ALIGN: usize>( self, ) -> PhysicalAddress<NEW_ALIGN>

Returns the PhysicalAddress less than or equal to self with the given alignment

1.0.0 (const: 1.0.0) · Source

pub const fn align_up<const NEW_ALIGN: usize>( self, ) -> PhysicalAddress<NEW_ALIGN>

Returns the PhysicalAddress greater than or equal to self with the given alignment

Source

pub const fn align_down_runtime( self, new_alignment: usize, ) -> PhysicalAddress<1>

🔬This is a nightly-only experimental API. (kernel_address_alignment_runtime)

Returns the PhysicalAddress less than or equal to self with the given runtime alignment

Source

pub const fn align_up_runtime(self, new_alignment: usize) -> PhysicalAddress<1>

🔬This is a nightly-only experimental API. (kernel_address_alignment_runtime)

Returns the PhysicalAddress greater than or equal to self with the given runtime alignment

Trait Implementations§

1.0.0 · Source§

impl<const ALIGN: usize> Add<isize> for PhysicalAddress<ALIGN>

Source§

type Output = PhysicalAddress

The resulting type after applying the + operator.
Source§

fn add(self, rhs: isize) -> Self::Output

Performs the + operation. Read more
1.0.0 · Source§

impl<const ALIGN: usize> Add<usize> for PhysicalAddress<ALIGN>

Source§

type Output = PhysicalAddress

The resulting type after applying the + operator.
Source§

fn add(self, rhs: usize) -> Self::Output

Performs the + operation. Read more
1.0.0 · Source§

impl<const ALIGN: usize> Clone for PhysicalAddress<ALIGN>

Source§

fn clone(&self) -> PhysicalAddress<ALIGN>

Returns a copy of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
1.0.0 · Source§

impl<const ALIGN: usize> Debug for PhysicalAddress<ALIGN>

Source§

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

Formats the value using the given formatter. Read more
1.0.0 · Source§

impl<const ALIGN: usize> Ord for PhysicalAddress<ALIGN>

Source§

fn cmp(&self, other: &PhysicalAddress<ALIGN>) -> Ordering

This method returns an [Ordering] between self and other. Read more
1.21.0§

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

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

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

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

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
1.0.0 · Source§

impl<const A: usize, const B: usize> PartialEq<PhysicalAddress<A>> for PhysicalAddress<B>

Source§

fn eq(&self, other: &PhysicalAddress<A>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
1.0.0 · Source§

impl<const A: usize, const B: usize> PartialOrd<PhysicalAddress<A>> for PhysicalAddress<B>

Source§

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

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

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
1.0.0 · Source§

impl<const A: usize, const B: usize> Sub<PhysicalAddress<A>> for PhysicalAddress<B>

Source§

type Output = usize

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: PhysicalAddress<A>) -> Self::Output

Performs the - operation. Read more
1.0.0 · Source§

impl<const ALIGN: usize> Sub<isize> for PhysicalAddress<ALIGN>

Source§

type Output = PhysicalAddress

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: isize) -> Self::Output

Performs the - operation. Read more
1.0.0 · Source§

impl<const ALIGN: usize> Sub<usize> for PhysicalAddress<ALIGN>

Source§

type Output = PhysicalAddress

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: usize) -> Self::Output

Performs the - operation. Read more
1.0.0 · Source§

impl<const ALIGN: usize> Copy for PhysicalAddress<ALIGN>

1.0.0 · Source§

impl<const ALIGN: usize> Eq for PhysicalAddress<ALIGN>

Auto Trait Implementations§

§

impl<const ALIGN: usize> Freeze for PhysicalAddress<ALIGN>

§

impl<const ALIGN: usize> RefUnwindSafe for PhysicalAddress<ALIGN>

§

impl<const ALIGN: usize> Send for PhysicalAddress<ALIGN>

§

impl<const ALIGN: usize> Sync for PhysicalAddress<ALIGN>

§

impl<const ALIGN: usize> Unpin for PhysicalAddress<ALIGN>

§

impl<const ALIGN: usize> UnwindSafe for PhysicalAddress<ALIGN>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit #126799)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

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

§

type Error = Infallible

The type returned in the event of a conversion error.
§

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

Performs the conversion.
§

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

§

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

The type returned in the event of a conversion error.
§

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

Performs the conversion.