Struct kernel::ReadWriteAppSlice[][src]

pub struct ReadWriteAppSlice { /* fields omitted */ }

Read-writable memory region of a process, shared with the kernel

Implementations

impl ReadWriteAppSlice[src]

pub unsafe fn new_external(
    ptr: *mut u8,
    len: usize,
    process_id: ProcessId,
    _cap: &dyn ExternalProcessCapability
) -> Self
[src]

Construct a new ReadWriteAppSlice over a given pointer and length.

Publicly accessible constructor, which requires the capabilities::ExternalProcessCapability capability. This is provided to allow implementations of the Process trait outside of the kernel crate.

Safety requirements

In Rust, no two slices may point to the same memory location if at least one is mutable. This constructor relies on the fact that at most a single ReadWriteAppSlice or ReadOnlyAppSlice will point to the memory region of [ptr; ptr + len), and no other slice in scope anywhere in the kernel points to an overlapping memory region.

If the length is 0, an arbitrary pointer may be passed into ptr. It does not necessarily have to point to allocated memory, nor does it have to meet Rust’s pointer validity requirements. ReadWriteAppSlice must ensure that all Rust slices with a length of 0 must be constructed over a valid (but not necessarily allocated) base pointer.

If the length is not 0, the memory region of [ptr; ptr + len) must be valid memory of the process of the given ProcessId. It must be allocated and and accessible over the entire lifetime of the ReadWriteAppSlice. It must not point to memory outside of the process’ accessible memory range, or point (in part) to other processes or kernel memory. The ptr must meet Rust’s requirements for pointer validity, in particular it must have a minimum alignment of core::mem::align_of::<u8>() on the respective platform. It must point to memory mapped as readable and writable and optionally executable.

pub const fn const_default() -> Self[src]

This is a const version of Default::default with the same semantics.

Having a const initializer allows initializing a fixed-size array with default values without the struct being marked Copy as such:

use kernel::ReadWriteAppSlice;
const DEFAULT_RWAPPSLICE_VAL: ReadWriteAppSlice = ReadWriteAppSlice::const_default();
let my_array = [DEFAULT_RWAPPSLICE_VAL; 12];

Trait Implementations

impl Default for ReadWriteAppSlice[src]

impl Read for ReadWriteAppSlice[src]

impl ReadWrite for ReadWriteAppSlice[src]

Auto Trait Implementations

impl !Send for ReadWriteAppSlice

impl !Sync for ReadWriteAppSlice

impl Unpin for ReadWriteAppSlice

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.