1 // double-vector.S -- Double Exception Vector
2 // $Id: //depot/rel/Cottonwood/Xtensa/OS/xtos/double-vector.S#3 $
4 // Copyright (c) 2000-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/system.h>
27 #include <xtensa/config/specreg.h>
29 #include <xtensa/simcall.h>
33 #if XCHAL_HAVE_EXCEPTIONS && defined(XCHAL_DOUBLEEXC_VECTOR_VADDR)
36 * This is a very minimalist implementation of the double
37 * exception vector. For XEA2 configurations without a
38 * full MMU, this vector is only expected to be executed
39 * upon fatal errors (exceptions that occur within critical
40 * sections of exception vectors and handlers).
42 * For configurations with a full MMU (ie. with TLBs and
43 * auto-refill) and the windowed address registers option,
44 * a more complete version of this handler is necessary if:
45 * dynamic page mapping is implemented, and the stack
46 * can ever point to a dynamically mapped area.
47 * In this case, a double exception is a normal occurrence
48 * when a stack access within a window handler causes
49 * a TLB miss exception or other expected MMU fault.
50 * XTOS does not support this scenario, hence a minimalist
51 * double exception vector is sufficient.
54 .begin literal_prefix .DoubleExceptionVector
55 .section .DoubleExceptionVector.text, "ax"
58 .global _DoubleExceptionVector
59 _DoubleExceptionVector:
61 1: break 1,4 // unhandled double exception
62 # elif defined(SIMULATOR)
63 wsr a2, EXCSAVE1 // save a2 where simulator expects it
64 movi a2, SYS_unhandled_double_exc
65 1: simcall // let simulator/debugger report unhandled exception
71 // NOTE: a non-minimalist vector may choose to
72 // process the double exception in the vector itself
73 // (by default, much more space is allocated to double
74 // exception vectors than to most other vectors);
75 // or, to jump to a double exception handler located
76 // elsewhere. If only the normal case of double
77 // exceptions occurring within a window handler is
78 // being handled, then it is safe to use EXCSAVE_1 to
79 // do this jump (window handlers don't use EXCSAVE_1).
83 // movi a0, _DoubleExceptionFromVector
88 // .global _DoubleExceptionFromVector
89 //_DoubleExceptionFromVector:
93 .size _DoubleExceptionVector, . - _DoubleExceptionVector
97 #endif /* have double exceptions */