arch: arc: bug fixes and optimization in exception handling
The original exception handling has space to optimize and and some bugs need to be fixed. * define NANO_ESF * add the definition of NANO_ESF which is an irq_stack_frame * add the corresponding codes in exception entry and handler * remove _default_esf * implement the _ARCH_EXCEPT * use trap exception to raise exception by kernel * add corresponding trap exception entry * add _do_kernel_oops to handle the exception raised by _ARCH_EXCEPT. * add the thread context switch in exception return * case: kernel oops may raise thread context switch * case: some tests will re-implement SysFatalHandler to raise thread context switch. * as the exception and isr are handled in kernel isr stack, so the thread context switch must be in the return of exception/isr , and the exception handler must return, should not be decorated with FUNC_NORETURN * for arc, _is_in_isr should consider the case of exception Signed-off-by: Wayne Ren <wei.ren@synopsys.com>
This commit is contained in:
parent
3a72cc9889
commit
3d9ba10b5c
8 changed files with 132 additions and 110 deletions
|
@ -29,7 +29,7 @@
|
|||
*
|
||||
* @return This function does not return.
|
||||
*/
|
||||
void _Fault(void)
|
||||
void _Fault(const NANO_ESF *esf)
|
||||
{
|
||||
u32_t vector, code, parameter;
|
||||
u32_t exc_addr = _arc_v2_aux_reg_read(_ARC_V2_EFA);
|
||||
|
@ -47,8 +47,9 @@ void _Fault(void)
|
|||
* check violation
|
||||
*/
|
||||
if (vector == 6 && parameter == 2) {
|
||||
_NanoFatalErrorHandler(_NANO_ERR_STACK_CHK_FAIL, &_default_esf);
|
||||
_NanoFatalErrorHandler(_NANO_ERR_STACK_CHK_FAIL, esf);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
_NanoFatalErrorHandler(_NANO_ERR_HW_EXCEPTION, &_default_esf);
|
||||
_NanoFatalErrorHandler(_NANO_ERR_HW_EXCEPTION, esf);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue