pub struct SysCall<A: CortexMVariant>(/* private fields */);
Expand description
Implementation of the UserspaceKernelBoundary
for the Cortex-M non-floating point
architecture.
Implementations§
Trait Implementations§
source§impl<A: CortexMVariant> UserspaceKernelBoundary for SysCall<A>
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<(), ()>
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
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
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<(), ()>
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<(), ()>
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>)
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,
)
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>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more