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 taskFaulted, poison everyPriorityMutexit holds, invoke the useron_task_faulthook, 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§
- Fault
Info - Everything needed to attribute and report a fault.
Enums§
- Fault
Kind - What kind of fault occurred.
- Fault
Policy - Fault handling policy.
Functions§
- on_
fault - Handle a fault. Under
FaultPolicy::Panicthis diverges (dumps and resets). UnderFaultPolicy::IsolateTaskit returns the stack pointer the trap handler should resume — the next ready task’s. - set_
on_ task_ fault - Register the
IsolateTaskhook (called with the faulting task id). - set_
policy - Set the fault policy.
Type Aliases§
- OnTask
Fault - User hook invoked (under
IsolateTask) with the faulting task id and the fault info, before the scheduler switches away.