pub struct SequentialProcessLoaderMachine<'a, C: Chip + 'static, D: ProcessStandardDebug + 'static> { /* private fields */ }
Expand description
A machine for loading processes stored sequentially in a region of flash.
Load processes (stored as TBF objects in flash) into runnable process
structures stored in the procs
array. This machine scans the footers in
the TBF for cryptographic credentials for binary integrity, passing them to
the checker to decide whether the process has sufficient credentials to run.
Implementations§
Source§impl<'a, C: Chip, D: ProcessStandardDebug> SequentialProcessLoaderMachine<'a, C, D>
impl<'a, C: Chip, D: ProcessStandardDebug> SequentialProcessLoaderMachine<'a, C, D>
Sourcepub fn new(
checker: &'static ProcessCheckerMachine,
procs: &'static mut [Option<&'static dyn Process>],
proc_binaries: &'static mut [Option<ProcessBinary>],
kernel: &'static Kernel,
chip: &'static C,
flash: &'static [u8],
app_memory: &'static mut [u8],
fault_policy: &'static dyn ProcessFaultPolicy,
storage_policy: &'static dyn ProcessStandardStoragePermissionsPolicy<C, D>,
policy: &'static dyn AppIdPolicy,
_capability_management: &dyn ProcessManagementCapability,
) -> Self
pub fn new( checker: &'static ProcessCheckerMachine, procs: &'static mut [Option<&'static dyn Process>], proc_binaries: &'static mut [Option<ProcessBinary>], kernel: &'static Kernel, chip: &'static C, flash: &'static [u8], app_memory: &'static mut [u8], fault_policy: &'static dyn ProcessFaultPolicy, storage_policy: &'static dyn ProcessStandardStoragePermissionsPolicy<C, D>, policy: &'static dyn AppIdPolicy, _capability_management: &dyn ProcessManagementCapability, ) -> Self
This function is made pub
so that board files can use it, but loading
processes from slices of flash an memory is fundamentally unsafe.
Therefore, we require the ProcessManagementCapability
to call this
function.
Sourcepub fn set_runtime_client(&self, client: &'a dyn ProcessLoadingAsyncClient)
pub fn set_runtime_client(&self, client: &'a dyn ProcessLoadingAsyncClient)
Set the runtime client to receive callbacks about process loading and when process loading has finished.
Sourcepub fn check_if_within_flash_bounds(&self, offset: usize, length: usize) -> bool
pub fn check_if_within_flash_bounds(&self, offset: usize, length: usize) -> bool
Function to check if the object with address offset
of size length
lies
within flash bounds.
Sourcepub fn check_flash_for_new_address(
&self,
new_app_size: usize,
) -> Result<(usize, PaddingRequirement, usize, usize), ProcessBinaryError>
pub fn check_flash_for_new_address( &self, new_app_size: usize, ) -> Result<(usize, PaddingRequirement, usize, usize), ProcessBinaryError>
Function to compute an available address for the new application binary.
Sourcepub fn load_new_process_binary(
&self,
app_address: usize,
app_size: usize,
) -> Result<(), ProcessLoadError>
pub fn load_new_process_binary( &self, app_address: usize, app_size: usize, ) -> Result<(), ProcessLoadError>
Function to start loading the new application at address app_address
with size
app_size
.
Trait Implementations§
Source§impl<C: Chip, D: ProcessStandardDebug> DeferredCallClient for SequentialProcessLoaderMachine<'_, C, D>
impl<C: Chip, D: ProcessStandardDebug> DeferredCallClient for SequentialProcessLoaderMachine<'_, C, D>
Source§impl<C: Chip, D: ProcessStandardDebug> ProcessCheckerMachineClient for SequentialProcessLoaderMachine<'_, C, D>
impl<C: Chip, D: ProcessStandardDebug> ProcessCheckerMachineClient for SequentialProcessLoaderMachine<'_, C, D>
Source§fn done(
&self,
process_binary: ProcessBinary,
result: Result<Option<AcceptedCredential>, ProcessCheckError>,
)
fn done( &self, process_binary: ProcessBinary, result: Result<Option<AcceptedCredential>, ProcessCheckError>, )
result
.0 Read more