Move debug exception vector to vector_defaults.S

This commit is contained in:
Jeroen Domburg 2017-03-26 11:37:37 +08:00
parent 202a5db2d2
commit 58e8763874
4 changed files with 27 additions and 28 deletions

View file

@ -241,6 +241,9 @@ void panicHandler(XtExcFrame *frame)
void xt_unhandled_exception(XtExcFrame *frame) void xt_unhandled_exception(XtExcFrame *frame)
{ {
//Disable all interrupts, so a backtrace isn't interrupted by needless stuff
asm volatile("wsr %0,INTENABLE\nesync\n"::"r"(x));
haltOtherCore(); haltOtherCore();
panicPutStr("Guru Meditation Error of type "); panicPutStr("Guru Meditation Error of type ");
int exccause = frame->exccause; int exccause = frame->exccause;

View file

@ -1,5 +0,0 @@
.global xt_highint5
.global _xt_highint5
.weak xt_highint5
.set xt_highint5, _xt_highint5

View file

@ -5,10 +5,29 @@
#include "soc/soc.h" #include "soc/soc.h"
/* /*
This file contains the default handlers for the high interrupt levels. The default behavious This file contains the default handlers for the high interrupt levels as well as some specialized exceptions.
is to just exit the interrupt. The default behaviour is to just exit the interrupt or call the panic handler on the exceptions
*/ */
#if XCHAL_HAVE_DEBUG
.global xt_debugexception
.weak xt_debugexception
.set xt_debugexception, _xt_debugexception
.section .iram1,"ax"
.type _xt_debugexception,@function
.align 4
_xt_debugexception:
movi a0,PANIC_RSN_DEBUGEXCEPTION
wsr a0,EXCCAUSE
call0 _xt_panic /* does not return */
rsr a0, EXCSAVE+XCHAL_DEBUGLEVEL
rfi XCHAL_DEBUGLEVEL
#endif /* Debug exception */
#if XCHAL_NUM_INTLEVELS >=2 && XCHAL_EXCM_LEVEL <2 && XCHAL_DEBUGLEVEL !=2 #if XCHAL_NUM_INTLEVELS >=2 && XCHAL_EXCM_LEVEL <2 && XCHAL_DEBUGLEVEL !=2
.global xt_highint2 .global xt_highint2
.weak xt_highint2 .weak xt_highint2

View file

@ -471,28 +471,10 @@ Debug Exception.
.section .DebugExceptionVector.text, "ax" .section .DebugExceptionVector.text, "ax"
.global _DebugExceptionVector .global _DebugExceptionVector
.align 4 .align 4
.global xt_debugexception
_DebugExceptionVector: _DebugExceptionVector:
wsr a0, EXCSAVE+XCHAL_DEBUGLEVEL /* preserve a0 */
#ifdef XT_SIMULATOR call0 xt_debugexception /* load exception handler */
/*
In the simulator, let the debugger (if any) handle the debug exception,
or simply stop the simulation:
*/
wsr a2, EXCSAVE+XCHAL_DEBUGLEVEL /* save a2 where sim expects it */
movi a2, SYS_gdb_enter_sktloop
simcall /* have ISS handle debug exc. */
#elif 0 /* change condition to 1 to use the HAL minimal debug handler */
wsr a3, EXCSAVE+XCHAL_DEBUGLEVEL
movi a3, xthal_debugexc_defhndlr_nw /* use default debug handler */
jx a3
#else
wsr a0, EXCSAVE+XCHAL_DEBUGLEVEL /* save original a0 somewhere */
movi a0,PANIC_RSN_DEBUGEXCEPTION
wsr a0,EXCCAUSE
call0 _xt_panic /* does not return */
rfi XCHAL_DEBUGLEVEL /* make a0 point here not later */
#endif
.end literal_prefix .end literal_prefix