summaryrefslogtreecommitdiffstats
path: root/libgloss/or1k/util.c
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2015-08-07 14:52:07 -0400
committerJeff Johnston <jjohnstn@redhat.com>2015-08-07 15:02:03 -0400
commit31cf34f84903dec0c8fae716f80e46e57501ff19 (patch)
treef5fe85394ff94ab22edc40eb252ae9276f0041ab /libgloss/or1k/util.c
parent4098f69c4302664c4dc65812779a8849ccc323b6 (diff)
downloadcygnal-31cf34f84903dec0c8fae716f80e46e57501ff19.tar.gz
cygnal-31cf34f84903dec0c8fae716f80e46e57501ff19.tar.bz2
cygnal-31cf34f84903dec0c8fae716f80e46e57501ff19.zip
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
Diffstat (limited to 'libgloss/or1k/util.c')
-rw-r--r--libgloss/or1k/util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libgloss/or1k/util.c b/libgloss/or1k/util.c
index 74071719e..5e853f359 100644
--- a/libgloss/or1k/util.c
+++ b/libgloss/or1k/util.c
@@ -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() {