Setting up repository
[linux-libre-firmware.git] / ath9k_htc / sboot / magpie_1_1 / sboot / athos / src / xtos / debug-vector.S
1 // debug-vector.S  --  Debug Exception Vector
2 // $Id: //depot/rel/Cottonwood/Xtensa/OS/xtos/debug-vector.S#3 $
3
4 // Copyright (c) 2003-2004, 2006, 2010 Tensilica Inc.
5 //
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:
13 //
14 // The above copyright notice and this permission notice shall be included
15 // in all copies or substantial portions of the Software.
16 //
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.
24
25 #include <xtensa/coreasm.h>
26 #include <xtensa/config/specreg.h>
27 #ifdef SIMULATOR
28 #include <xtensa/simcall.h>
29 #endif
30
31 #if XCHAL_HAVE_DEBUG && XCHAL_HAVE_EXCEPTIONS
32
33         //  This code goes at the debug exception vector
34
35         .begin  literal_prefix  .DebugExceptionVector
36         .section                .DebugExceptionVector.text, "ax"
37         .align 4
38         .global _DebugExceptionVector
39 _DebugExceptionVector:
40
41 # ifdef SIMULATOR
42         //  In the simulator (ISS), let the debugger (if any is attached)
43         //  handle the debug exception, else simply stop the simulation:
44         //
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
48 # else
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.
53         //  
54 1:
55 #if XCHAL_HAVE_INTERRUPTS
56         waiti   XCHAL_DEBUGLEVEL        // unexpected debug exception, loop in low-power mode
57 #endif
58         j       1b              // infinite loop - unexpected debug exception
59 # endif /*!SIMULATOR*/
60
61         .end    literal_prefix
62         .size   _DebugExceptionVector, . - _DebugExceptionVector
63
64 #endif /* XCHAL_HAVE_DEBUG && XCHAL_HAVE_EXCEPTIONS */
65