pub struct Physical<P> { /* private fields */ }
Expand description
Physical slice wrapper with type annotation.
This struct wraps slices in RISC-V physical memory by low and high part of the physical base address as well as its length. It is usually used by SBI extensions as parameter types to pass base address and length parameters on physical memory other than a virtual one.
Generic parameter P
represents a hint of how this physical slice would be used.
For example, Physical<&[u8]>
represents an immutable reference to physical byte slice,
while Physical<&mut [u8]>
represents a mutable one.
An SBI implementation should load or store memory using both phys_addr_lo
and
phys_addr_hi
combined as base address. A supervisor program (kernels etc.)
should provide continuous physical memory, wrapping its reference using this structure
before passing into SBI runtime.
Implementations§
Source§impl<P> Physical<P>
impl<P> Physical<P>
Sourcepub const fn new(
num_bytes: usize,
phys_addr_lo: usize,
phys_addr_hi: usize,
) -> Self
pub const fn new( num_bytes: usize, phys_addr_lo: usize, phys_addr_hi: usize, ) -> Self
Create a physical memory slice by length and physical address.
Sourcepub const fn phys_addr_lo(&self) -> usize
pub const fn phys_addr_lo(&self) -> usize
Returns low-part base address of physical memory slice.
Sourcepub const fn phys_addr_hi(&self) -> usize
pub const fn phys_addr_hi(&self) -> usize
Returns high-part base address of physical memory slice.
Trait Implementations§
Auto Trait Implementations§
impl<P> Freeze for Physical<P>
impl<P> RefUnwindSafe for Physical<P>where
P: RefUnwindSafe,
impl<P> Send for Physical<P>where
P: Send,
impl<P> Sync for Physical<P>where
P: Sync,
impl<P> Unpin for Physical<P>where
P: Unpin,
impl<P> UnwindSafe for Physical<P>where
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)