Struct kernel::ReadOnlyAppSlice[][src]

pub struct ReadOnlyAppSlice { /* fields omitted */ }

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

Implementations

impl ReadOnlyAppSlice[src]

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

Construct a new ReadOnlyAppSlice 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. ReadOnlyAppSlice 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 ReadOnlyAppSlice. 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 optionally writable and executable.

Trait Implementations

impl Default for ReadOnlyAppSlice[src]

impl Read for ReadOnlyAppSlice[src]

Auto Trait Implementations

impl !Send for ReadOnlyAppSlice

impl !Sync for ReadOnlyAppSlice

impl Unpin for ReadOnlyAppSlice

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.