Struct usercopy::Usercopy

source ·
pub struct Usercopy { /* private fields */ }

Implementations§

source§

impl Usercopy

source

pub fn new(restricted_address_range: Range<usize>) -> Result<Self, Status>

Returns a new instance of Usercopy if unified address spaces is supported on the target architecture.

source

pub unsafe fn raw_hermetic_copy( &self, dest: *mut u8, source: *const u8, count: usize, ret_dest: bool, ) -> usize

Copies bytes from the source address to the destination address.

§Safety

Only one of source/dest may be an address to a buffer owned by user/restricted-mode (ret_dest indicates whether the user-owned buffer is dest when true). The other must be a valid Starnix/normal-mode buffer that will never cause a fault when the first count bytes are read/written.

source

pub fn zero(&self, dest_addr: usize, count: usize) -> usize

Zeros count bytes to starting at dest_addr.

Returns the number of bytes zeroed.

source

pub fn copyout(&self, source: &[u8], dest_addr: usize) -> usize

Copies data from source to the restricted address dest_addr.

Returns the number of bytes copied.

source

pub fn copyin<'a>( &self, source_addr: usize, dest: &'a mut [MaybeUninit<u8>], ) -> (&'a mut [u8], &'a mut [MaybeUninit<u8>])

Copies data from the restricted address source_addr to dest.

Returns the read and unread bytes.

The returned slices will always reference dest. Because of this, it is guaranteed that that dest and the returned initialized slice will have the same address.

source

pub fn copyin_until_null_byte<'a>( &self, source_addr: usize, dest: &'a mut [MaybeUninit<u8>], ) -> (&'a mut [u8], &'a mut [MaybeUninit<u8>])

Copies data from the restricted address source_addr to dest until the first null byte.

Returns the read and unread bytes. The read bytes includes the null byte if present.

The returned slices will always reference dest. Because of this, it is guaranteed that that dest and the returned initialized slice will have the same address.

source

pub fn atomic_load_u32_relaxed(&self, addr: usize) -> Result<u32, ()>

Performs an atomic load of a 32 bit value at addr. addr must be aligned to 4 bytes.

source

pub fn atomic_load_u32_acquire(&self, addr: usize) -> Result<u32, ()>

Performs an atomic load of a 32 bit value at addr. addr must be aligned to 4 bytes.

source

pub fn atomic_store_u32_relaxed( &self, addr: usize, value: u32, ) -> Result<(), ()>

Performs an atomic store of a 32 bit value to addr. addr must be aligned to 4 bytes.

source

pub fn atomic_store_u32_release( &self, addr: usize, value: u32, ) -> Result<(), ()>

Performs an atomic store of a 32 bit value to addr. addr must be aligned to 4 bytes.

source

pub fn atomic_compare_exchange_u32_acq_rel( &self, addr: usize, expected: u32, desired: u32, ) -> Result<Result<u32, u32>, ()>

Performs an atomic compare and exchange of a 32 bit value at addr addr. addr must be aligned to 4 bytes.

source

pub fn atomic_compare_exchange_weak_u32_acq_rel( &self, addr: usize, expected: u32, desired: u32, ) -> Result<Result<u32, u32>, ()>

Performs a weak atomic compare and exchange of a 32 bit value at addr addr. addr must be aligned to 4 bytes.

Trait Implementations§

source§

impl Debug for Usercopy

source§

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

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

impl Drop for Usercopy

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

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

Performs the conversion.
source§

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.
source§

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

Performs the conversion.