summaryrefslogtreecommitdiffstats
path: root/nuttx/arch/arm/src/sam3u
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2010-11-20 00:39:29 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2010-11-20 00:39:29 +0000
commitd15690d31744ac52d68625472999e3474b540d8f (patch)
treeb827da1499744d503114c5f538007f93234903f9 /nuttx/arch/arm/src/sam3u
parent15e3ef7a3375b7b3efa8da7f0b9e27c180f08fde (diff)
Fix Cortex-M3 nested interrupt hard fault
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3119 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/arch/arm/src/sam3u')
-rwxr-xr-xnuttx/arch/arm/src/sam3u/sam3u_vectors.S15
1 files changed, 8 insertions, 7 deletions
diff --git a/nuttx/arch/arm/src/sam3u/sam3u_vectors.S b/nuttx/arch/arm/src/sam3u/sam3u_vectors.S
index efa7e0a550..4411cc5b55 100755
--- a/nuttx/arch/arm/src/sam3u/sam3u_vectors.S
+++ b/nuttx/arch/arm/src/sam3u/sam3u_vectors.S
@@ -284,19 +284,20 @@ sam3u_common:
1:
ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */
2:
- msr msp, r1 /* Recover the return MSP value */
+ msr msp, r1 /* Recover the return MSP value */
- /* Do we need to restore interrupts? */
+ /* Restore the interrupt state. Preload r14 with the special return
+ * value first (so that the return actually occurs with interrupts
+ * still disabled).
+ */
- tst r3, #1 /* PRIMASK bit 1=1 means that interrupts are masked */
- bne 3f
- cpsie i /* Restore interrupts */
+ ldr r14, =EXC_RETURN /* Load the special value */
+ msr primask, r3 /* Restore interrupts */
/* Always return with R14 containing the special value that will: (1)
* return to thread mode, and (2) continue to use the MSP
*/
-3:
- ldr r14, =EXC_RETURN /* Load the special value */
+
bx r14 /* And return */
.size handlers, .-handlers