Type Alias SysCall

Source
pub type SysCall = SysCall<CortexM4>;

Aliased Type§

struct SysCall(/* private fields */);

Implementations

Source§

impl<A> SysCall<A>
where A: CortexMVariant,

Source

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

Trait Implementations

Source§

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

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.

Source§

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 <SysCall<A> as UserspaceKernelBoundary>::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 <SysCall<A> as UserspaceKernelBoundary>::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.