#[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>
impl<const ALIGN: usize> PhysicalAddress<ALIGN>
1.0.0 (const: 1.0.0) · Sourcepub const fn new(addr: usize) -> Self
pub const fn new(addr: usize) -> Self
Creates a new PhysicalAddress
, panicking if the alignment is incorrect
Sourcepub const fn to_virtual(self) -> VirtualAddress<ALIGN>
🔬This is a nightly-only experimental API. (kernel_physical_page_offset
#1)
pub const fn to_virtual(self) -> VirtualAddress<ALIGN>
kernel_physical_page_offset
#1)Converts a PhysicalAddress
into a VirtualAddress
via the physical page map region
1.0.0 (const: 1.0.0) · Sourcepub const unsafe fn align_unchecked<const NEW_ALIGN: usize>(
self,
) -> PhysicalAddress<NEW_ALIGN>
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) · Sourcepub const fn align_down<const NEW_ALIGN: usize>(
self,
) -> PhysicalAddress<NEW_ALIGN>
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) · Sourcepub const fn align_up<const NEW_ALIGN: usize>(
self,
) -> PhysicalAddress<NEW_ALIGN>
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
Sourcepub const fn align_down_runtime(
self,
new_alignment: usize,
) -> PhysicalAddress<1>
🔬This is a nightly-only experimental API. (kernel_address_alignment_runtime
)
pub const fn align_down_runtime( self, new_alignment: usize, ) -> PhysicalAddress<1>
kernel_address_alignment_runtime
)Returns the PhysicalAddress
less than or equal to self
with the given runtime alignment
Sourcepub const fn align_up_runtime(self, new_alignment: usize) -> PhysicalAddress<1>
🔬This is a nightly-only experimental API. (kernel_address_alignment_runtime
)
pub const fn align_up_runtime(self, new_alignment: usize) -> PhysicalAddress<1>
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>
impl<const ALIGN: usize> Add<isize> for PhysicalAddress<ALIGN>
1.0.0 · Source§impl<const ALIGN: usize> Add<usize> for PhysicalAddress<ALIGN>
impl<const ALIGN: usize> Add<usize> for PhysicalAddress<ALIGN>
1.0.0 · Source§impl<const ALIGN: usize> Clone for PhysicalAddress<ALIGN>
impl<const ALIGN: usize> Clone for PhysicalAddress<ALIGN>
Source§fn clone(&self) -> PhysicalAddress<ALIGN>
fn clone(&self) -> PhysicalAddress<ALIGN>
Returns a copy of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more1.0.0 · Source§impl<const ALIGN: usize> Debug for PhysicalAddress<ALIGN>
impl<const ALIGN: usize> Debug for PhysicalAddress<ALIGN>
1.0.0 · Source§impl<const ALIGN: usize> Ord for PhysicalAddress<ALIGN>
impl<const ALIGN: usize> Ord for PhysicalAddress<ALIGN>
1.0.0 · Source§impl<const A: usize, const B: usize> PartialEq<PhysicalAddress<A>> for PhysicalAddress<B>
impl<const A: usize, const B: usize> PartialEq<PhysicalAddress<A>> for PhysicalAddress<B>
1.0.0 · Source§impl<const A: usize, const B: usize> PartialOrd<PhysicalAddress<A>> for PhysicalAddress<B>
impl<const A: usize, const B: usize> PartialOrd<PhysicalAddress<A>> for PhysicalAddress<B>
Source§fn partial_cmp(&self, other: &PhysicalAddress<A>) -> Option<Ordering>
fn partial_cmp(&self, other: &PhysicalAddress<A>) -> Option<Ordering>
1.0.0 · Source§impl<const A: usize, const B: usize> Sub<PhysicalAddress<A>> for PhysicalAddress<B>
impl<const A: usize, const B: usize> Sub<PhysicalAddress<A>> for PhysicalAddress<B>
1.0.0 · Source§impl<const ALIGN: usize> Sub<isize> for PhysicalAddress<ALIGN>
impl<const ALIGN: usize> Sub<isize> for PhysicalAddress<ALIGN>
1.0.0 · Source§impl<const ALIGN: usize> Sub<usize> for PhysicalAddress<ALIGN>
impl<const ALIGN: usize> Sub<usize> for PhysicalAddress<ALIGN>
impl<const ALIGN: usize> Copy for PhysicalAddress<ALIGN>
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 Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit
#126799)