mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-24 07:28:34 +00:00
feat(core): improve post mortem info for secure fault
[no changelog]
This commit is contained in:
parent
05acc1599b
commit
5b537103bd
@ -44,6 +44,12 @@ typedef struct {
|
||||
uint32_t mmfar;
|
||||
// Address associated with the BusFault
|
||||
uint32_t bfar;
|
||||
#if defined(__ARM_FEATURE_CMSE)
|
||||
// Secure Fault Status Register
|
||||
uint32_t sfsr;
|
||||
// Address associated with the SecureFault
|
||||
uint32_t sfar;
|
||||
#endif
|
||||
// Stack pointer at the time of the fault
|
||||
// (MSP or PSP depending on the privilege level)
|
||||
uint32_t sp;
|
||||
|
@ -93,7 +93,7 @@ void systask_scheduler_init(systask_error_handler_t error_handler) {
|
||||
#if defined(__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
|
||||
// Enable SecureFault handler
|
||||
SCB->SHCSR |= SCB_SHCSR_SECUREFAULTENA_Msk;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
systask_t* systask_active(void) {
|
||||
@ -380,6 +380,10 @@ __attribute((used)) static void systask_exit_fault(bool privileged,
|
||||
pminfo->fault.mmfar = SCB->MMFAR;
|
||||
pminfo->fault.bfar = SCB->BFAR;
|
||||
pminfo->fault.hfsr = SCB->HFSR;
|
||||
#if defined(__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
|
||||
pminfo->fault.sfsr = SAU->SFSR;
|
||||
pminfo->fault.sfar = SAU->SFAR;
|
||||
#endif
|
||||
}
|
||||
|
||||
systask_kill(task);
|
||||
|
Loading…
Reference in New Issue
Block a user