pub trait ProcessFault {
    fn process_fault_hook(&self, process: &dyn Process) -> Result<(), ()> { ... }
Expand description

Trait for implementing process fault handlers to run when a process faults.

Provided Methods

This function is called when an app faults.

This is an optional function that can be implemented by Platforms that allows the chip to handle the app fault and not terminate or restart the app.

If Ok(()) is returned by this function then the kernel will not terminate or restart the app, but instead allow it to continue running. NOTE in this case the chip must have fixed the underlying reason for fault otherwise it will re-occur.

This can not be used for apps to circumvent Tock’s protections. If for example this function just ignored the error and allowed the app to continue the fault would continue to occur.

If Err(()) is returned then the kernel will set the app as faulted and follow the FaultResponse protocol.

It is unlikey a Platform will need to implement this. This should be used for only a handul of use cases. Possible use cases include:

  • Allowing the kernel to emulate unimplemented instructions This could be used to allow apps to run on hardware that doesn’t implement some instructions, for example atomics.
  • Allow the kernel to handle hardware faults, triggered by the app. This can allow an app to continue running if it triggers certain types of faults. For example if an app triggers a memory parity error the kernel can handle the error and allow the app to continue (or not).
  • Allow an app to execute from external QSPI. This could be used to allow an app to execute from external QSPI where access faults can be handled by the Platform to ensure the QPSI is mapped correctly.

Implementations on Foreign Types

Implement default ProcessFault trait for unit.