2 * This header file contains assembly-language definitions (assembly
3 * macros, etc.) for this specific Xtensa processor's TIE extensions
4 * and options. It is customized to this Xtensa processor configuration.
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
10 * Copyright (C) 1999-2008 Tensilica Inc.
13 #ifndef _XTENSA_CORE_TIE_ASM_H
14 #define _XTENSA_CORE_TIE_ASM_H
16 /* Selection parameter values for save-area save/restore macros: */
18 #define XTHAL_SAS_TIE 0x0001 /* custom extension or coprocessor */
19 #define XTHAL_SAS_OPT 0x0002 /* optional (and not a coprocessor) */
20 /* Whether used automatically by compiler: */
21 #define XTHAL_SAS_NOCC 0x0004 /* not used by compiler w/o special opts/code */
22 #define XTHAL_SAS_CC 0x0008 /* used by compiler without special opts/code */
23 /* ABI handling across function calls: */
24 #define XTHAL_SAS_CALR 0x0010 /* caller-saved */
25 #define XTHAL_SAS_CALE 0x0020 /* callee-saved */
26 #define XTHAL_SAS_GLOB 0x0040 /* global across function calls (in thread) */
28 #define XTHAL_SAS_ALL 0xFFFF /* include all default NCP contents */
32 /* Macro to save all non-coprocessor (extra) custom TIE and optional state
33 * (not including zero-overhead loop registers).
34 * Save area ptr (clobbered): ptr (16 byte aligned)
35 * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed)
37 .macro xchal_ncp_store ptr at1 at2 at3 at4
continue=0 ofs
=-1 select
=XTHAL_SAS_ALL
38 xchal_sa_start \
continue, \ofs
39 .ifeq (XTHAL_SAS_OPT
| XTHAL_SAS_NOCC
| XTHAL_SAS_CALR
) & ~\select
40 xchal_sa_align \ptr
, 0, 1024-4, 4, 4
41 rsr
\at
1, BR
// boolean option
42 s32i
\at
1, \ptr
, .Lxchal_ofs_
+ 0
43 .set
.Lxchal_ofs_
, .Lxchal_ofs_
+ 4
45 .endm
// xchal_ncp_store
47 /* Macro to save all non-coprocessor (extra) custom TIE and optional state
48 * (not including zero-overhead loop registers).
49 * Save area ptr (clobbered): ptr (16 byte aligned)
50 * Scratch regs (clobbered): at1..at4 (only first XCHAL_NCP_NUM_ATMPS needed)
52 .macro xchal_ncp_load ptr at1 at2 at3 at4
continue=0 ofs
=-1 select
=XTHAL_SAS_ALL
53 xchal_sa_start \
continue, \ofs
54 .ifeq (XTHAL_SAS_OPT
| XTHAL_SAS_NOCC
| XTHAL_SAS_CALR
) & ~\select
55 xchal_sa_align \ptr
, 0, 1024-4, 4, 4
56 l32i
\at
1, \ptr
, .Lxchal_ofs_
+ 0
57 wsr
\at
1, BR
// boolean option
58 .set
.Lxchal_ofs_
, .Lxchal_ofs_
+ 4
60 .endm
// xchal_ncp_load
64 #define XCHAL_NCP_NUM_ATMPS 1
68 /* Macro to save the state of TIE coprocessor FPU.
69 * Save area ptr (clobbered): ptr (16 byte aligned)
70 * Scratch regs (clobbered): at1..at4 (only first XCHAL_CP0_NUM_ATMPS needed)
72 #define xchal_cp_FPU_store xchal_cp0_store
73 /* #define xchal_cp_FPU_store_a2 xchal_cp0_store a2 a3 a4 a5 a6 */
74 .macro xchal_cp0_store ptr at1 at2 at3 at4
continue=0 ofs
=-1 select
=XTHAL_SAS_ALL
75 xchal_sa_start \
continue, \ofs
76 .ifeq (XTHAL_SAS_TIE
| XTHAL_SAS_NOCC
| XTHAL_SAS_CALR
) & ~\select
77 xchal_sa_align \ptr
, 0, 0, 1, 16
98 .set
.Lxchal_ofs_
, .Lxchal_ofs_
+ 72
100 .endm
// xchal_cp0_store
102 /* Macro to restore the state of TIE coprocessor FPU.
103 * Save area ptr (clobbered): ptr (16 byte aligned)
104 * Scratch regs (clobbered): at1..at4 (only first XCHAL_CP0_NUM_ATMPS needed)
106 #define xchal_cp_FPU_load xchal_cp0_load
107 /* #define xchal_cp_FPU_load_a2 xchal_cp0_load a2 a3 a4 a5 a6 */
108 .macro xchal_cp0_load ptr at1 at2 at3 at4
continue=0 ofs
=-1 select
=XTHAL_SAS_ALL
109 xchal_sa_start \
continue, \ofs
110 .ifeq (XTHAL_SAS_TIE
| XTHAL_SAS_NOCC
| XTHAL_SAS_CALR
) & ~\select
111 xchal_sa_align \ptr
, 0, 0, 1, 16
132 .set
.Lxchal_ofs_
, .Lxchal_ofs_
+ 72
134 .endm
// xchal_cp0_load
136 #define XCHAL_CP0_NUM_ATMPS 1
138 /* Macro to save the state of TIE coprocessor XAD.
139 * Save area ptr (clobbered): ptr (16 byte aligned)
140 * Scratch regs (clobbered): at1..at4 (only first XCHAL_CP6_NUM_ATMPS needed)
142 #define xchal_cp_XAD_store xchal_cp6_store
143 /* #define xchal_cp_XAD_store_a2 xchal_cp6_store a2 a3 a4 a5 a6 */
144 .macro xchal_cp6_store ptr at1 at2 at3 at4
continue=0 ofs
=-1 select
=XTHAL_SAS_ALL
145 xchal_sa_start \
continue, \ofs
146 .ifeq (XTHAL_SAS_TIE
| XTHAL_SAS_NOCC
| XTHAL_SAS_CALR
) & ~\select
147 xchal_sa_align \ptr
, 0, 0, 1, 16
156 rur8
\at
1 // LDBRBASE
160 rur10
\at
1 // LDBRINC
162 rur11
\at
1 // STBRBASE
164 rur12
\at
1 // STBROFF
166 rur13
\at
1 // STBRINC
168 rur24
\at
1 // SCRATCH0
170 rur25
\at
1 // SCRATCH1
172 rur26
\at
1 // SCRATCH2
174 rur27
\at
1 // SCRATCH3
176 WRAS128I wra0
, \ptr
, 64
177 WRAS128I wra1
, \ptr
, 80
178 WRAS128I wra2
, \ptr
, 96
179 WRAS128I wra3
, \ptr
, 112
180 WRAS128I wra4
, \ptr
, 128
181 WRAS128I wra5
, \ptr
, 144
182 WRAS128I wra6
, \ptr
, 160
183 WRAS128I wra7
, \ptr
, 176
184 WRAS128I wra8
, \ptr
, 192
185 WRAS128I wra9
, \ptr
, 208
186 WRAS128I wra10
, \ptr
, 224
187 WRAS128I wra11
, \ptr
, 240
188 WRAS128I wra12
, \ptr
, 256
189 WRAS128I wra13
, \ptr
, 272
190 WRAS128I wra14
, \ptr
, 288
191 WRAS128I wra15
, \ptr
, 304
192 WRBS128I wrb0
, \ptr
, 320
193 WRBS128I wrb1
, \ptr
, 336
194 WRBS128I wrb2
, \ptr
, 352
195 WRBS128I wrb3
, \ptr
, 368
196 WRBS128I wrb4
, \ptr
, 384
197 WRBS128I wrb5
, \ptr
, 400
198 WRBS128I wrb6
, \ptr
, 416
199 WRBS128I wrb7
, \ptr
, 432
200 WRBS128I wrb8
, \ptr
, 448
201 WRBS128I wrb9
, \ptr
, 464
202 WRBS128I wrb10
, \ptr
, 480
203 WRBS128I wrb11
, \ptr
, 496
204 WRBS128I wrb12
, \ptr
, 512
205 WRBS128I wrb13
, \ptr
, 528
206 WRBS128I wrb14
, \ptr
, 544
207 WRBS128I wrb15
, \ptr
, 560
208 .set
.Lxchal_ofs_
, .Lxchal_ofs_
+ 576
210 .endm
// xchal_cp6_store
212 /* Macro to restore the state of TIE coprocessor XAD.
213 * Save area ptr (clobbered): ptr (16 byte aligned)
214 * Scratch regs (clobbered): at1..at4 (only first XCHAL_CP6_NUM_ATMPS needed)
216 #define xchal_cp_XAD_load xchal_cp6_load
217 /* #define xchal_cp_XAD_load_a2 xchal_cp6_load a2 a3 a4 a5 a6 */
218 .macro xchal_cp6_load ptr at1 at2 at3 at4
continue=0 ofs
=-1 select
=XTHAL_SAS_ALL
219 xchal_sa_start \
continue, \ofs
220 .ifeq (XTHAL_SAS_TIE
| XTHAL_SAS_NOCC
| XTHAL_SAS_CALR
) & ~\select
221 xchal_sa_align \ptr
, 0, 0, 1, 16
231 wur8
\at
1 // LDBRBASE
235 wur10
\at
1 // LDBRINC
237 wur11
\at
1 // STBRBASE
239 wur12
\at
1 // STBROFF
241 wur13
\at
1 // STBRINC
243 wur24
\at
1 // SCRATCH0
245 wur25
\at
1 // SCRATCH1
247 wur26
\at
1 // SCRATCH2
249 wur27
\at
1 // SCRATCH3
250 WRBL128I wrb0
, \ptr
, 320
251 WRBL128I wrb1
, \ptr
, 336
252 WRBL128I wrb2
, \ptr
, 352
253 WRBL128I wrb3
, \ptr
, 368
254 WRBL128I wrb4
, \ptr
, 384
255 WRBL128I wrb5
, \ptr
, 400
256 WRBL128I wrb6
, \ptr
, 416
257 WRBL128I wrb7
, \ptr
, 432
258 WRBL128I wrb8
, \ptr
, 448
259 WRBL128I wrb9
, \ptr
, 464
260 WRBL128I wrb10
, \ptr
, 480
261 WRBL128I wrb11
, \ptr
, 496
262 WRBL128I wrb12
, \ptr
, 512
263 WRBL128I wrb13
, \ptr
, 528
264 WRBL128I wrb14
, \ptr
, 544
265 WRBL128I wrb15
, \ptr
, 560
266 WRAL128I wra0
, \ptr
, 64
267 WRAL128I wra1
, \ptr
, 80
268 WRAL128I wra2
, \ptr
, 96
269 WRAL128I wra3
, \ptr
, 112
270 WRAL128I wra4
, \ptr
, 128
271 WRAL128I wra5
, \ptr
, 144
272 WRAL128I wra6
, \ptr
, 160
273 WRAL128I wra7
, \ptr
, 176
274 WRAL128I wra8
, \ptr
, 192
275 WRAL128I wra9
, \ptr
, 208
276 WRAL128I wra10
, \ptr
, 224
277 WRAL128I wra11
, \ptr
, 240
278 WRAL128I wra12
, \ptr
, 256
279 WRAL128I wra13
, \ptr
, 272
280 WRAL128I wra14
, \ptr
, 288
281 WRAL128I wra15
, \ptr
, 304
282 .set
.Lxchal_ofs_
, .Lxchal_ofs_
+ 576
284 .endm
// xchal_cp6_load
286 #define XCHAL_CP6_NUM_ATMPS 1
287 #define XCHAL_SA_NUM_ATMPS 1
289 /* Empty macros for unconfigured coprocessors: */
290 .macro xchal_cp1_store p a b c d
continue=0 ofs
=-1 select
=-1 ; .endm
291 .macro xchal_cp1_load p a b c d
continue=0 ofs
=-1 select
=-1 ; .endm
292 .macro xchal_cp2_store p a b c d
continue=0 ofs
=-1 select
=-1 ; .endm
293 .macro xchal_cp2_load p a b c d
continue=0 ofs
=-1 select
=-1 ; .endm
294 .macro xchal_cp3_store p a b c d
continue=0 ofs
=-1 select
=-1 ; .endm
295 .macro xchal_cp3_load p a b c d
continue=0 ofs
=-1 select
=-1 ; .endm
296 .macro xchal_cp4_store p a b c d
continue=0 ofs
=-1 select
=-1 ; .endm
297 .macro xchal_cp4_load p a b c d
continue=0 ofs
=-1 select
=-1 ; .endm
298 .macro xchal_cp5_store p a b c d
continue=0 ofs
=-1 select
=-1 ; .endm
299 .macro xchal_cp5_load p a b c d
continue=0 ofs
=-1 select
=-1 ; .endm
300 .macro xchal_cp7_store p a b c d
continue=0 ofs
=-1 select
=-1 ; .endm
301 .macro xchal_cp7_load p a b c d
continue=0 ofs
=-1 select
=-1 ; .endm
303 #endif /*_XTENSA_CORE_TIE_ASM_H*/