arch: arm: indicate Secure domain fault in Non-Secure fault exception
This commit adds the logic to indicate that a Non-Secure fault exception has been triggered due to a processor fault that has, in fact, occurred in the Secure state. Signed-off-by: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
This commit is contained in:
parent
049494c026
commit
d4c74122b1
|
@ -715,9 +715,32 @@ void _Fault(NANO_ESF *esf, u32_t exc_return)
|
|||
}
|
||||
}
|
||||
}
|
||||
#elif defined(CONFIG_ARM_NONSECURE_FIRMWARE)
|
||||
if ((exc_return & EXC_RETURN_INDICATOR_PREFIX) !=
|
||||
EXC_RETURN_INDICATOR_PREFIX) {
|
||||
/* Invalid EXC_RETURN value */
|
||||
goto _exit_fatal;
|
||||
}
|
||||
if (exc_return & EXC_RETURN_EXCEPTION_SECURE_Secure) {
|
||||
/* Non-Secure Firmware shall only handle Non-Secure Exceptions.
|
||||
* This is a fatal error.
|
||||
*/
|
||||
goto _exit_fatal;
|
||||
}
|
||||
|
||||
if (exc_return & EXC_RETURN_RETURN_STACK_Secure) {
|
||||
/* Exception entry occurred in Secure stack.
|
||||
*
|
||||
* Note that Non-Secure firmware cannot inspect the Secure
|
||||
* stack to determine the root cause of the fault. Fault
|
||||
* inspection will indicate the Non-Secure instruction
|
||||
* that performed the branch to the Secure domain.
|
||||
*/
|
||||
PR_FAULT_INFO("Exception occurred in Secure State\n");
|
||||
}
|
||||
#else
|
||||
(void) exc_return;
|
||||
#endif /* CONFIG_ARM_SECURE_FIRMWARE*/
|
||||
#endif /* CONFIG_ARM_SECURE_FIRMWARE */
|
||||
|
||||
reason = _FaultHandle(esf, fault);
|
||||
|
||||
|
@ -725,7 +748,8 @@ void _Fault(NANO_ESF *esf, u32_t exc_return)
|
|||
return;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_ARM_SECURE_FIRMWARE)
|
||||
#if defined(CONFIG_ARM_SECURE_FIRMWARE) || \
|
||||
defined(CONFIG_ARM_NONSECURE_FIRMWARE)
|
||||
_exit_fatal:
|
||||
reason = _NANO_ERR_HW_EXCEPTION;
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue