This repository has been archived by the owner on Jan 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support user thread mode in hard fault handler
- Loading branch information
Showing
3 changed files
with
15 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.global HardFault | ||
.thumb_func | ||
HardFault: | ||
movs r0, lr | ||
lsl r0, r0, #29 // Test bit[2] of EXC_RETURN to determine thread mode | ||
bmi HardFault.PSP | ||
|
||
HardFault.MSP: | ||
mrs r0, MSP // Use Main Stack Pointer (if in privileged mode) | ||
bl UserHardFault // Jump to hard fault handler | ||
|
||
HardFault.PSP: | ||
mrs r0, PSP // Use Process Stack Pointer (if in user mode) | ||
bl UserHardFault // Jump to hard fault handler |