1 // debug-vector.S -- Debug Exception Vector
2 // $Id: //depot/rel/Cottonwood/Xtensa/OS/xtos/debug-vector.S#3 $
4 // Copyright (c) 2003-2004, 2006, 2010 Tensilica Inc.
6 // Permission is hereby granted, free of charge, to any person obtaining
7 // a copy of this software and associated documentation files (the
8 // "Software"), to deal in the Software without restriction, including
9 // without limitation the rights to use, copy, modify, merge, publish,
10 // distribute, sublicense, and/or sell copies of the Software, and to
11 // permit persons to whom the Software is furnished to do so, subject to
12 // the following conditions:
14 // The above copyright notice and this permission notice shall be included
15 // in all copies or substantial portions of the Software.
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 #include <xtensa/coreasm.h>
26 #include <xtensa/config/specreg.h>
28 #include <xtensa/simcall.h>
31 #if XCHAL_HAVE_DEBUG && XCHAL_HAVE_EXCEPTIONS
33 // This code goes at the debug exception vector
35 .begin literal_prefix .DebugExceptionVector
36 .section .DebugExceptionVector.text, "ax"
38 .global _DebugExceptionVector
39 _DebugExceptionVector:
42 // In the simulator (ISS), let the debugger (if any is attached)
43 // handle the debug exception, else simply stop the simulation:
45 wsr a2, EXCSAVE+XCHAL_DEBUGLEVEL // save a2 where simulator expects it
46 movi a2, SYS_gdb_enter_sktloop
47 simcall // have ISS handle the debug exception
49 // For hardware, this code does not handle debug exceptions.
50 // To implement a target-side debug monitor, replace this
51 // vector with a real one that uses target-specific facilities
52 // to communicate with the debugger.
55 #if XCHAL_HAVE_INTERRUPTS
56 waiti XCHAL_DEBUGLEVEL // unexpected debug exception, loop in low-power mode
58 j 1b // infinite loop - unexpected debug exception
59 # endif /*!SIMULATOR*/
62 .size _DebugExceptionVector, . - _DebugExceptionVector
64 #endif /* XCHAL_HAVE_DEBUG && XCHAL_HAVE_EXCEPTIONS */