mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-11 16:00:57 +00:00
core/embed: add explicit fault handlers
This commit is contained in:
parent
c8c27dcd2f
commit
b34675401c
@ -109,7 +109,32 @@ int main(void) {
|
||||
// MicroPython default exception handler
|
||||
|
||||
void __attribute__((noreturn)) nlr_jump_fail(void *val) {
|
||||
ensure(secfalse, "uncaught exception");
|
||||
error_shutdown("Internal error", "(UE)", NULL, NULL);
|
||||
}
|
||||
|
||||
// interrupt handlers
|
||||
|
||||
void NMI_Handler(void) {
|
||||
// Clock Security System triggered NMI
|
||||
if ((RCC->CIR & RCC_CIR_CSSF) != 0) {
|
||||
error_shutdown("Internal error", "(CS)", NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void HardFault_Handler(void) {
|
||||
error_shutdown("Internal error", "(HF)", NULL, NULL);
|
||||
}
|
||||
|
||||
void MemManage_Handler(void) {
|
||||
error_shutdown("Internal error", "(MM)", NULL, NULL);
|
||||
}
|
||||
|
||||
void BusFault_Handler(void) {
|
||||
error_shutdown("Internal error", "(BF)", NULL, NULL);
|
||||
}
|
||||
|
||||
void UsageFault_Handler(void) {
|
||||
error_shutdown("Internal error", "(UF)", NULL, NULL);
|
||||
}
|
||||
|
||||
void PendSV_Handler(void) { pendsv_isr_handler(); }
|
||||
|
@ -163,7 +163,7 @@ void clear_otg_hs_memory(void) {
|
||||
uint32_t __stack_chk_guard = 0;
|
||||
|
||||
void __attribute__((noreturn)) __stack_chk_fail(void) {
|
||||
ensure(secfalse, "Stack smashing detected");
|
||||
error_shutdown("Internal error", "(SS)", NULL, NULL);
|
||||
}
|
||||
|
||||
uint8_t HW_ENTROPY_DATA[HW_ENTROPY_LEN];
|
||||
|
Loading…
Reference in New Issue
Block a user