diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-11-23 09:32:52 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2012-12-03 13:17:08 +0100 |
commit | 4bd4c9e1f9fad33b2ddf13e246326f16f22ccccd (patch) | |
tree | c0a9eea940eed0257b300add42d6a93216e9992d /c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_hdl.c | |
parent | bsps/powerpc: Declare ppc_exc_handler_table (diff) | |
download | rtems-4bd4c9e1f9fad33b2ddf13e246326f16f22ccccd.tar.bz2 |
bsps/powerpc: Add PPC_EXC_CONFIG_USE_FIXED_HANDLER
In case a BSP enables this option, then fixed high level exception
handler will be used. For normal asynchronous exceptions this is
bsp_interrupt_dispatch() and for other exceptions this is the handler
from the read-only ppc_exc_handler_table. The global handler is
C_exception_handler(). This avoids some dependencies on valid
read-write data.
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_hdl.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_hdl.c b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_hdl.c index 25d6b26faa..b24467b8e9 100644 --- a/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_hdl.c +++ b/c/src/lib/libcpu/powerpc/new-exceptions/bspsupport/ppc_exc_hdl.c @@ -39,16 +39,22 @@ uint32_t ppc_exc_vector_register_mchk = 0; */ uint32_t ppc_exc_msr_bits = MSR_IR | MSR_DR | MSR_RI; -static int ppc_exc_handler_default(BSP_Exception_frame *f, unsigned int vector) +int ppc_exc_handler_default(BSP_Exception_frame *f, unsigned int vector) { return -1; } +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER + +exception_handler_t globalExceptHdl = C_exception_handler; + /* Table of C-handlers */ ppc_exc_handler_t ppc_exc_handler_table [LAST_VALID_EXC + 1] = { [0 ... LAST_VALID_EXC] = ppc_exc_handler_default }; +#endif /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ + ppc_exc_handler_t ppc_exc_get_handler(unsigned vector) { if ( @@ -65,9 +71,15 @@ rtems_status_code ppc_exc_set_handler(unsigned vector, ppc_exc_handler_t handler { if (vector <= LAST_VALID_EXC) { if (handler == NULL) { - ppc_exc_handler_table [vector] = ppc_exc_handler_default; - } else { + handler = ppc_exc_handler_default; + } + + if (ppc_exc_handler_table [vector] != handler) { +#ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER ppc_exc_handler_table [vector] = handler; +#else /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ + return RTEMS_RESOURCE_IN_USE; +#endif /* PPC_EXC_CONFIG_USE_FIXED_HANDLER */ } return RTEMS_SUCCESSFUL; |