summaryrefslogtreecommitdiffstats
path: root/libgloss/or1k/exceptions-asm.S
diff options
context:
space:
mode:
Diffstat (limited to 'libgloss/or1k/exceptions-asm.S')
-rw-r--r--libgloss/or1k/exceptions-asm.S19
1 files changed, 19 insertions, 0 deletions
diff --git a/libgloss/or1k/exceptions-asm.S b/libgloss/or1k/exceptions-asm.S
index 91a2d8972..4dd4d106a 100644
--- a/libgloss/or1k/exceptions-asm.S
+++ b/libgloss/or1k/exceptions-asm.S
@@ -27,6 +27,7 @@
#define EXCEPTION_STACK_SIZE 136
.extern _or1k_exception_handler_table
+ .extern _or1k_exception_level
/* -------------------------------------------------------------------------- */
/*!Function to call appropriate exception handler
@@ -159,6 +160,24 @@ _or1k_exception_handler:
#endif
l.sw 0(r21),r20
+ /* Decrement the exception nesting level */
+ // Load the exception level entry
+ l.movhi r2,hi(_or1k_exception_level)
+ l.ori r2,r2,lo(_or1k_exception_level)
+#ifdef __OR1K_MULTICORE__
+ // In multicore this is the pointer to an array
+ // Load pointer value
+ l.lwz r2,0(r2)
+ // Add word offset of this core's nesting level
+ l.add r2,r2,r22
+#endif
+ // Load the nesting level entry
+ l.lwz r3,0(r2)
+ // Decrement nesting level
+ l.addi r3,r3,-1
+ // Store back the nesting level
+ l.sw 0(r2),r3
+
/* Restore state */
l.lwz r2,0x80(r1)
l.mtspr r0,r2,OR1K_SPR_SYS_EPCR_BASE