Skip to content

Commit 6e354f1

Browse files
committed
Clear fault status before halting
Now that halt functions allow re-directing execution to an unprivileged handler, we need to make sure that the bus fault status is cleared before halting, otherwise two consecutive faults would have a spurious state. Fixes: ba18966 Move fault status register clearing to end of handler
1 parent 3529b20 commit 6e354f1

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

core/system/src/mpu/vmpu_armv7m.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ void vmpu_sys_mux_handler(uint32_t lr, uint32_t msp)
230230

231231
/* if recovery was not successful, throw an error and halt */
232232
DEBUG_FAULT(FAULT_MEMMANAGE, lr, psp);
233+
VMPU_SCB_MMFSR = fault_status;
233234
HALT_ERROR(PERMISSION_DENIED, "Access to restricted resource denied");
234235
}
235236
else

core/system/src/mpu/vmpu_freescale_k64.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ void vmpu_sys_mux_handler(uint32_t lr, uint32_t msp)
9090

9191
/* if recovery was not successful, throw an error and halt */
9292
DEBUG_FAULT(FAULT_BUS, lr, psp);
93+
VMPU_SCB_BFSR = fault_status;
9394
HALT_ERROR(PERMISSION_DENIED, "Access to restricted resource denied");
9495
}
9596
else

0 commit comments

Comments
 (0)