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:
@ -23,8 +23,13 @@
|
||||
#include "or1k-internals.h"
|
||||
|
||||
#ifdef __OR1K_MULTICORE__
|
||||
// Define pointers to arrays
|
||||
uint32_t* *_or1k_stack_core;
|
||||
uint32_t* *_or1k_exception_stack_core;
|
||||
uint32_t* *_or1k_exception_level;
|
||||
#else
|
||||
// Define scalar
|
||||
uint32_t _or1k_exception_level;
|
||||
#endif
|
||||
|
||||
uint32_t* _or1k_stack_top;
|
||||
@ -68,6 +73,15 @@ void _or1k_init() {
|
||||
#else
|
||||
_or1k_exception_handler_table[6] = _or1k_interrupt_handler;
|
||||
#endif
|
||||
|
||||
#ifdef __OR1K_MULTICORE__
|
||||
_or1k_exception_level = _sbrk_r(0, 4 * or1k_numcores());
|
||||
for (c = 0; c < or1k_numcores(); c++) {
|
||||
_or1k_exception_level[c] = 0;
|
||||
}
|
||||
#else
|
||||
_or1k_exception_level = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t or1k_critical_begin() {
|
||||
|
Reference in New Issue
Block a user