Skip to main content

Module fault

Module fault 

Source
Expand description

Fault policy (plan.md §3.4).

When the arch layer catches a hardware fault — a MemManage fault on Cortex-M, an access fault on RISC-V (mcause 1/5/7, typically from a PMP guard), or a detected stack overflow — it builds a FaultInfo and dispatches it here. Two explicit policies:

  • FaultPolicy::Panic (default): dump a diagnosis (kind, address, PC, faulting task) and reset the system.
  • FaultPolicy::IsolateTask: mark the faulting task Faulted, poison every PriorityMutex it holds, invoke the user on_task_fault hook, and context-switch to the next ready task — genuine per-task fault containment, using only the scheduler’s existing “resume an arbitrary sp” primitive.

Structs§

FaultInfo
Everything needed to attribute and report a fault.

Enums§

FaultKind
What kind of fault occurred.
FaultPolicy
Fault handling policy.

Functions§

on_fault
Handle a fault. Under FaultPolicy::Panic this diverges (dumps and resets). Under FaultPolicy::IsolateTask it returns the stack pointer the trap handler should resume — the next ready task’s.
set_on_task_fault
Register the IsolateTask hook (called with the faulting task id).
set_policy
Set the fault policy.

Type Aliases§

OnTaskFault
User hook invoked (under IsolateTask) with the faulting task id and the fault info, before the scheduler switches away.