Struct cortexm::syscall::SysCall

source ·
pub struct SysCall<A: CortexMVariant>(/* private fields */);
Expand description

Implementation of the UserspaceKernelBoundary for the Cortex-M non-floating point architecture.

Implementations§

source§

impl<A: CortexMVariant> SysCall<A>

source

pub const unsafe fn new() -> SysCall<A>

Trait Implementations§

source§

impl<A: CortexMVariant> UserspaceKernelBoundary for SysCall<A>

source§

unsafe fn set_process_function( &self, accessible_memory_start: *const u8, app_brk: *const u8, state: &mut CortexMStoredState, callback: FunctionCall, ) -> Result<(), ()>

When the process calls svc to enter the kernel, the hardware automatically pushes an SVC frame that will be unstacked when the kernel returns to the process. In the special case of process startup, initialize_new_process sets up an empty SVC frame as if an svc had been called.

Here, we modify this stack frame such that the process resumes at the beginning of the callback function that we want the process to run. We place the originally intended return address in the link register so that when the function completes execution continues.

In effect, this converts svc into bl callback.

§

type StoredState = CortexMStoredState

Some architecture-specific struct containing per-process state that must be kept while the process is not running. For example, for keeping CPU registers that aren’t stored on the stack. Read more
source§

fn initial_process_app_brk_size(&self) -> usize

Called by the kernel during process creation to inform the kernel of the minimum amount of process-accessible RAM needed by a new process. This allows for architecture-specific process layout decisions, such as stack pointer initialization. Read more
source§

unsafe fn initialize_process( &self, accessible_memory_start: *const u8, app_brk: *const u8, state: &mut Self::StoredState, ) -> Result<(), ()>

Called by the kernel after it has memory allocated to it but before it is allowed to begin executing. Allows for architecture-specific process setup, e.g. allocating a syscall stack frame. Read more
source§

unsafe fn set_syscall_return_value( &self, accessible_memory_start: *const u8, app_brk: *const u8, state: &mut Self::StoredState, return_value: SyscallReturn, ) -> Result<(), ()>

Set the return value the process should see when it begins executing again after the syscall. This will only be called after a process has called a syscall. Read more
source§

unsafe fn switch_to_process( &self, accessible_memory_start: *const u8, app_brk: *const u8, state: &mut CortexMStoredState, ) -> (ContextSwitchReason, Option<*const u8>)

Context switch to a specific process. Read more
source§

unsafe fn print_context( &self, accessible_memory_start: *const u8, app_brk: *const u8, state: &CortexMStoredState, writer: &mut dyn Write, )

Display architecture specific (e.g. CPU registers or status flags) data for a process identified by the stored state for that process. Read more
source§

fn store_context( &self, state: &CortexMStoredState, out: &mut [u8], ) -> Result<usize, ErrorCode>

Store architecture specific (e.g. CPU registers or status flags) data for a process. On success returns the number of elements written to out.

Auto Trait Implementations§

§

impl<A> Freeze for SysCall<A>

§

impl<A> RefUnwindSafe for SysCall<A>
where A: RefUnwindSafe,

§

impl<A> Send for SysCall<A>
where A: Send,

§

impl<A> Sync for SysCall<A>
where A: Sync,

§

impl<A> Unpin for SysCall<A>
where A: Unpin,

§

impl<A> UnwindSafe for SysCall<A>
where A: UnwindSafe,

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.