or1k: Allow exception nesting
Allow exceptions to be nested, which is especially useful with urgent interrupts while processing an exception. The implementation counts up the nesting level with each call to an exception. In the outer exception (level 1), the exception stack is started. All nested exceptions just reserve the redzone (scratch memory that may be used by compiler) and exception context on the stack, but then process on the same scratch. Restriction: Impure pointers are shared among all exceptions. This may be solved by creating an impure data structure in the stack frame with each nested exception. * or1k/crt0.S: Add exception nesting * or1k/exceptions-asm.S: ditto * or1k/util.c: ditto
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user