1// reloc-vector.S  -  Relocatable Vectors section
2// $Id: //depot/rel/Foxhill/dot.8/Xtensa/OS/xtos/xea2/reloc-vectors.S#1 $
3
4// Copyright (c) 2007-2017 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/*
26 *  This file is only used if the relocatable vectors option is enabled.
27 */
28
29
30#include <xtensa/coreasm.h>
31#include <xtensa/config/system.h>
32
33#if XCHAL_HAVE_VECBASE
34
35	.section	.RelocatableVectors.text, "ax"
36
37	.global	_RelocVectors
38_RelocVectors:
39
40//if XCHAL_RESET_VECBASE_OVERLAP ...
41# if XSHAL_VECTORS_PACKED \
42  && (XCHAL_RESET_VECTOR0_VADDR == XCHAL_VECBASE_RESET_VADDR \
43   || XCHAL_RESET_VECTOR1_VADDR == XCHAL_VECBASE_RESET_VADDR)
44#  define JUMP_TO_RESET	1
45	j	.Ljump_to_reset
46# endif
47
48# if XCHAL_HAVE_WINDOWED
49#  define NO_SECTION_DIRECTIVES	1
50#  define WINDOW_BASE_VECOFS	0
51#  include "window-vectors.S"
52# endif
53
54#if XCHAL_HAVE_DEBUG && XCHAL_HAVE_EXCEPTIONS
55# if XCHAL_DEBUGLEVEL == 2
56#  define _Level2Vector	_DebugExceptionVector
57# elif XCHAL_DEBUGLEVEL == 3
58#  define _Level3Vector	_DebugExceptionVector
59# elif XCHAL_DEBUGLEVEL == 4
60#  define _Level4Vector	_DebugExceptionVector
61# elif XCHAL_DEBUGLEVEL == 5
62#  define _Level5Vector	_DebugExceptionVector
63# elif XCHAL_DEBUGLEVEL == 6
64#  define _Level6Vector	_DebugExceptionVector
65# endif
66#endif
67
68# if XCHAL_HAVE_INTERRUPTS
69#  if XCHAL_NUM_INTLEVELS >= 2
70	.org	XCHAL_INTLEVEL2_VECOFS
71	j	_Level2Vector
72#  endif
73#  if XCHAL_NUM_INTLEVELS >= 3
74	.org	XCHAL_INTLEVEL3_VECOFS
75	j	_Level3Vector
76#  endif
77#  if XCHAL_NUM_INTLEVELS >= 4
78	.org	XCHAL_INTLEVEL4_VECOFS
79	j	_Level4Vector
80#  endif
81#  if XCHAL_NUM_INTLEVELS >= 5
82	.org	XCHAL_INTLEVEL5_VECOFS
83	j	_Level5Vector
84#  endif
85#  if XCHAL_NUM_INTLEVELS >= 6
86	.org	XCHAL_INTLEVEL6_VECOFS
87	j	_Level6Vector
88#  endif
89#  if XCHAL_HAVE_NMI
90	.org	XCHAL_NMI_VECOFS
91	j	_NMIExceptionVector
92#  endif
93# endif
94# if XCHAL_HAVE_EXCEPTIONS
95	.org	XCHAL_KERNEL_VECOFS
96	j	_KernelExceptionVector
97	.org	XCHAL_USER_VECOFS
98	j	_UserExceptionVector
99	.org	XCHAL_DOUBLEEXC_VECOFS
100	j	_DoubleExceptionVector
101# endif
102
103//	Put literals here.
104
105//	Put actual handlers here.
106
107# if JUMP_TO_RESET
108	.align	4
109	.literal	rvec, _ResetVector
110.Ljump_to_reset:
111	l32r	a2, rvec
112	jx	a2
113# endif
114
115	.size	_RelocVectors, . - _RelocVectors
116
117	.text
118
119#endif /* XCHAL_HAVE_VECBASE */
120
121