1// double-vector.S -- Double Exception Vector 2// $Id: //depot/rel/Foxhill/dot.8/Xtensa/OS/xtos/double-vector.S#1 $ 3 4// Copyright (c) 2000-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/system.h> 27#ifdef SIMULATOR 28#include <xtensa/simcall.h> 29#endif 30 31 32#if XCHAL_HAVE_EXCEPTIONS && defined(XCHAL_DOUBLEEXC_VECTOR_VADDR) 33 34/* 35 * This is a very minimalist implementation of the double 36 * exception vector. For XEA2 configurations without a 37 * full MMU, this vector is only expected to be executed 38 * upon fatal errors (exceptions that occur within critical 39 * sections of exception vectors and handlers). 40 * 41 * For configurations with a full MMU (ie. with TLBs and 42 * auto-refill) and the windowed address registers option, 43 * a more complete version of this handler is necessary if: 44 * dynamic page mapping is implemented, and the stack 45 * can ever point to a dynamically mapped area. 46 * In this case, a double exception is a normal occurrence 47 * when a stack access within a window handler causes 48 * a TLB miss exception or other expected MMU fault. 49 * XTOS does not support this scenario, hence a minimalist 50 * double exception vector is sufficient. 51 */ 52 53 .begin literal_prefix .DoubleExceptionVector 54 .section .DoubleExceptionVector.text, "ax" 55 56 .align 4 57 .global _DoubleExceptionVector 58_DoubleExceptionVector: 59 60# if XCHAL_HAVE_DEBUG 611: break 1,4 // unhandled double exception 62# elif defined(SIMULATOR) 63 wsr.excsave1 a2 // save a2 where simulator expects it 64 movi a2, SYS_unhandled_double_exc 651: simcall // let simulator/debugger report unhandled exception 66# else 671: 68# endif 69 j 1b // infinite loop 70 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). 80 // For example: 81 // 82 // wsr.excsave1 a0 83 // movi a0, _DoubleExceptionFromVector 84 // jx a0 85 // 86 // .text 87 // .align 4 88 // .global _DoubleExceptionFromVector 89 //_DoubleExceptionFromVector: 90 // ... 91 92 93 .size _DoubleExceptionVector, . - _DoubleExceptionVector 94 .text 95 .end literal_prefix 96 97#endif /* have double exceptions */ 98 99