3 * http://www.tensilica.com/products/literature-docs/documentation/xtensa-isa-databook.htm
5 * Copyright (c) 2011, Max Filippov, Open Source and Linux Lab.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * * Neither the name of the Open Source and Linux Lab nor the
16 * names of its contributors may be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include "qemu/osdep.h"
34 #include "exec/exec-all.h"
35 #include "disas/disas.h"
38 #include "sysemu/sysemu.h"
39 #include "exec/cpu_ldst.h"
40 #include "exec/semihost.h"
41 #include "exec/translator.h"
43 #include "exec/helper-proto.h"
44 #include "exec/helper-gen.h"
46 #include "trace-tcg.h"
51 DisasContextBase base
;
52 const XtensaConfig
*config
;
61 bool sar_m32_allocated
;
75 xtensa_insnbuf insnbuf
;
76 xtensa_insnbuf slotbuf
;
79 static TCGv_i32 cpu_pc
;
80 static TCGv_i32 cpu_R
[16];
81 static TCGv_i32 cpu_FR
[16];
82 static TCGv_i32 cpu_SR
[256];
83 static TCGv_i32 cpu_UR
[256];
85 #include "exec/gen-icount.h"
87 typedef struct XtensaReg
{
99 #define XTENSA_REG_ACCESS(regname, opt, acc) { \
101 .opt_bits = XTENSA_OPTION_BIT(opt), \
105 #define XTENSA_REG(regname, opt) XTENSA_REG_ACCESS(regname, opt, SR_RWX)
107 #define XTENSA_REG_BITS_ACCESS(regname, opt, acc) { \
113 #define XTENSA_REG_BITS(regname, opt) \
114 XTENSA_REG_BITS_ACCESS(regname, opt, SR_RWX)
116 static const XtensaReg sregnames
[256] = {
117 [LBEG
] = XTENSA_REG("LBEG", XTENSA_OPTION_LOOP
),
118 [LEND
] = XTENSA_REG("LEND", XTENSA_OPTION_LOOP
),
119 [LCOUNT
] = XTENSA_REG("LCOUNT", XTENSA_OPTION_LOOP
),
120 [SAR
] = XTENSA_REG_BITS("SAR", XTENSA_OPTION_ALL
),
121 [BR
] = XTENSA_REG("BR", XTENSA_OPTION_BOOLEAN
),
122 [LITBASE
] = XTENSA_REG("LITBASE", XTENSA_OPTION_EXTENDED_L32R
),
123 [SCOMPARE1
] = XTENSA_REG("SCOMPARE1", XTENSA_OPTION_CONDITIONAL_STORE
),
124 [ACCLO
] = XTENSA_REG("ACCLO", XTENSA_OPTION_MAC16
),
125 [ACCHI
] = XTENSA_REG("ACCHI", XTENSA_OPTION_MAC16
),
126 [MR
] = XTENSA_REG("MR0", XTENSA_OPTION_MAC16
),
127 [MR
+ 1] = XTENSA_REG("MR1", XTENSA_OPTION_MAC16
),
128 [MR
+ 2] = XTENSA_REG("MR2", XTENSA_OPTION_MAC16
),
129 [MR
+ 3] = XTENSA_REG("MR3", XTENSA_OPTION_MAC16
),
130 [WINDOW_BASE
] = XTENSA_REG("WINDOW_BASE", XTENSA_OPTION_WINDOWED_REGISTER
),
131 [WINDOW_START
] = XTENSA_REG("WINDOW_START",
132 XTENSA_OPTION_WINDOWED_REGISTER
),
133 [PTEVADDR
] = XTENSA_REG("PTEVADDR", XTENSA_OPTION_MMU
),
134 [MMID
] = XTENSA_REG_BITS("MMID", XTENSA_OPTION_ALL
),
135 [RASID
] = XTENSA_REG("RASID", XTENSA_OPTION_MMU
),
136 [ITLBCFG
] = XTENSA_REG("ITLBCFG", XTENSA_OPTION_MMU
),
137 [DTLBCFG
] = XTENSA_REG("DTLBCFG", XTENSA_OPTION_MMU
),
138 [IBREAKENABLE
] = XTENSA_REG("IBREAKENABLE", XTENSA_OPTION_DEBUG
),
139 [MEMCTL
] = XTENSA_REG_BITS("MEMCTL", XTENSA_OPTION_ALL
),
140 [CACHEATTR
] = XTENSA_REG("CACHEATTR", XTENSA_OPTION_CACHEATTR
),
141 [ATOMCTL
] = XTENSA_REG("ATOMCTL", XTENSA_OPTION_ATOMCTL
),
142 [DDR
] = XTENSA_REG("DDR", XTENSA_OPTION_DEBUG
),
143 [IBREAKA
] = XTENSA_REG("IBREAKA0", XTENSA_OPTION_DEBUG
),
144 [IBREAKA
+ 1] = XTENSA_REG("IBREAKA1", XTENSA_OPTION_DEBUG
),
145 [DBREAKA
] = XTENSA_REG("DBREAKA0", XTENSA_OPTION_DEBUG
),
146 [DBREAKA
+ 1] = XTENSA_REG("DBREAKA1", XTENSA_OPTION_DEBUG
),
147 [DBREAKC
] = XTENSA_REG("DBREAKC0", XTENSA_OPTION_DEBUG
),
148 [DBREAKC
+ 1] = XTENSA_REG("DBREAKC1", XTENSA_OPTION_DEBUG
),
149 [CONFIGID0
] = XTENSA_REG_BITS_ACCESS("CONFIGID0", XTENSA_OPTION_ALL
, SR_R
),
150 [EPC1
] = XTENSA_REG("EPC1", XTENSA_OPTION_EXCEPTION
),
151 [EPC1
+ 1] = XTENSA_REG("EPC2", XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
152 [EPC1
+ 2] = XTENSA_REG("EPC3", XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
153 [EPC1
+ 3] = XTENSA_REG("EPC4", XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
154 [EPC1
+ 4] = XTENSA_REG("EPC5", XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
155 [EPC1
+ 5] = XTENSA_REG("EPC6", XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
156 [EPC1
+ 6] = XTENSA_REG("EPC7", XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
157 [DEPC
] = XTENSA_REG("DEPC", XTENSA_OPTION_EXCEPTION
),
158 [EPS2
] = XTENSA_REG("EPS2", XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
159 [EPS2
+ 1] = XTENSA_REG("EPS3", XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
160 [EPS2
+ 2] = XTENSA_REG("EPS4", XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
161 [EPS2
+ 3] = XTENSA_REG("EPS5", XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
162 [EPS2
+ 4] = XTENSA_REG("EPS6", XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
163 [EPS2
+ 5] = XTENSA_REG("EPS7", XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
164 [CONFIGID1
] = XTENSA_REG_BITS_ACCESS("CONFIGID1", XTENSA_OPTION_ALL
, SR_R
),
165 [EXCSAVE1
] = XTENSA_REG("EXCSAVE1", XTENSA_OPTION_EXCEPTION
),
166 [EXCSAVE1
+ 1] = XTENSA_REG("EXCSAVE2",
167 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
168 [EXCSAVE1
+ 2] = XTENSA_REG("EXCSAVE3",
169 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
170 [EXCSAVE1
+ 3] = XTENSA_REG("EXCSAVE4",
171 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
172 [EXCSAVE1
+ 4] = XTENSA_REG("EXCSAVE5",
173 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
174 [EXCSAVE1
+ 5] = XTENSA_REG("EXCSAVE6",
175 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
176 [EXCSAVE1
+ 6] = XTENSA_REG("EXCSAVE7",
177 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
),
178 [CPENABLE
] = XTENSA_REG("CPENABLE", XTENSA_OPTION_COPROCESSOR
),
179 [INTSET
] = XTENSA_REG_ACCESS("INTSET", XTENSA_OPTION_INTERRUPT
, SR_RW
),
180 [INTCLEAR
] = XTENSA_REG_ACCESS("INTCLEAR", XTENSA_OPTION_INTERRUPT
, SR_W
),
181 [INTENABLE
] = XTENSA_REG("INTENABLE", XTENSA_OPTION_INTERRUPT
),
182 [PS
] = XTENSA_REG_BITS("PS", XTENSA_OPTION_ALL
),
183 [VECBASE
] = XTENSA_REG("VECBASE", XTENSA_OPTION_RELOCATABLE_VECTOR
),
184 [EXCCAUSE
] = XTENSA_REG("EXCCAUSE", XTENSA_OPTION_EXCEPTION
),
185 [DEBUGCAUSE
] = XTENSA_REG_ACCESS("DEBUGCAUSE", XTENSA_OPTION_DEBUG
, SR_R
),
186 [CCOUNT
] = XTENSA_REG("CCOUNT", XTENSA_OPTION_TIMER_INTERRUPT
),
187 [PRID
] = XTENSA_REG_ACCESS("PRID", XTENSA_OPTION_PROCESSOR_ID
, SR_R
),
188 [ICOUNT
] = XTENSA_REG("ICOUNT", XTENSA_OPTION_DEBUG
),
189 [ICOUNTLEVEL
] = XTENSA_REG("ICOUNTLEVEL", XTENSA_OPTION_DEBUG
),
190 [EXCVADDR
] = XTENSA_REG("EXCVADDR", XTENSA_OPTION_EXCEPTION
),
191 [CCOMPARE
] = XTENSA_REG("CCOMPARE0", XTENSA_OPTION_TIMER_INTERRUPT
),
192 [CCOMPARE
+ 1] = XTENSA_REG("CCOMPARE1",
193 XTENSA_OPTION_TIMER_INTERRUPT
),
194 [CCOMPARE
+ 2] = XTENSA_REG("CCOMPARE2",
195 XTENSA_OPTION_TIMER_INTERRUPT
),
196 [MISC
] = XTENSA_REG("MISC0", XTENSA_OPTION_MISC_SR
),
197 [MISC
+ 1] = XTENSA_REG("MISC1", XTENSA_OPTION_MISC_SR
),
198 [MISC
+ 2] = XTENSA_REG("MISC2", XTENSA_OPTION_MISC_SR
),
199 [MISC
+ 3] = XTENSA_REG("MISC3", XTENSA_OPTION_MISC_SR
),
202 static const XtensaReg uregnames
[256] = {
203 [EXPSTATE
] = XTENSA_REG_BITS("EXPSTATE", XTENSA_OPTION_ALL
),
204 [THREADPTR
] = XTENSA_REG("THREADPTR", XTENSA_OPTION_THREAD_POINTER
),
205 [FCR
] = XTENSA_REG("FCR", XTENSA_OPTION_FP_COPROCESSOR
),
206 [FSR
] = XTENSA_REG("FSR", XTENSA_OPTION_FP_COPROCESSOR
),
209 void xtensa_translate_init(void)
211 static const char * const regnames
[] = {
212 "ar0", "ar1", "ar2", "ar3",
213 "ar4", "ar5", "ar6", "ar7",
214 "ar8", "ar9", "ar10", "ar11",
215 "ar12", "ar13", "ar14", "ar15",
217 static const char * const fregnames
[] = {
218 "f0", "f1", "f2", "f3",
219 "f4", "f5", "f6", "f7",
220 "f8", "f9", "f10", "f11",
221 "f12", "f13", "f14", "f15",
225 cpu_pc
= tcg_global_mem_new_i32(cpu_env
,
226 offsetof(CPUXtensaState
, pc
), "pc");
228 for (i
= 0; i
< 16; i
++) {
229 cpu_R
[i
] = tcg_global_mem_new_i32(cpu_env
,
230 offsetof(CPUXtensaState
, regs
[i
]),
234 for (i
= 0; i
< 16; i
++) {
235 cpu_FR
[i
] = tcg_global_mem_new_i32(cpu_env
,
236 offsetof(CPUXtensaState
, fregs
[i
].f32
[FP_F32_LOW
]),
240 for (i
= 0; i
< 256; ++i
) {
241 if (sregnames
[i
].name
) {
242 cpu_SR
[i
] = tcg_global_mem_new_i32(cpu_env
,
243 offsetof(CPUXtensaState
, sregs
[i
]),
248 for (i
= 0; i
< 256; ++i
) {
249 if (uregnames
[i
].name
) {
250 cpu_UR
[i
] = tcg_global_mem_new_i32(cpu_env
,
251 offsetof(CPUXtensaState
, uregs
[i
]),
257 static inline bool option_enabled(DisasContext
*dc
, int opt
)
259 return xtensa_option_enabled(dc
->config
, opt
);
262 static void init_sar_tracker(DisasContext
*dc
)
264 dc
->sar_5bit
= false;
265 dc
->sar_m32_5bit
= false;
266 dc
->sar_m32_allocated
= false;
269 static void reset_sar_tracker(DisasContext
*dc
)
271 if (dc
->sar_m32_allocated
) {
272 tcg_temp_free(dc
->sar_m32
);
276 static void gen_right_shift_sar(DisasContext
*dc
, TCGv_i32 sa
)
278 tcg_gen_andi_i32(cpu_SR
[SAR
], sa
, 0x1f);
279 if (dc
->sar_m32_5bit
) {
280 tcg_gen_discard_i32(dc
->sar_m32
);
283 dc
->sar_m32_5bit
= false;
286 static void gen_left_shift_sar(DisasContext
*dc
, TCGv_i32 sa
)
288 TCGv_i32 tmp
= tcg_const_i32(32);
289 if (!dc
->sar_m32_allocated
) {
290 dc
->sar_m32
= tcg_temp_local_new_i32();
291 dc
->sar_m32_allocated
= true;
293 tcg_gen_andi_i32(dc
->sar_m32
, sa
, 0x1f);
294 tcg_gen_sub_i32(cpu_SR
[SAR
], tmp
, dc
->sar_m32
);
295 dc
->sar_5bit
= false;
296 dc
->sar_m32_5bit
= true;
300 static void gen_exception(DisasContext
*dc
, int excp
)
302 TCGv_i32 tmp
= tcg_const_i32(excp
);
303 gen_helper_exception(cpu_env
, tmp
);
307 static void gen_exception_cause(DisasContext
*dc
, uint32_t cause
)
309 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
310 TCGv_i32 tcause
= tcg_const_i32(cause
);
311 gen_helper_exception_cause(cpu_env
, tpc
, tcause
);
313 tcg_temp_free(tcause
);
314 if (cause
== ILLEGAL_INSTRUCTION_CAUSE
||
315 cause
== SYSCALL_CAUSE
) {
316 dc
->base
.is_jmp
= DISAS_NORETURN
;
320 static void gen_exception_cause_vaddr(DisasContext
*dc
, uint32_t cause
,
323 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
324 TCGv_i32 tcause
= tcg_const_i32(cause
);
325 gen_helper_exception_cause_vaddr(cpu_env
, tpc
, tcause
, vaddr
);
327 tcg_temp_free(tcause
);
330 static void gen_debug_exception(DisasContext
*dc
, uint32_t cause
)
332 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
333 TCGv_i32 tcause
= tcg_const_i32(cause
);
334 gen_helper_debug_exception(cpu_env
, tpc
, tcause
);
336 tcg_temp_free(tcause
);
337 if (cause
& (DEBUGCAUSE_IB
| DEBUGCAUSE_BI
| DEBUGCAUSE_BN
)) {
338 dc
->base
.is_jmp
= DISAS_NORETURN
;
342 static bool gen_check_privilege(DisasContext
*dc
)
344 #ifndef CONFIG_USER_ONLY
349 gen_exception_cause(dc
, PRIVILEGED_CAUSE
);
350 dc
->base
.is_jmp
= DISAS_NORETURN
;
354 static bool gen_check_cpenable(DisasContext
*dc
, uint32_t cp_mask
)
356 cp_mask
&= ~dc
->cpenable
;
358 if (option_enabled(dc
, XTENSA_OPTION_COPROCESSOR
) && cp_mask
) {
359 gen_exception_cause(dc
, COPROCESSOR0_DISABLED
+ ctz32(cp_mask
));
360 dc
->base
.is_jmp
= DISAS_NORETURN
;
366 static void gen_jump_slot(DisasContext
*dc
, TCGv dest
, int slot
)
368 tcg_gen_mov_i32(cpu_pc
, dest
);
370 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
372 if (dc
->base
.singlestep_enabled
) {
373 gen_exception(dc
, EXCP_DEBUG
);
376 tcg_gen_goto_tb(slot
);
377 tcg_gen_exit_tb(dc
->base
.tb
, slot
);
379 tcg_gen_exit_tb(NULL
, 0);
382 dc
->base
.is_jmp
= DISAS_NORETURN
;
385 static void gen_jump(DisasContext
*dc
, TCGv dest
)
387 gen_jump_slot(dc
, dest
, -1);
390 static void gen_jumpi(DisasContext
*dc
, uint32_t dest
, int slot
)
392 TCGv_i32 tmp
= tcg_const_i32(dest
);
393 #ifndef CONFIG_USER_ONLY
394 if (((dc
->base
.pc_first
^ dest
) & TARGET_PAGE_MASK
) != 0) {
398 gen_jump_slot(dc
, tmp
, slot
);
402 static void gen_callw_slot(DisasContext
*dc
, int callinc
, TCGv_i32 dest
,
405 TCGv_i32 tcallinc
= tcg_const_i32(callinc
);
407 tcg_gen_deposit_i32(cpu_SR
[PS
], cpu_SR
[PS
],
408 tcallinc
, PS_CALLINC_SHIFT
, PS_CALLINC_LEN
);
409 tcg_temp_free(tcallinc
);
410 tcg_gen_movi_i32(cpu_R
[callinc
<< 2],
411 (callinc
<< 30) | (dc
->base
.pc_next
& 0x3fffffff));
412 gen_jump_slot(dc
, dest
, slot
);
415 static void gen_callw(DisasContext
*dc
, int callinc
, TCGv_i32 dest
)
417 gen_callw_slot(dc
, callinc
, dest
, -1);
420 static void gen_callwi(DisasContext
*dc
, int callinc
, uint32_t dest
, int slot
)
422 TCGv_i32 tmp
= tcg_const_i32(dest
);
423 #ifndef CONFIG_USER_ONLY
424 if (((dc
->base
.pc_first
^ dest
) & TARGET_PAGE_MASK
) != 0) {
428 gen_callw_slot(dc
, callinc
, tmp
, slot
);
432 static bool gen_check_loop_end(DisasContext
*dc
, int slot
)
434 if (option_enabled(dc
, XTENSA_OPTION_LOOP
) &&
435 !(dc
->base
.tb
->flags
& XTENSA_TBFLAG_EXCM
) &&
436 dc
->base
.pc_next
== dc
->lend
) {
437 TCGLabel
*label
= gen_new_label();
439 tcg_gen_brcondi_i32(TCG_COND_EQ
, cpu_SR
[LCOUNT
], 0, label
);
440 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], cpu_SR
[LCOUNT
], 1);
441 gen_jumpi(dc
, dc
->lbeg
, slot
);
442 gen_set_label(label
);
443 gen_jumpi(dc
, dc
->base
.pc_next
, -1);
449 static void gen_jumpi_check_loop_end(DisasContext
*dc
, int slot
)
451 if (!gen_check_loop_end(dc
, slot
)) {
452 gen_jumpi(dc
, dc
->base
.pc_next
, slot
);
456 static void gen_brcond(DisasContext
*dc
, TCGCond cond
,
457 TCGv_i32 t0
, TCGv_i32 t1
, uint32_t addr
)
459 TCGLabel
*label
= gen_new_label();
461 tcg_gen_brcond_i32(cond
, t0
, t1
, label
);
462 gen_jumpi_check_loop_end(dc
, 0);
463 gen_set_label(label
);
464 gen_jumpi(dc
, addr
, 1);
467 static void gen_brcondi(DisasContext
*dc
, TCGCond cond
,
468 TCGv_i32 t0
, uint32_t t1
, uint32_t addr
)
470 TCGv_i32 tmp
= tcg_const_i32(t1
);
471 gen_brcond(dc
, cond
, t0
, tmp
, addr
);
475 static bool check_sr(DisasContext
*dc
, uint32_t sr
, unsigned access
)
477 if (!xtensa_option_bits_enabled(dc
->config
, sregnames
[sr
].opt_bits
)) {
478 if (sregnames
[sr
].name
) {
479 qemu_log_mask(LOG_GUEST_ERROR
, "SR %s is not configured\n", sregnames
[sr
].name
);
481 qemu_log_mask(LOG_UNIMP
, "SR %d is not implemented\n", sr
);
484 } else if (!(sregnames
[sr
].access
& access
)) {
485 static const char * const access_text
[] = {
490 assert(access
< ARRAY_SIZE(access_text
) && access_text
[access
]);
491 qemu_log_mask(LOG_GUEST_ERROR
, "SR %s is not available for %s\n", sregnames
[sr
].name
,
492 access_text
[access
]);
498 #ifndef CONFIG_USER_ONLY
499 static void gen_rsr_ccount(DisasContext
*dc
, TCGv_i32 d
, uint32_t sr
)
501 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
504 gen_helper_update_ccount(cpu_env
);
505 tcg_gen_mov_i32(d
, cpu_SR
[sr
]);
506 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
511 static void gen_rsr_ptevaddr(DisasContext
*dc
, TCGv_i32 d
, uint32_t sr
)
513 tcg_gen_shri_i32(d
, cpu_SR
[EXCVADDR
], 10);
514 tcg_gen_or_i32(d
, d
, cpu_SR
[sr
]);
515 tcg_gen_andi_i32(d
, d
, 0xfffffffc);
519 static void gen_rsr(DisasContext
*dc
, TCGv_i32 d
, uint32_t sr
)
521 static void (* const rsr_handler
[256])(DisasContext
*dc
,
522 TCGv_i32 d
, uint32_t sr
) = {
523 #ifndef CONFIG_USER_ONLY
524 [CCOUNT
] = gen_rsr_ccount
,
525 [INTSET
] = gen_rsr_ccount
,
526 [PTEVADDR
] = gen_rsr_ptevaddr
,
530 if (rsr_handler
[sr
]) {
531 rsr_handler
[sr
](dc
, d
, sr
);
533 tcg_gen_mov_i32(d
, cpu_SR
[sr
]);
537 static void gen_wsr_lbeg(DisasContext
*dc
, uint32_t sr
, TCGv_i32 s
)
539 gen_helper_wsr_lbeg(cpu_env
, s
);
542 static void gen_wsr_lend(DisasContext
*dc
, uint32_t sr
, TCGv_i32 s
)
544 gen_helper_wsr_lend(cpu_env
, s
);
547 static void gen_wsr_sar(DisasContext
*dc
, uint32_t sr
, TCGv_i32 s
)
549 tcg_gen_andi_i32(cpu_SR
[sr
], s
, 0x3f);
550 if (dc
->sar_m32_5bit
) {
551 tcg_gen_discard_i32(dc
->sar_m32
);
553 dc
->sar_5bit
= false;
554 dc
->sar_m32_5bit
= false;
557 static void gen_wsr_br(DisasContext
*dc
, uint32_t sr
, TCGv_i32 s
)
559 tcg_gen_andi_i32(cpu_SR
[sr
], s
, 0xffff);
562 static void gen_wsr_litbase(DisasContext
*dc
, uint32_t sr
, TCGv_i32 s
)
564 tcg_gen_andi_i32(cpu_SR
[sr
], s
, 0xfffff001);
567 static void gen_wsr_acchi(DisasContext
*dc
, uint32_t sr
, TCGv_i32 s
)
569 tcg_gen_ext8s_i32(cpu_SR
[sr
], s
);
572 #ifndef CONFIG_USER_ONLY
573 static void gen_wsr_windowbase(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
575 gen_helper_wsr_windowbase(cpu_env
, v
);
578 static void gen_wsr_windowstart(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
580 tcg_gen_andi_i32(cpu_SR
[sr
], v
, (1 << dc
->config
->nareg
/ 4) - 1);
583 static void gen_wsr_ptevaddr(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
585 tcg_gen_andi_i32(cpu_SR
[sr
], v
, 0xffc00000);
588 static void gen_wsr_rasid(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
590 gen_helper_wsr_rasid(cpu_env
, v
);
593 static void gen_wsr_tlbcfg(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
595 tcg_gen_andi_i32(cpu_SR
[sr
], v
, 0x01130000);
598 static void gen_wsr_ibreakenable(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
600 gen_helper_wsr_ibreakenable(cpu_env
, v
);
603 static void gen_wsr_memctl(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
605 gen_helper_wsr_memctl(cpu_env
, v
);
608 static void gen_wsr_atomctl(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
610 tcg_gen_andi_i32(cpu_SR
[sr
], v
, 0x3f);
613 static void gen_wsr_ibreaka(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
615 unsigned id
= sr
- IBREAKA
;
616 TCGv_i32 tmp
= tcg_const_i32(id
);
618 assert(id
< dc
->config
->nibreak
);
619 gen_helper_wsr_ibreaka(cpu_env
, tmp
, v
);
623 static void gen_wsr_dbreaka(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
625 unsigned id
= sr
- DBREAKA
;
626 TCGv_i32 tmp
= tcg_const_i32(id
);
628 assert(id
< dc
->config
->ndbreak
);
629 gen_helper_wsr_dbreaka(cpu_env
, tmp
, v
);
633 static void gen_wsr_dbreakc(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
635 unsigned id
= sr
- DBREAKC
;
636 TCGv_i32 tmp
= tcg_const_i32(id
);
638 assert(id
< dc
->config
->ndbreak
);
639 gen_helper_wsr_dbreakc(cpu_env
, tmp
, v
);
643 static void gen_wsr_cpenable(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
645 tcg_gen_andi_i32(cpu_SR
[sr
], v
, 0xff);
648 static void gen_check_interrupts(DisasContext
*dc
)
650 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
653 gen_helper_check_interrupts(cpu_env
);
654 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
659 static void gen_wsr_intset(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
661 tcg_gen_andi_i32(cpu_SR
[sr
], v
,
662 dc
->config
->inttype_mask
[INTTYPE_SOFTWARE
]);
665 static void gen_wsr_intclear(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
667 TCGv_i32 tmp
= tcg_temp_new_i32();
669 tcg_gen_andi_i32(tmp
, v
,
670 dc
->config
->inttype_mask
[INTTYPE_EDGE
] |
671 dc
->config
->inttype_mask
[INTTYPE_NMI
] |
672 dc
->config
->inttype_mask
[INTTYPE_SOFTWARE
]);
673 tcg_gen_andc_i32(cpu_SR
[INTSET
], cpu_SR
[INTSET
], tmp
);
677 static void gen_wsr_intenable(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
679 tcg_gen_mov_i32(cpu_SR
[sr
], v
);
682 static void gen_wsr_ps(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
684 uint32_t mask
= PS_WOE
| PS_CALLINC
| PS_OWB
|
685 PS_UM
| PS_EXCM
| PS_INTLEVEL
;
687 if (option_enabled(dc
, XTENSA_OPTION_MMU
)) {
690 tcg_gen_andi_i32(cpu_SR
[sr
], v
, mask
);
693 static void gen_wsr_ccount(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
695 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
698 gen_helper_wsr_ccount(cpu_env
, v
);
699 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
704 static void gen_wsr_icount(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
707 tcg_gen_mov_i32(dc
->next_icount
, v
);
709 tcg_gen_mov_i32(cpu_SR
[sr
], v
);
713 static void gen_wsr_icountlevel(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
715 tcg_gen_andi_i32(cpu_SR
[sr
], v
, 0xf);
718 static void gen_wsr_ccompare(DisasContext
*dc
, uint32_t sr
, TCGv_i32 v
)
720 uint32_t id
= sr
- CCOMPARE
;
721 uint32_t int_bit
= 1 << dc
->config
->timerint
[id
];
722 TCGv_i32 tmp
= tcg_const_i32(id
);
724 assert(id
< dc
->config
->nccompare
);
725 tcg_gen_mov_i32(cpu_SR
[sr
], v
);
726 tcg_gen_andi_i32(cpu_SR
[INTSET
], cpu_SR
[INTSET
], ~int_bit
);
727 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
730 gen_helper_update_ccompare(cpu_env
, tmp
);
732 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
737 static void gen_check_interrupts(DisasContext
*dc
)
742 static void gen_wsr(DisasContext
*dc
, uint32_t sr
, TCGv_i32 s
)
744 static void (* const wsr_handler
[256])(DisasContext
*dc
,
745 uint32_t sr
, TCGv_i32 v
) = {
746 [LBEG
] = gen_wsr_lbeg
,
747 [LEND
] = gen_wsr_lend
,
750 [LITBASE
] = gen_wsr_litbase
,
751 [ACCHI
] = gen_wsr_acchi
,
752 #ifndef CONFIG_USER_ONLY
753 [WINDOW_BASE
] = gen_wsr_windowbase
,
754 [WINDOW_START
] = gen_wsr_windowstart
,
755 [PTEVADDR
] = gen_wsr_ptevaddr
,
756 [RASID
] = gen_wsr_rasid
,
757 [ITLBCFG
] = gen_wsr_tlbcfg
,
758 [DTLBCFG
] = gen_wsr_tlbcfg
,
759 [IBREAKENABLE
] = gen_wsr_ibreakenable
,
760 [MEMCTL
] = gen_wsr_memctl
,
761 [ATOMCTL
] = gen_wsr_atomctl
,
762 [IBREAKA
] = gen_wsr_ibreaka
,
763 [IBREAKA
+ 1] = gen_wsr_ibreaka
,
764 [DBREAKA
] = gen_wsr_dbreaka
,
765 [DBREAKA
+ 1] = gen_wsr_dbreaka
,
766 [DBREAKC
] = gen_wsr_dbreakc
,
767 [DBREAKC
+ 1] = gen_wsr_dbreakc
,
768 [CPENABLE
] = gen_wsr_cpenable
,
769 [INTSET
] = gen_wsr_intset
,
770 [INTCLEAR
] = gen_wsr_intclear
,
771 [INTENABLE
] = gen_wsr_intenable
,
773 [CCOUNT
] = gen_wsr_ccount
,
774 [ICOUNT
] = gen_wsr_icount
,
775 [ICOUNTLEVEL
] = gen_wsr_icountlevel
,
776 [CCOMPARE
] = gen_wsr_ccompare
,
777 [CCOMPARE
+ 1] = gen_wsr_ccompare
,
778 [CCOMPARE
+ 2] = gen_wsr_ccompare
,
782 if (wsr_handler
[sr
]) {
783 wsr_handler
[sr
](dc
, sr
, s
);
785 tcg_gen_mov_i32(cpu_SR
[sr
], s
);
789 static void gen_wur(uint32_t ur
, TCGv_i32 s
)
793 gen_helper_wur_fcr(cpu_env
, s
);
797 tcg_gen_andi_i32(cpu_UR
[ur
], s
, 0xffffff80);
801 tcg_gen_mov_i32(cpu_UR
[ur
], s
);
806 static void gen_load_store_alignment(DisasContext
*dc
, int shift
,
807 TCGv_i32 addr
, bool no_hw_alignment
)
809 if (!option_enabled(dc
, XTENSA_OPTION_UNALIGNED_EXCEPTION
)) {
810 tcg_gen_andi_i32(addr
, addr
, ~0 << shift
);
811 } else if (option_enabled(dc
, XTENSA_OPTION_HW_ALIGNMENT
) &&
813 TCGLabel
*label
= gen_new_label();
814 TCGv_i32 tmp
= tcg_temp_new_i32();
815 tcg_gen_andi_i32(tmp
, addr
, ~(~0 << shift
));
816 tcg_gen_brcondi_i32(TCG_COND_EQ
, tmp
, 0, label
);
817 gen_exception_cause_vaddr(dc
, LOAD_STORE_ALIGNMENT_CAUSE
, addr
);
818 gen_set_label(label
);
823 #ifndef CONFIG_USER_ONLY
824 static void gen_waiti(DisasContext
*dc
, uint32_t imm4
)
826 TCGv_i32 pc
= tcg_const_i32(dc
->base
.pc_next
);
827 TCGv_i32 intlevel
= tcg_const_i32(imm4
);
829 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
832 gen_helper_waiti(cpu_env
, pc
, intlevel
);
833 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
837 tcg_temp_free(intlevel
);
841 static bool gen_window_check(DisasContext
*dc
, uint32_t mask
)
843 unsigned r
= 31 - clz32(mask
);
845 if (r
/ 4 > dc
->window
) {
846 TCGv_i32 pc
= tcg_const_i32(dc
->pc
);
847 TCGv_i32 w
= tcg_const_i32(r
/ 4);
849 gen_helper_window_check(cpu_env
, pc
, w
);
850 dc
->base
.is_jmp
= DISAS_NORETURN
;
856 static TCGv_i32
gen_mac16_m(TCGv_i32 v
, bool hi
, bool is_unsigned
)
858 TCGv_i32 m
= tcg_temp_new_i32();
861 (is_unsigned
? tcg_gen_shri_i32
: tcg_gen_sari_i32
)(m
, v
, 16);
863 (is_unsigned
? tcg_gen_ext16u_i32
: tcg_gen_ext16s_i32
)(m
, v
);
868 static void gen_zero_check(DisasContext
*dc
, const uint32_t arg
[])
870 TCGLabel
*label
= gen_new_label();
872 tcg_gen_brcondi_i32(TCG_COND_NE
, cpu_R
[arg
[2]], 0, label
);
873 gen_exception_cause(dc
, INTEGER_DIVIDE_BY_ZERO_CAUSE
);
874 gen_set_label(label
);
877 static inline unsigned xtensa_op0_insn_len(DisasContext
*dc
, uint8_t op0
)
879 return xtensa_isa_length_from_chars(dc
->config
->isa
, &op0
);
882 static void disas_xtensa_insn(CPUXtensaState
*env
, DisasContext
*dc
)
884 xtensa_isa isa
= dc
->config
->isa
;
885 unsigned char b
[MAX_INSN_LENGTH
] = {cpu_ldub_code(env
, dc
->pc
)};
886 unsigned len
= xtensa_op0_insn_len(dc
, b
[0]);
890 uint32_t op_flags
= 0;
892 XtensaOpcodeOps
*ops
;
893 uint32_t arg
[MAX_OPCODE_ARGS
];
894 uint32_t raw_arg
[MAX_OPCODE_ARGS
];
895 } slot_prop
[MAX_INSN_SLOTS
];
896 uint32_t debug_cause
= 0;
897 uint32_t windowed_register
= 0;
898 uint32_t coprocessor
= 0;
900 if (len
== XTENSA_UNDEFINED
) {
901 qemu_log_mask(LOG_GUEST_ERROR
,
902 "unknown instruction length (pc = %08x)\n",
904 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
908 dc
->base
.pc_next
= dc
->pc
+ len
;
909 if (xtensa_option_enabled(dc
->config
, XTENSA_OPTION_LOOP
) &&
910 dc
->lbeg
== dc
->pc
&&
911 ((dc
->pc
^ (dc
->base
.pc_next
- 1)) & -dc
->config
->inst_fetch_width
)) {
912 qemu_log_mask(LOG_GUEST_ERROR
,
913 "unaligned first instruction of a loop (pc = %08x)\n",
916 for (i
= 1; i
< len
; ++i
) {
917 b
[i
] = cpu_ldub_code(env
, dc
->pc
+ i
);
919 xtensa_insnbuf_from_chars(isa
, dc
->insnbuf
, b
, len
);
920 fmt
= xtensa_format_decode(isa
, dc
->insnbuf
);
921 if (fmt
== XTENSA_UNDEFINED
) {
922 qemu_log_mask(LOG_GUEST_ERROR
,
923 "unrecognized instruction format (pc = %08x)\n",
925 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
928 slots
= xtensa_format_num_slots(isa
, fmt
);
929 for (slot
= 0; slot
< slots
; ++slot
) {
931 int opnd
, vopnd
, opnds
;
932 uint32_t *raw_arg
= slot_prop
[slot
].raw_arg
;
933 uint32_t *arg
= slot_prop
[slot
].arg
;
934 XtensaOpcodeOps
*ops
;
936 dc
->raw_arg
= raw_arg
;
938 xtensa_format_get_slot(isa
, fmt
, slot
, dc
->insnbuf
, dc
->slotbuf
);
939 opc
= xtensa_opcode_decode(isa
, fmt
, slot
, dc
->slotbuf
);
940 if (opc
== XTENSA_UNDEFINED
) {
941 qemu_log_mask(LOG_GUEST_ERROR
,
942 "unrecognized opcode in slot %d (pc = %08x)\n",
944 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
947 opnds
= xtensa_opcode_num_operands(isa
, opc
);
949 for (opnd
= vopnd
= 0; opnd
< opnds
; ++opnd
) {
950 if (xtensa_operand_is_visible(isa
, opc
, opnd
)) {
953 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
955 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
957 if (xtensa_operand_is_PCrelative(isa
, opc
, opnd
)) {
958 xtensa_operand_undo_reloc(isa
, opc
, opnd
, &v
, dc
->pc
);
964 ops
= dc
->config
->opcode_ops
[opc
];
965 slot_prop
[slot
].ops
= ops
;
968 op_flags
|= ops
->op_flags
;
970 qemu_log_mask(LOG_UNIMP
,
971 "unimplemented opcode '%s' in slot %d (pc = %08x)\n",
972 xtensa_opcode_name(isa
, opc
), slot
, dc
->pc
);
973 op_flags
|= XTENSA_OP_ILL
;
975 if ((op_flags
& XTENSA_OP_ILL
) ||
976 (ops
&& ops
->test_ill
&& ops
->test_ill(dc
, arg
, ops
->par
))) {
977 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
980 if (ops
->op_flags
& XTENSA_OP_DEBUG_BREAK
) {
981 debug_cause
|= ops
->par
[0];
983 if (ops
->test_overflow
) {
984 windowed_register
|= ops
->test_overflow(dc
, arg
, ops
->par
);
986 if (ops
->windowed_register_op
) {
987 uint32_t reg_opnd
= ops
->windowed_register_op
;
990 unsigned i
= ctz32(reg_opnd
);
992 windowed_register
|= 1 << arg
[i
];
996 coprocessor
|= ops
->coprocessor
;
999 if ((op_flags
& XTENSA_OP_PRIVILEGED
) &&
1000 !gen_check_privilege(dc
)) {
1004 if (op_flags
& XTENSA_OP_SYSCALL
) {
1005 gen_exception_cause(dc
, SYSCALL_CAUSE
);
1009 if ((op_flags
& XTENSA_OP_DEBUG_BREAK
) && dc
->debug
) {
1010 gen_debug_exception(dc
, debug_cause
);
1014 if (windowed_register
&& !gen_window_check(dc
, windowed_register
)) {
1018 if (op_flags
& XTENSA_OP_UNDERFLOW
) {
1019 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
1021 gen_helper_test_underflow_retw(cpu_env
, tmp
);
1025 if (op_flags
& XTENSA_OP_ALLOCA
) {
1026 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
1028 gen_helper_movsp(cpu_env
, tmp
);
1032 if (coprocessor
&& !gen_check_cpenable(dc
, coprocessor
)) {
1036 if (op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1037 for (slot
= 0; slot
< slots
; ++slot
) {
1038 if (slot_prop
[slot
].ops
->op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1039 gen_zero_check(dc
, slot_prop
[slot
].arg
);
1044 for (slot
= 0; slot
< slots
; ++slot
) {
1045 XtensaOpcodeOps
*ops
= slot_prop
[slot
].ops
;
1047 dc
->raw_arg
= slot_prop
[slot
].raw_arg
;
1048 ops
->translate(dc
, slot_prop
[slot
].arg
, ops
->par
);
1051 if (dc
->base
.is_jmp
== DISAS_NEXT
) {
1052 if (op_flags
& XTENSA_OP_CHECK_INTERRUPTS
) {
1053 gen_check_interrupts(dc
);
1056 if (op_flags
& XTENSA_OP_EXIT_TB_M1
) {
1057 /* Change in mmu index, memory mapping or tb->flags; exit tb */
1058 gen_jumpi_check_loop_end(dc
, -1);
1059 } else if (op_flags
& XTENSA_OP_EXIT_TB_0
) {
1060 gen_jumpi_check_loop_end(dc
, 0);
1064 if (dc
->base
.is_jmp
== DISAS_NEXT
) {
1065 gen_check_loop_end(dc
, 0);
1067 dc
->pc
= dc
->base
.pc_next
;
1070 static inline unsigned xtensa_insn_len(CPUXtensaState
*env
, DisasContext
*dc
)
1072 uint8_t b0
= cpu_ldub_code(env
, dc
->pc
);
1073 return xtensa_op0_insn_len(dc
, b0
);
1076 static void gen_ibreak_check(CPUXtensaState
*env
, DisasContext
*dc
)
1080 for (i
= 0; i
< dc
->config
->nibreak
; ++i
) {
1081 if ((env
->sregs
[IBREAKENABLE
] & (1 << i
)) &&
1082 env
->sregs
[IBREAKA
+ i
] == dc
->pc
) {
1083 gen_debug_exception(dc
, DEBUGCAUSE_IB
);
1089 static void xtensa_tr_init_disas_context(DisasContextBase
*dcbase
,
1092 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1093 CPUXtensaState
*env
= cpu
->env_ptr
;
1094 uint32_t tb_flags
= dc
->base
.tb
->flags
;
1096 dc
->config
= env
->config
;
1097 dc
->pc
= dc
->base
.pc_first
;
1098 dc
->ring
= tb_flags
& XTENSA_TBFLAG_RING_MASK
;
1099 dc
->cring
= (tb_flags
& XTENSA_TBFLAG_EXCM
) ? 0 : dc
->ring
;
1100 dc
->lbeg
= env
->sregs
[LBEG
];
1101 dc
->lend
= env
->sregs
[LEND
];
1102 dc
->debug
= tb_flags
& XTENSA_TBFLAG_DEBUG
;
1103 dc
->icount
= tb_flags
& XTENSA_TBFLAG_ICOUNT
;
1104 dc
->cpenable
= (tb_flags
& XTENSA_TBFLAG_CPENABLE_MASK
) >>
1105 XTENSA_TBFLAG_CPENABLE_SHIFT
;
1106 dc
->window
= ((tb_flags
& XTENSA_TBFLAG_WINDOW_MASK
) >>
1107 XTENSA_TBFLAG_WINDOW_SHIFT
);
1108 dc
->cwoe
= tb_flags
& XTENSA_TBFLAG_CWOE
;
1109 dc
->callinc
= ((tb_flags
& XTENSA_TBFLAG_CALLINC_MASK
) >>
1110 XTENSA_TBFLAG_CALLINC_SHIFT
);
1112 if (dc
->config
->isa
) {
1113 dc
->insnbuf
= xtensa_insnbuf_alloc(dc
->config
->isa
);
1114 dc
->slotbuf
= xtensa_insnbuf_alloc(dc
->config
->isa
);
1116 init_sar_tracker(dc
);
1119 static void xtensa_tr_tb_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1121 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1124 dc
->next_icount
= tcg_temp_local_new_i32();
1128 static void xtensa_tr_insn_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1130 tcg_gen_insn_start(dcbase
->pc_next
);
1133 static bool xtensa_tr_breakpoint_check(DisasContextBase
*dcbase
, CPUState
*cpu
,
1134 const CPUBreakpoint
*bp
)
1136 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1138 tcg_gen_movi_i32(cpu_pc
, dc
->base
.pc_next
);
1139 gen_exception(dc
, EXCP_DEBUG
);
1140 dc
->base
.is_jmp
= DISAS_NORETURN
;
1141 /* The address covered by the breakpoint must be included in
1142 [tb->pc, tb->pc + tb->size) in order to for it to be
1143 properly cleared -- thus we increment the PC here so that
1144 the logic setting tb->size below does the right thing. */
1145 dc
->base
.pc_next
+= 2;
1149 static void xtensa_tr_translate_insn(DisasContextBase
*dcbase
, CPUState
*cpu
)
1151 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1152 CPUXtensaState
*env
= cpu
->env_ptr
;
1153 target_ulong page_start
;
1155 /* These two conditions only apply to the first insn in the TB,
1156 but this is the first TranslateOps hook that allows exiting. */
1157 if ((tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
)
1158 && (dc
->base
.tb
->flags
& XTENSA_TBFLAG_YIELD
)) {
1159 gen_exception(dc
, EXCP_YIELD
);
1160 dc
->base
.is_jmp
= DISAS_NORETURN
;
1163 if (dc
->base
.tb
->flags
& XTENSA_TBFLAG_EXCEPTION
) {
1164 gen_exception(dc
, EXCP_DEBUG
);
1165 dc
->base
.is_jmp
= DISAS_NORETURN
;
1170 TCGLabel
*label
= gen_new_label();
1172 tcg_gen_addi_i32(dc
->next_icount
, cpu_SR
[ICOUNT
], 1);
1173 tcg_gen_brcondi_i32(TCG_COND_NE
, dc
->next_icount
, 0, label
);
1174 tcg_gen_mov_i32(dc
->next_icount
, cpu_SR
[ICOUNT
]);
1176 gen_debug_exception(dc
, DEBUGCAUSE_IC
);
1178 gen_set_label(label
);
1182 gen_ibreak_check(env
, dc
);
1185 disas_xtensa_insn(env
, dc
);
1188 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
1191 /* End the TB if the next insn will cross into the next page. */
1192 page_start
= dc
->base
.pc_first
& TARGET_PAGE_MASK
;
1193 if (dc
->base
.is_jmp
== DISAS_NEXT
&&
1194 (dc
->pc
- page_start
>= TARGET_PAGE_SIZE
||
1195 dc
->pc
- page_start
+ xtensa_insn_len(env
, dc
) > TARGET_PAGE_SIZE
)) {
1196 dc
->base
.is_jmp
= DISAS_TOO_MANY
;
1200 static void xtensa_tr_tb_stop(DisasContextBase
*dcbase
, CPUState
*cpu
)
1202 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1204 reset_sar_tracker(dc
);
1205 if (dc
->config
->isa
) {
1206 xtensa_insnbuf_free(dc
->config
->isa
, dc
->insnbuf
);
1207 xtensa_insnbuf_free(dc
->config
->isa
, dc
->slotbuf
);
1210 tcg_temp_free(dc
->next_icount
);
1213 switch (dc
->base
.is_jmp
) {
1214 case DISAS_NORETURN
:
1216 case DISAS_TOO_MANY
:
1217 if (dc
->base
.singlestep_enabled
) {
1218 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1219 gen_exception(dc
, EXCP_DEBUG
);
1221 gen_jumpi(dc
, dc
->pc
, 0);
1225 g_assert_not_reached();
1229 static void xtensa_tr_disas_log(const DisasContextBase
*dcbase
, CPUState
*cpu
)
1231 qemu_log("IN: %s\n", lookup_symbol(dcbase
->pc_first
));
1232 log_target_disas(cpu
, dcbase
->pc_first
, dcbase
->tb
->size
);
1235 static const TranslatorOps xtensa_translator_ops
= {
1236 .init_disas_context
= xtensa_tr_init_disas_context
,
1237 .tb_start
= xtensa_tr_tb_start
,
1238 .insn_start
= xtensa_tr_insn_start
,
1239 .breakpoint_check
= xtensa_tr_breakpoint_check
,
1240 .translate_insn
= xtensa_tr_translate_insn
,
1241 .tb_stop
= xtensa_tr_tb_stop
,
1242 .disas_log
= xtensa_tr_disas_log
,
1245 void gen_intermediate_code(CPUState
*cpu
, TranslationBlock
*tb
)
1247 DisasContext dc
= {};
1248 translator_loop(&xtensa_translator_ops
, &dc
.base
, cpu
, tb
);
1251 void xtensa_cpu_dump_state(CPUState
*cs
, FILE *f
,
1252 fprintf_function cpu_fprintf
, int flags
)
1254 XtensaCPU
*cpu
= XTENSA_CPU(cs
);
1255 CPUXtensaState
*env
= &cpu
->env
;
1258 cpu_fprintf(f
, "PC=%08x\n\n", env
->pc
);
1260 for (i
= j
= 0; i
< 256; ++i
) {
1261 if (xtensa_option_bits_enabled(env
->config
, sregnames
[i
].opt_bits
)) {
1262 cpu_fprintf(f
, "%12s=%08x%c", sregnames
[i
].name
, env
->sregs
[i
],
1263 (j
++ % 4) == 3 ? '\n' : ' ');
1267 cpu_fprintf(f
, (j
% 4) == 0 ? "\n" : "\n\n");
1269 for (i
= j
= 0; i
< 256; ++i
) {
1270 if (xtensa_option_bits_enabled(env
->config
, uregnames
[i
].opt_bits
)) {
1271 cpu_fprintf(f
, "%s=%08x%c", uregnames
[i
].name
, env
->uregs
[i
],
1272 (j
++ % 4) == 3 ? '\n' : ' ');
1276 cpu_fprintf(f
, (j
% 4) == 0 ? "\n" : "\n\n");
1278 for (i
= 0; i
< 16; ++i
) {
1279 cpu_fprintf(f
, " A%02d=%08x%c", i
, env
->regs
[i
],
1280 (i
% 4) == 3 ? '\n' : ' ');
1283 xtensa_sync_phys_from_window(env
);
1284 cpu_fprintf(f
, "\n");
1286 for (i
= 0; i
< env
->config
->nareg
; ++i
) {
1287 cpu_fprintf(f
, "AR%02d=%08x ", i
, env
->phys_regs
[i
]);
1289 bool ws
= (env
->sregs
[WINDOW_START
] & (1 << (i
/ 4))) != 0;
1290 bool cw
= env
->sregs
[WINDOW_BASE
] == i
/ 4;
1292 cpu_fprintf(f
, "%c%c\n", ws
? '<' : ' ', cw
? '=' : ' ');
1296 if ((flags
& CPU_DUMP_FPU
) &&
1297 xtensa_option_enabled(env
->config
, XTENSA_OPTION_FP_COPROCESSOR
)) {
1298 cpu_fprintf(f
, "\n");
1300 for (i
= 0; i
< 16; ++i
) {
1301 cpu_fprintf(f
, "F%02d=%08x (%+10.8e)%c", i
,
1302 float32_val(env
->fregs
[i
].f32
[FP_F32_LOW
]),
1303 *(float *)(env
->fregs
[i
].f32
+ FP_F32_LOW
),
1304 (i
% 2) == 1 ? '\n' : ' ');
1309 void restore_state_to_opc(CPUXtensaState
*env
, TranslationBlock
*tb
,
1315 static int compare_opcode_ops(const void *a
, const void *b
)
1317 return strcmp((const char *)a
,
1318 ((const XtensaOpcodeOps
*)b
)->name
);
1322 xtensa_find_opcode_ops(const XtensaOpcodeTranslators
*t
,
1325 return bsearch(name
, t
->opcode
, t
->num_opcodes
,
1326 sizeof(XtensaOpcodeOps
), compare_opcode_ops
);
1329 static void translate_abs(DisasContext
*dc
, const uint32_t arg
[],
1330 const uint32_t par
[])
1332 TCGv_i32 zero
= tcg_const_i32(0);
1333 TCGv_i32 neg
= tcg_temp_new_i32();
1335 tcg_gen_neg_i32(neg
, cpu_R
[arg
[1]]);
1336 tcg_gen_movcond_i32(TCG_COND_GE
, cpu_R
[arg
[0]],
1337 cpu_R
[arg
[1]], zero
, cpu_R
[arg
[1]], neg
);
1339 tcg_temp_free(zero
);
1342 static void translate_add(DisasContext
*dc
, const uint32_t arg
[],
1343 const uint32_t par
[])
1345 tcg_gen_add_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
1348 static void translate_addi(DisasContext
*dc
, const uint32_t arg
[],
1349 const uint32_t par
[])
1351 tcg_gen_addi_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], arg
[2]);
1354 static void translate_addx(DisasContext
*dc
, const uint32_t arg
[],
1355 const uint32_t par
[])
1357 TCGv_i32 tmp
= tcg_temp_new_i32();
1358 tcg_gen_shli_i32(tmp
, cpu_R
[arg
[1]], par
[0]);
1359 tcg_gen_add_i32(cpu_R
[arg
[0]], tmp
, cpu_R
[arg
[2]]);
1363 static void translate_all(DisasContext
*dc
, const uint32_t arg
[],
1364 const uint32_t par
[])
1366 uint32_t shift
= par
[1];
1367 TCGv_i32 mask
= tcg_const_i32(((1 << shift
) - 1) << arg
[1]);
1368 TCGv_i32 tmp
= tcg_temp_new_i32();
1370 tcg_gen_and_i32(tmp
, cpu_SR
[BR
], mask
);
1372 tcg_gen_addi_i32(tmp
, tmp
, 1 << arg
[1]);
1374 tcg_gen_add_i32(tmp
, tmp
, mask
);
1376 tcg_gen_shri_i32(tmp
, tmp
, arg
[1] + shift
);
1377 tcg_gen_deposit_i32(cpu_SR
[BR
], cpu_SR
[BR
],
1379 tcg_temp_free(mask
);
1383 static void translate_and(DisasContext
*dc
, const uint32_t arg
[],
1384 const uint32_t par
[])
1386 tcg_gen_and_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
1389 static void translate_ball(DisasContext
*dc
, const uint32_t arg
[],
1390 const uint32_t par
[])
1392 TCGv_i32 tmp
= tcg_temp_new_i32();
1393 tcg_gen_and_i32(tmp
, cpu_R
[arg
[0]], cpu_R
[arg
[1]]);
1394 gen_brcond(dc
, par
[0], tmp
, cpu_R
[arg
[1]], arg
[2]);
1398 static void translate_bany(DisasContext
*dc
, const uint32_t arg
[],
1399 const uint32_t par
[])
1401 TCGv_i32 tmp
= tcg_temp_new_i32();
1402 tcg_gen_and_i32(tmp
, cpu_R
[arg
[0]], cpu_R
[arg
[1]]);
1403 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2]);
1407 static void translate_b(DisasContext
*dc
, const uint32_t arg
[],
1408 const uint32_t par
[])
1410 gen_brcond(dc
, par
[0], cpu_R
[arg
[0]], cpu_R
[arg
[1]], arg
[2]);
1413 static void translate_bb(DisasContext
*dc
, const uint32_t arg
[],
1414 const uint32_t par
[])
1416 #ifdef TARGET_WORDS_BIGENDIAN
1417 TCGv_i32 bit
= tcg_const_i32(0x80000000u
);
1419 TCGv_i32 bit
= tcg_const_i32(0x00000001u
);
1421 TCGv_i32 tmp
= tcg_temp_new_i32();
1422 tcg_gen_andi_i32(tmp
, cpu_R
[arg
[1]], 0x1f);
1423 #ifdef TARGET_WORDS_BIGENDIAN
1424 tcg_gen_shr_i32(bit
, bit
, tmp
);
1426 tcg_gen_shl_i32(bit
, bit
, tmp
);
1428 tcg_gen_and_i32(tmp
, cpu_R
[arg
[0]], bit
);
1429 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2]);
1434 static void translate_bbi(DisasContext
*dc
, const uint32_t arg
[],
1435 const uint32_t par
[])
1437 TCGv_i32 tmp
= tcg_temp_new_i32();
1438 #ifdef TARGET_WORDS_BIGENDIAN
1439 tcg_gen_andi_i32(tmp
, cpu_R
[arg
[0]], 0x80000000u
>> arg
[1]);
1441 tcg_gen_andi_i32(tmp
, cpu_R
[arg
[0]], 0x00000001u
<< arg
[1]);
1443 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2]);
1447 static void translate_bi(DisasContext
*dc
, const uint32_t arg
[],
1448 const uint32_t par
[])
1450 gen_brcondi(dc
, par
[0], cpu_R
[arg
[0]], arg
[1], arg
[2]);
1453 static void translate_bz(DisasContext
*dc
, const uint32_t arg
[],
1454 const uint32_t par
[])
1456 gen_brcondi(dc
, par
[0], cpu_R
[arg
[0]], 0, arg
[1]);
1467 static void translate_boolean(DisasContext
*dc
, const uint32_t arg
[],
1468 const uint32_t par
[])
1470 static void (* const op
[])(TCGv_i32
, TCGv_i32
, TCGv_i32
) = {
1471 [BOOLEAN_AND
] = tcg_gen_and_i32
,
1472 [BOOLEAN_ANDC
] = tcg_gen_andc_i32
,
1473 [BOOLEAN_OR
] = tcg_gen_or_i32
,
1474 [BOOLEAN_ORC
] = tcg_gen_orc_i32
,
1475 [BOOLEAN_XOR
] = tcg_gen_xor_i32
,
1478 TCGv_i32 tmp1
= tcg_temp_new_i32();
1479 TCGv_i32 tmp2
= tcg_temp_new_i32();
1481 tcg_gen_shri_i32(tmp1
, cpu_SR
[BR
], arg
[1]);
1482 tcg_gen_shri_i32(tmp2
, cpu_SR
[BR
], arg
[2]);
1483 op
[par
[0]](tmp1
, tmp1
, tmp2
);
1484 tcg_gen_deposit_i32(cpu_SR
[BR
], cpu_SR
[BR
], tmp1
, arg
[0], 1);
1485 tcg_temp_free(tmp1
);
1486 tcg_temp_free(tmp2
);
1489 static void translate_bp(DisasContext
*dc
, const uint32_t arg
[],
1490 const uint32_t par
[])
1492 TCGv_i32 tmp
= tcg_temp_new_i32();
1494 tcg_gen_andi_i32(tmp
, cpu_SR
[BR
], 1 << arg
[0]);
1495 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[1]);
1499 static void translate_call0(DisasContext
*dc
, const uint32_t arg
[],
1500 const uint32_t par
[])
1502 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1503 gen_jumpi(dc
, arg
[0], 0);
1506 static uint32_t test_overflow_callw(DisasContext
*dc
, const uint32_t arg
[],
1507 const uint32_t par
[])
1509 return 1 << (par
[0] * 4);
1512 static void translate_callw(DisasContext
*dc
, const uint32_t arg
[],
1513 const uint32_t par
[])
1515 gen_callwi(dc
, par
[0], arg
[0], 0);
1518 static void translate_callx0(DisasContext
*dc
, const uint32_t arg
[],
1519 const uint32_t par
[])
1521 TCGv_i32 tmp
= tcg_temp_new_i32();
1522 tcg_gen_mov_i32(tmp
, cpu_R
[arg
[0]]);
1523 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1528 static void translate_callxw(DisasContext
*dc
, const uint32_t arg
[],
1529 const uint32_t par
[])
1531 TCGv_i32 tmp
= tcg_temp_new_i32();
1533 tcg_gen_mov_i32(tmp
, cpu_R
[arg
[0]]);
1534 gen_callw(dc
, par
[0], tmp
);
1538 static void translate_clamps(DisasContext
*dc
, const uint32_t arg
[],
1539 const uint32_t par
[])
1541 TCGv_i32 tmp1
= tcg_const_i32(-1u << arg
[2]);
1542 TCGv_i32 tmp2
= tcg_const_i32((1 << arg
[2]) - 1);
1544 tcg_gen_smax_i32(tmp1
, tmp1
, cpu_R
[arg
[1]]);
1545 tcg_gen_smin_i32(cpu_R
[arg
[0]], tmp1
, tmp2
);
1546 tcg_temp_free(tmp1
);
1547 tcg_temp_free(tmp2
);
1550 static void translate_clrb_expstate(DisasContext
*dc
, const uint32_t arg
[],
1551 const uint32_t par
[])
1553 /* TODO: GPIO32 may be a part of coprocessor */
1554 tcg_gen_andi_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], ~(1u << arg
[0]));
1557 static void translate_const16(DisasContext
*dc
, const uint32_t arg
[],
1558 const uint32_t par
[])
1560 TCGv_i32 c
= tcg_const_i32(arg
[1]);
1562 tcg_gen_deposit_i32(cpu_R
[arg
[0]], c
, cpu_R
[arg
[0]], 16, 16);
1566 static void translate_dcache(DisasContext
*dc
, const uint32_t arg
[],
1567 const uint32_t par
[])
1569 TCGv_i32 addr
= tcg_temp_new_i32();
1570 TCGv_i32 res
= tcg_temp_new_i32();
1572 tcg_gen_addi_i32(addr
, cpu_R
[arg
[0]], arg
[1]);
1573 tcg_gen_qemu_ld8u(res
, addr
, dc
->cring
);
1574 tcg_temp_free(addr
);
1578 static void translate_depbits(DisasContext
*dc
, const uint32_t arg
[],
1579 const uint32_t par
[])
1581 tcg_gen_deposit_i32(cpu_R
[arg
[1]], cpu_R
[arg
[1]], cpu_R
[arg
[0]],
1585 static bool test_ill_entry(DisasContext
*dc
, const uint32_t arg
[],
1586 const uint32_t par
[])
1588 if (arg
[0] > 3 || !dc
->cwoe
) {
1589 qemu_log_mask(LOG_GUEST_ERROR
,
1590 "Illegal entry instruction(pc = %08x)\n", dc
->pc
);
1597 static uint32_t test_overflow_entry(DisasContext
*dc
, const uint32_t arg
[],
1598 const uint32_t par
[])
1600 return 1 << (dc
->callinc
* 4);
1603 static void translate_entry(DisasContext
*dc
, const uint32_t arg
[],
1604 const uint32_t par
[])
1606 TCGv_i32 pc
= tcg_const_i32(dc
->pc
);
1607 TCGv_i32 s
= tcg_const_i32(arg
[0]);
1608 TCGv_i32 imm
= tcg_const_i32(arg
[1]);
1609 gen_helper_entry(cpu_env
, pc
, s
, imm
);
1615 static void translate_extui(DisasContext
*dc
, const uint32_t arg
[],
1616 const uint32_t par
[])
1618 int maskimm
= (1 << arg
[3]) - 1;
1620 TCGv_i32 tmp
= tcg_temp_new_i32();
1621 tcg_gen_shri_i32(tmp
, cpu_R
[arg
[1]], arg
[2]);
1622 tcg_gen_andi_i32(cpu_R
[arg
[0]], tmp
, maskimm
);
1626 static void translate_icache(DisasContext
*dc
, const uint32_t arg
[],
1627 const uint32_t par
[])
1629 #ifndef CONFIG_USER_ONLY
1630 TCGv_i32 addr
= tcg_temp_new_i32();
1632 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1633 tcg_gen_addi_i32(addr
, cpu_R
[arg
[0]], arg
[1]);
1634 gen_helper_itlb_hit_test(cpu_env
, addr
);
1635 tcg_temp_free(addr
);
1639 static void translate_itlb(DisasContext
*dc
, const uint32_t arg
[],
1640 const uint32_t par
[])
1642 #ifndef CONFIG_USER_ONLY
1643 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
1645 gen_helper_itlb(cpu_env
, cpu_R
[arg
[0]], dtlb
);
1646 tcg_temp_free(dtlb
);
1650 static void translate_j(DisasContext
*dc
, const uint32_t arg
[],
1651 const uint32_t par
[])
1653 gen_jumpi(dc
, arg
[0], 0);
1656 static void translate_jx(DisasContext
*dc
, const uint32_t arg
[],
1657 const uint32_t par
[])
1659 gen_jump(dc
, cpu_R
[arg
[0]]);
1662 static void translate_l32e(DisasContext
*dc
, const uint32_t arg
[],
1663 const uint32_t par
[])
1665 TCGv_i32 addr
= tcg_temp_new_i32();
1667 tcg_gen_addi_i32(addr
, cpu_R
[arg
[1]], arg
[2]);
1668 gen_load_store_alignment(dc
, 2, addr
, false);
1669 tcg_gen_qemu_ld_tl(cpu_R
[arg
[0]], addr
, dc
->ring
, MO_TEUL
);
1670 tcg_temp_free(addr
);
1673 static void translate_ldst(DisasContext
*dc
, const uint32_t arg
[],
1674 const uint32_t par
[])
1676 TCGv_i32 addr
= tcg_temp_new_i32();
1678 tcg_gen_addi_i32(addr
, cpu_R
[arg
[1]], arg
[2]);
1679 if (par
[0] & MO_SIZE
) {
1680 gen_load_store_alignment(dc
, par
[0] & MO_SIZE
, addr
, par
[1]);
1684 tcg_gen_mb(TCG_BAR_STRL
| TCG_MO_ALL
);
1686 tcg_gen_qemu_st_tl(cpu_R
[arg
[0]], addr
, dc
->cring
, par
[0]);
1688 tcg_gen_qemu_ld_tl(cpu_R
[arg
[0]], addr
, dc
->cring
, par
[0]);
1690 tcg_gen_mb(TCG_BAR_LDAQ
| TCG_MO_ALL
);
1693 tcg_temp_free(addr
);
1696 static void translate_l32r(DisasContext
*dc
, const uint32_t arg
[],
1697 const uint32_t par
[])
1701 if (dc
->base
.tb
->flags
& XTENSA_TBFLAG_LITBASE
) {
1702 tmp
= tcg_const_i32(dc
->raw_arg
[1] - 1);
1703 tcg_gen_add_i32(tmp
, cpu_SR
[LITBASE
], tmp
);
1705 tmp
= tcg_const_i32(arg
[1]);
1707 tcg_gen_qemu_ld32u(cpu_R
[arg
[0]], tmp
, dc
->cring
);
1711 static void translate_loop(DisasContext
*dc
, const uint32_t arg
[],
1712 const uint32_t par
[])
1714 uint32_t lend
= arg
[1];
1715 TCGv_i32 tmp
= tcg_const_i32(lend
);
1717 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], cpu_R
[arg
[0]], 1);
1718 tcg_gen_movi_i32(cpu_SR
[LBEG
], dc
->base
.pc_next
);
1719 gen_helper_wsr_lend(cpu_env
, tmp
);
1722 if (par
[0] != TCG_COND_NEVER
) {
1723 TCGLabel
*label
= gen_new_label();
1724 tcg_gen_brcondi_i32(par
[0], cpu_R
[arg
[0]], 0, label
);
1725 gen_jumpi(dc
, lend
, 1);
1726 gen_set_label(label
);
1729 gen_jumpi(dc
, dc
->base
.pc_next
, 0);
1760 static void translate_mac16(DisasContext
*dc
, const uint32_t arg
[],
1761 const uint32_t par
[])
1764 bool is_m1_sr
= par
[1] & MAC16_DX
;
1765 bool is_m2_sr
= par
[1] & MAC16_XD
;
1766 unsigned half
= par
[2];
1767 uint32_t ld_offset
= par
[3];
1768 unsigned off
= ld_offset
? 2 : 0;
1769 TCGv_i32 vaddr
= tcg_temp_new_i32();
1770 TCGv_i32 mem32
= tcg_temp_new_i32();
1773 tcg_gen_addi_i32(vaddr
, cpu_R
[arg
[1]], ld_offset
);
1774 gen_load_store_alignment(dc
, 2, vaddr
, false);
1775 tcg_gen_qemu_ld32u(mem32
, vaddr
, dc
->cring
);
1777 if (op
!= MAC16_NONE
) {
1778 TCGv_i32 m1
= gen_mac16_m(is_m1_sr
?
1779 cpu_SR
[MR
+ arg
[off
]] :
1781 half
& MAC16_HX
, op
== MAC16_UMUL
);
1782 TCGv_i32 m2
= gen_mac16_m(is_m2_sr
?
1783 cpu_SR
[MR
+ arg
[off
+ 1]] :
1784 cpu_R
[arg
[off
+ 1]],
1785 half
& MAC16_XH
, op
== MAC16_UMUL
);
1787 if (op
== MAC16_MUL
|| op
== MAC16_UMUL
) {
1788 tcg_gen_mul_i32(cpu_SR
[ACCLO
], m1
, m2
);
1789 if (op
== MAC16_UMUL
) {
1790 tcg_gen_movi_i32(cpu_SR
[ACCHI
], 0);
1792 tcg_gen_sari_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCLO
], 31);
1795 TCGv_i32 lo
= tcg_temp_new_i32();
1796 TCGv_i32 hi
= tcg_temp_new_i32();
1798 tcg_gen_mul_i32(lo
, m1
, m2
);
1799 tcg_gen_sari_i32(hi
, lo
, 31);
1800 if (op
== MAC16_MULA
) {
1801 tcg_gen_add2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1802 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1805 tcg_gen_sub2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1806 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1809 tcg_gen_ext8s_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCHI
]);
1811 tcg_temp_free_i32(lo
);
1812 tcg_temp_free_i32(hi
);
1818 tcg_gen_mov_i32(cpu_R
[arg
[1]], vaddr
);
1819 tcg_gen_mov_i32(cpu_SR
[MR
+ arg
[0]], mem32
);
1821 tcg_temp_free(vaddr
);
1822 tcg_temp_free(mem32
);
1825 static void translate_memw(DisasContext
*dc
, const uint32_t arg
[],
1826 const uint32_t par
[])
1828 tcg_gen_mb(TCG_BAR_SC
| TCG_MO_ALL
);
1831 static void translate_smin(DisasContext
*dc
, const uint32_t arg
[],
1832 const uint32_t par
[])
1834 tcg_gen_smin_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
1837 static void translate_umin(DisasContext
*dc
, const uint32_t arg
[],
1838 const uint32_t par
[])
1840 tcg_gen_umin_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
1843 static void translate_smax(DisasContext
*dc
, const uint32_t arg
[],
1844 const uint32_t par
[])
1846 tcg_gen_smax_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
1849 static void translate_umax(DisasContext
*dc
, const uint32_t arg
[],
1850 const uint32_t par
[])
1852 tcg_gen_umax_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
1855 static void translate_mov(DisasContext
*dc
, const uint32_t arg
[],
1856 const uint32_t par
[])
1858 tcg_gen_mov_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]]);
1861 static void translate_movcond(DisasContext
*dc
, const uint32_t arg
[],
1862 const uint32_t par
[])
1864 TCGv_i32 zero
= tcg_const_i32(0);
1866 tcg_gen_movcond_i32(par
[0], cpu_R
[arg
[0]],
1867 cpu_R
[arg
[2]], zero
, cpu_R
[arg
[1]], cpu_R
[arg
[0]]);
1868 tcg_temp_free(zero
);
1871 static void translate_movi(DisasContext
*dc
, const uint32_t arg
[],
1872 const uint32_t par
[])
1874 tcg_gen_movi_i32(cpu_R
[arg
[0]], arg
[1]);
1877 static void translate_movp(DisasContext
*dc
, const uint32_t arg
[],
1878 const uint32_t par
[])
1880 TCGv_i32 zero
= tcg_const_i32(0);
1881 TCGv_i32 tmp
= tcg_temp_new_i32();
1883 tcg_gen_andi_i32(tmp
, cpu_SR
[BR
], 1 << arg
[2]);
1884 tcg_gen_movcond_i32(par
[0],
1885 cpu_R
[arg
[0]], tmp
, zero
,
1886 cpu_R
[arg
[1]], cpu_R
[arg
[0]]);
1888 tcg_temp_free(zero
);
1891 static void translate_movsp(DisasContext
*dc
, const uint32_t arg
[],
1892 const uint32_t par
[])
1894 tcg_gen_mov_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]]);
1897 static void translate_mul16(DisasContext
*dc
, const uint32_t arg
[],
1898 const uint32_t par
[])
1900 TCGv_i32 v1
= tcg_temp_new_i32();
1901 TCGv_i32 v2
= tcg_temp_new_i32();
1904 tcg_gen_ext16s_i32(v1
, cpu_R
[arg
[1]]);
1905 tcg_gen_ext16s_i32(v2
, cpu_R
[arg
[2]]);
1907 tcg_gen_ext16u_i32(v1
, cpu_R
[arg
[1]]);
1908 tcg_gen_ext16u_i32(v2
, cpu_R
[arg
[2]]);
1910 tcg_gen_mul_i32(cpu_R
[arg
[0]], v1
, v2
);
1915 static void translate_mull(DisasContext
*dc
, const uint32_t arg
[],
1916 const uint32_t par
[])
1918 tcg_gen_mul_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
1921 static void translate_mulh(DisasContext
*dc
, const uint32_t arg
[],
1922 const uint32_t par
[])
1924 TCGv_i32 lo
= tcg_temp_new();
1927 tcg_gen_muls2_i32(lo
, cpu_R
[arg
[0]], cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
1929 tcg_gen_mulu2_i32(lo
, cpu_R
[arg
[0]], cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
1934 static void translate_neg(DisasContext
*dc
, const uint32_t arg
[],
1935 const uint32_t par
[])
1937 tcg_gen_neg_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]]);
1940 static void translate_nop(DisasContext
*dc
, const uint32_t arg
[],
1941 const uint32_t par
[])
1945 static void translate_nsa(DisasContext
*dc
, const uint32_t arg
[],
1946 const uint32_t par
[])
1948 tcg_gen_clrsb_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]]);
1951 static void translate_nsau(DisasContext
*dc
, const uint32_t arg
[],
1952 const uint32_t par
[])
1954 tcg_gen_clzi_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], 32);
1957 static void translate_or(DisasContext
*dc
, const uint32_t arg
[],
1958 const uint32_t par
[])
1960 tcg_gen_or_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
1963 static void translate_ptlb(DisasContext
*dc
, const uint32_t arg
[],
1964 const uint32_t par
[])
1966 #ifndef CONFIG_USER_ONLY
1967 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
1969 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1970 gen_helper_ptlb(cpu_R
[arg
[0]], cpu_env
, cpu_R
[arg
[1]], dtlb
);
1971 tcg_temp_free(dtlb
);
1975 static void translate_quos(DisasContext
*dc
, const uint32_t arg
[],
1976 const uint32_t par
[])
1978 TCGLabel
*label1
= gen_new_label();
1979 TCGLabel
*label2
= gen_new_label();
1981 tcg_gen_brcondi_i32(TCG_COND_NE
, cpu_R
[arg
[1]], 0x80000000,
1983 tcg_gen_brcondi_i32(TCG_COND_NE
, cpu_R
[arg
[2]], 0xffffffff,
1985 tcg_gen_movi_i32(cpu_R
[arg
[0]],
1986 par
[0] ? 0x80000000 : 0);
1988 gen_set_label(label1
);
1990 tcg_gen_div_i32(cpu_R
[arg
[0]],
1991 cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
1993 tcg_gen_rem_i32(cpu_R
[arg
[0]],
1994 cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
1996 gen_set_label(label2
);
1999 static void translate_quou(DisasContext
*dc
, const uint32_t arg
[],
2000 const uint32_t par
[])
2002 tcg_gen_divu_i32(cpu_R
[arg
[0]],
2003 cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
2006 static void translate_read_impwire(DisasContext
*dc
, const uint32_t arg
[],
2007 const uint32_t par
[])
2009 /* TODO: GPIO32 may be a part of coprocessor */
2010 tcg_gen_movi_i32(cpu_R
[arg
[0]], 0);
2013 static void translate_remu(DisasContext
*dc
, const uint32_t arg
[],
2014 const uint32_t par
[])
2016 tcg_gen_remu_i32(cpu_R
[arg
[0]],
2017 cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
2020 static void translate_rer(DisasContext
*dc
, const uint32_t arg
[],
2021 const uint32_t par
[])
2023 gen_helper_rer(cpu_R
[arg
[0]], cpu_env
, cpu_R
[arg
[1]]);
2026 static void translate_ret(DisasContext
*dc
, const uint32_t arg
[],
2027 const uint32_t par
[])
2029 gen_jump(dc
, cpu_R
[0]);
2032 static bool test_ill_retw(DisasContext
*dc
, const uint32_t arg
[],
2033 const uint32_t par
[])
2036 qemu_log_mask(LOG_GUEST_ERROR
,
2037 "Illegal retw instruction(pc = %08x)\n", dc
->pc
);
2040 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
2042 gen_helper_test_ill_retw(cpu_env
, tmp
);
2048 static void translate_retw(DisasContext
*dc
, const uint32_t arg
[],
2049 const uint32_t par
[])
2051 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
2052 gen_helper_retw(tmp
, cpu_env
, tmp
);
2057 static void translate_rfde(DisasContext
*dc
, const uint32_t arg
[],
2058 const uint32_t par
[])
2060 gen_jump(dc
, cpu_SR
[dc
->config
->ndepc
? DEPC
: EPC1
]);
2063 static void translate_rfe(DisasContext
*dc
, const uint32_t arg
[],
2064 const uint32_t par
[])
2066 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2067 gen_jump(dc
, cpu_SR
[EPC1
]);
2070 static void translate_rfi(DisasContext
*dc
, const uint32_t arg
[],
2071 const uint32_t par
[])
2073 tcg_gen_mov_i32(cpu_SR
[PS
], cpu_SR
[EPS2
+ arg
[0] - 2]);
2074 gen_jump(dc
, cpu_SR
[EPC1
+ arg
[0] - 1]);
2077 static void translate_rfw(DisasContext
*dc
, const uint32_t arg
[],
2078 const uint32_t par
[])
2080 TCGv_i32 tmp
= tcg_const_i32(1);
2082 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2083 tcg_gen_shl_i32(tmp
, tmp
, cpu_SR
[WINDOW_BASE
]);
2086 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2087 cpu_SR
[WINDOW_START
], tmp
);
2089 tcg_gen_or_i32(cpu_SR
[WINDOW_START
],
2090 cpu_SR
[WINDOW_START
], tmp
);
2094 gen_helper_restore_owb(cpu_env
);
2095 gen_jump(dc
, cpu_SR
[EPC1
]);
2098 static void translate_rotw(DisasContext
*dc
, const uint32_t arg
[],
2099 const uint32_t par
[])
2101 TCGv_i32 tmp
= tcg_const_i32(arg
[0]);
2102 gen_helper_rotw(cpu_env
, tmp
);
2106 static void translate_rsil(DisasContext
*dc
, const uint32_t arg
[],
2107 const uint32_t par
[])
2109 tcg_gen_mov_i32(cpu_R
[arg
[0]], cpu_SR
[PS
]);
2110 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_INTLEVEL
);
2111 tcg_gen_ori_i32(cpu_SR
[PS
], cpu_SR
[PS
], arg
[1]);
2114 static bool test_ill_rsr(DisasContext
*dc
, const uint32_t arg
[],
2115 const uint32_t par
[])
2117 return !check_sr(dc
, par
[0], SR_R
);
2120 static void translate_rsr(DisasContext
*dc
, const uint32_t arg
[],
2121 const uint32_t par
[])
2123 gen_rsr(dc
, cpu_R
[arg
[0]], par
[0]);
2126 static void translate_rtlb(DisasContext
*dc
, const uint32_t arg
[],
2127 const uint32_t par
[])
2129 #ifndef CONFIG_USER_ONLY
2130 static void (* const helper
[])(TCGv_i32 r
, TCGv_env env
, TCGv_i32 a1
,
2135 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2137 helper
[par
[1]](cpu_R
[arg
[0]], cpu_env
, cpu_R
[arg
[1]], dtlb
);
2138 tcg_temp_free(dtlb
);
2142 static void translate_rur(DisasContext
*dc
, const uint32_t arg
[],
2143 const uint32_t par
[])
2145 if (uregnames
[par
[0]].name
) {
2146 tcg_gen_mov_i32(cpu_R
[arg
[0]], cpu_UR
[par
[0]]);
2148 qemu_log_mask(LOG_UNIMP
, "RUR %d not implemented\n", par
[0]);
2152 static void translate_setb_expstate(DisasContext
*dc
, const uint32_t arg
[],
2153 const uint32_t par
[])
2155 /* TODO: GPIO32 may be a part of coprocessor */
2156 tcg_gen_ori_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], 1u << arg
[0]);
2159 #ifdef CONFIG_USER_ONLY
2160 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2164 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2166 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
2168 gen_helper_check_atomctl(cpu_env
, tpc
, addr
);
2173 static void translate_s32c1i(DisasContext
*dc
, const uint32_t arg
[],
2174 const uint32_t par
[])
2176 TCGv_i32 tmp
= tcg_temp_local_new_i32();
2177 TCGv_i32 addr
= tcg_temp_local_new_i32();
2179 tcg_gen_mov_i32(tmp
, cpu_R
[arg
[0]]);
2180 tcg_gen_addi_i32(addr
, cpu_R
[arg
[1]], arg
[2]);
2181 gen_load_store_alignment(dc
, 2, addr
, true);
2182 gen_check_atomctl(dc
, addr
);
2183 tcg_gen_atomic_cmpxchg_i32(cpu_R
[arg
[0]], addr
, cpu_SR
[SCOMPARE1
],
2184 tmp
, dc
->cring
, MO_TEUL
);
2185 tcg_temp_free(addr
);
2189 static void translate_s32e(DisasContext
*dc
, const uint32_t arg
[],
2190 const uint32_t par
[])
2192 TCGv_i32 addr
= tcg_temp_new_i32();
2194 tcg_gen_addi_i32(addr
, cpu_R
[arg
[1]], arg
[2]);
2195 gen_load_store_alignment(dc
, 2, addr
, false);
2196 tcg_gen_qemu_st_tl(cpu_R
[arg
[0]], addr
, dc
->ring
, MO_TEUL
);
2197 tcg_temp_free(addr
);
2200 static void translate_salt(DisasContext
*dc
, const uint32_t arg
[],
2201 const uint32_t par
[])
2203 tcg_gen_setcond_i32(par
[0],
2205 cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
2208 static void translate_sext(DisasContext
*dc
, const uint32_t arg
[],
2209 const uint32_t par
[])
2211 int shift
= 31 - arg
[2];
2214 tcg_gen_ext8s_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]]);
2215 } else if (shift
== 16) {
2216 tcg_gen_ext16s_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]]);
2218 TCGv_i32 tmp
= tcg_temp_new_i32();
2219 tcg_gen_shli_i32(tmp
, cpu_R
[arg
[1]], shift
);
2220 tcg_gen_sari_i32(cpu_R
[arg
[0]], tmp
, shift
);
2225 static bool test_ill_simcall(DisasContext
*dc
, const uint32_t arg
[],
2226 const uint32_t par
[])
2228 #ifdef CONFIG_USER_ONLY
2231 bool ill
= !semihosting_enabled();
2234 qemu_log_mask(LOG_GUEST_ERROR
, "SIMCALL but semihosting is disabled\n");
2239 static void translate_simcall(DisasContext
*dc
, const uint32_t arg
[],
2240 const uint32_t par
[])
2242 #ifndef CONFIG_USER_ONLY
2243 gen_helper_simcall(cpu_env
);
2248 * Note: 64 bit ops are used here solely because SAR values
2251 #define gen_shift_reg(cmd, reg) do { \
2252 TCGv_i64 tmp = tcg_temp_new_i64(); \
2253 tcg_gen_extu_i32_i64(tmp, reg); \
2254 tcg_gen_##cmd##_i64(v, v, tmp); \
2255 tcg_gen_extrl_i64_i32(cpu_R[arg[0]], v); \
2256 tcg_temp_free_i64(v); \
2257 tcg_temp_free_i64(tmp); \
2260 #define gen_shift(cmd) gen_shift_reg(cmd, cpu_SR[SAR])
2262 static void translate_sll(DisasContext
*dc
, const uint32_t arg
[],
2263 const uint32_t par
[])
2265 if (dc
->sar_m32_5bit
) {
2266 tcg_gen_shl_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], dc
->sar_m32
);
2268 TCGv_i64 v
= tcg_temp_new_i64();
2269 TCGv_i32 s
= tcg_const_i32(32);
2270 tcg_gen_sub_i32(s
, s
, cpu_SR
[SAR
]);
2271 tcg_gen_andi_i32(s
, s
, 0x3f);
2272 tcg_gen_extu_i32_i64(v
, cpu_R
[arg
[1]]);
2273 gen_shift_reg(shl
, s
);
2278 static void translate_slli(DisasContext
*dc
, const uint32_t arg
[],
2279 const uint32_t par
[])
2282 qemu_log_mask(LOG_GUEST_ERROR
, "slli a%d, a%d, 32 is undefined\n",
2285 tcg_gen_shli_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], arg
[2] & 0x1f);
2288 static void translate_sra(DisasContext
*dc
, const uint32_t arg
[],
2289 const uint32_t par
[])
2291 if (dc
->sar_m32_5bit
) {
2292 tcg_gen_sar_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], cpu_SR
[SAR
]);
2294 TCGv_i64 v
= tcg_temp_new_i64();
2295 tcg_gen_ext_i32_i64(v
, cpu_R
[arg
[1]]);
2300 static void translate_srai(DisasContext
*dc
, const uint32_t arg
[],
2301 const uint32_t par
[])
2303 tcg_gen_sari_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], arg
[2]);
2306 static void translate_src(DisasContext
*dc
, const uint32_t arg
[],
2307 const uint32_t par
[])
2309 TCGv_i64 v
= tcg_temp_new_i64();
2310 tcg_gen_concat_i32_i64(v
, cpu_R
[arg
[2]], cpu_R
[arg
[1]]);
2314 static void translate_srl(DisasContext
*dc
, const uint32_t arg
[],
2315 const uint32_t par
[])
2317 if (dc
->sar_m32_5bit
) {
2318 tcg_gen_shr_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], cpu_SR
[SAR
]);
2320 TCGv_i64 v
= tcg_temp_new_i64();
2321 tcg_gen_extu_i32_i64(v
, cpu_R
[arg
[1]]);
2327 #undef gen_shift_reg
2329 static void translate_srli(DisasContext
*dc
, const uint32_t arg
[],
2330 const uint32_t par
[])
2332 tcg_gen_shri_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], arg
[2]);
2335 static void translate_ssa8b(DisasContext
*dc
, const uint32_t arg
[],
2336 const uint32_t par
[])
2338 TCGv_i32 tmp
= tcg_temp_new_i32();
2339 tcg_gen_shli_i32(tmp
, cpu_R
[arg
[0]], 3);
2340 gen_left_shift_sar(dc
, tmp
);
2344 static void translate_ssa8l(DisasContext
*dc
, const uint32_t arg
[],
2345 const uint32_t par
[])
2347 TCGv_i32 tmp
= tcg_temp_new_i32();
2348 tcg_gen_shli_i32(tmp
, cpu_R
[arg
[0]], 3);
2349 gen_right_shift_sar(dc
, tmp
);
2353 static void translate_ssai(DisasContext
*dc
, const uint32_t arg
[],
2354 const uint32_t par
[])
2356 TCGv_i32 tmp
= tcg_const_i32(arg
[0]);
2357 gen_right_shift_sar(dc
, tmp
);
2361 static void translate_ssl(DisasContext
*dc
, const uint32_t arg
[],
2362 const uint32_t par
[])
2364 gen_left_shift_sar(dc
, cpu_R
[arg
[0]]);
2367 static void translate_ssr(DisasContext
*dc
, const uint32_t arg
[],
2368 const uint32_t par
[])
2370 gen_right_shift_sar(dc
, cpu_R
[arg
[0]]);
2373 static void translate_sub(DisasContext
*dc
, const uint32_t arg
[],
2374 const uint32_t par
[])
2376 tcg_gen_sub_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
2379 static void translate_subx(DisasContext
*dc
, const uint32_t arg
[],
2380 const uint32_t par
[])
2382 TCGv_i32 tmp
= tcg_temp_new_i32();
2383 tcg_gen_shli_i32(tmp
, cpu_R
[arg
[1]], par
[0]);
2384 tcg_gen_sub_i32(cpu_R
[arg
[0]], tmp
, cpu_R
[arg
[2]]);
2388 static void translate_waiti(DisasContext
*dc
, const uint32_t arg
[],
2389 const uint32_t par
[])
2391 #ifndef CONFIG_USER_ONLY
2392 gen_waiti(dc
, arg
[0]);
2396 static void translate_wtlb(DisasContext
*dc
, const uint32_t arg
[],
2397 const uint32_t par
[])
2399 #ifndef CONFIG_USER_ONLY
2400 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2402 gen_helper_wtlb(cpu_env
, cpu_R
[arg
[0]], cpu_R
[arg
[1]], dtlb
);
2403 tcg_temp_free(dtlb
);
2407 static void translate_wer(DisasContext
*dc
, const uint32_t arg
[],
2408 const uint32_t par
[])
2410 gen_helper_wer(cpu_env
, cpu_R
[arg
[0]], cpu_R
[arg
[1]]);
2413 static void translate_wrmsk_expstate(DisasContext
*dc
, const uint32_t arg
[],
2414 const uint32_t par
[])
2416 /* TODO: GPIO32 may be a part of coprocessor */
2417 tcg_gen_and_i32(cpu_UR
[EXPSTATE
], cpu_R
[arg
[0]], cpu_R
[arg
[1]]);
2420 static bool test_ill_wsr(DisasContext
*dc
, const uint32_t arg
[],
2421 const uint32_t par
[])
2423 return !check_sr(dc
, par
[0], SR_W
);
2426 static void translate_wsr(DisasContext
*dc
, const uint32_t arg
[],
2427 const uint32_t par
[])
2429 gen_wsr(dc
, par
[0], cpu_R
[arg
[0]]);
2432 static void translate_wur(DisasContext
*dc
, const uint32_t arg
[],
2433 const uint32_t par
[])
2435 if (uregnames
[par
[0]].name
) {
2436 gen_wur(par
[0], cpu_R
[arg
[0]]);
2438 qemu_log_mask(LOG_UNIMP
, "WUR %d not implemented\n", par
[0]);
2442 static void translate_xor(DisasContext
*dc
, const uint32_t arg
[],
2443 const uint32_t par
[])
2445 tcg_gen_xor_i32(cpu_R
[arg
[0]], cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
2448 static bool test_ill_xsr(DisasContext
*dc
, const uint32_t arg
[],
2449 const uint32_t par
[])
2451 return !check_sr(dc
, par
[0], SR_X
);
2454 static void translate_xsr(DisasContext
*dc
, const uint32_t arg
[],
2455 const uint32_t par
[])
2457 TCGv_i32 tmp
= tcg_temp_new_i32();
2459 tcg_gen_mov_i32(tmp
, cpu_R
[arg
[0]]);
2460 gen_rsr(dc
, cpu_R
[arg
[0]], par
[0]);
2461 gen_wsr(dc
, par
[0], tmp
);
2465 static const XtensaOpcodeOps core_ops
[] = {
2468 .translate
= translate_abs
,
2469 .windowed_register_op
= 0x3,
2472 .translate
= translate_add
,
2473 .windowed_register_op
= 0x7,
2476 .translate
= translate_add
,
2477 .windowed_register_op
= 0x7,
2480 .translate
= translate_addi
,
2481 .windowed_register_op
= 0x3,
2484 .translate
= translate_addi
,
2485 .windowed_register_op
= 0x3,
2488 .translate
= translate_addi
,
2489 .windowed_register_op
= 0x3,
2492 .translate
= translate_addx
,
2493 .par
= (const uint32_t[]){1},
2494 .windowed_register_op
= 0x7,
2497 .translate
= translate_addx
,
2498 .par
= (const uint32_t[]){2},
2499 .windowed_register_op
= 0x7,
2502 .translate
= translate_addx
,
2503 .par
= (const uint32_t[]){3},
2504 .windowed_register_op
= 0x7,
2507 .translate
= translate_all
,
2508 .par
= (const uint32_t[]){true, 4},
2511 .translate
= translate_all
,
2512 .par
= (const uint32_t[]){true, 8},
2515 .translate
= translate_and
,
2516 .windowed_register_op
= 0x7,
2519 .translate
= translate_boolean
,
2520 .par
= (const uint32_t[]){BOOLEAN_AND
},
2523 .translate
= translate_boolean
,
2524 .par
= (const uint32_t[]){BOOLEAN_ANDC
},
2527 .translate
= translate_all
,
2528 .par
= (const uint32_t[]){false, 4},
2531 .translate
= translate_all
,
2532 .par
= (const uint32_t[]){false, 8},
2535 .translate
= translate_ball
,
2536 .par
= (const uint32_t[]){TCG_COND_EQ
},
2537 .windowed_register_op
= 0x3,
2540 .translate
= translate_bany
,
2541 .par
= (const uint32_t[]){TCG_COND_NE
},
2542 .windowed_register_op
= 0x3,
2545 .translate
= translate_bb
,
2546 .par
= (const uint32_t[]){TCG_COND_EQ
},
2547 .windowed_register_op
= 0x3,
2550 .translate
= translate_bbi
,
2551 .par
= (const uint32_t[]){TCG_COND_EQ
},
2552 .windowed_register_op
= 0x1,
2555 .translate
= translate_bb
,
2556 .par
= (const uint32_t[]){TCG_COND_NE
},
2557 .windowed_register_op
= 0x3,
2560 .translate
= translate_bbi
,
2561 .par
= (const uint32_t[]){TCG_COND_NE
},
2562 .windowed_register_op
= 0x1,
2565 .translate
= translate_b
,
2566 .par
= (const uint32_t[]){TCG_COND_EQ
},
2567 .windowed_register_op
= 0x3,
2570 .translate
= translate_bi
,
2571 .par
= (const uint32_t[]){TCG_COND_EQ
},
2572 .windowed_register_op
= 0x1,
2575 .translate
= translate_bz
,
2576 .par
= (const uint32_t[]){TCG_COND_EQ
},
2577 .windowed_register_op
= 0x1,
2580 .translate
= translate_bz
,
2581 .par
= (const uint32_t[]){TCG_COND_EQ
},
2582 .windowed_register_op
= 0x1,
2585 .translate
= translate_bp
,
2586 .par
= (const uint32_t[]){TCG_COND_EQ
},
2589 .translate
= translate_b
,
2590 .par
= (const uint32_t[]){TCG_COND_GE
},
2591 .windowed_register_op
= 0x3,
2594 .translate
= translate_bi
,
2595 .par
= (const uint32_t[]){TCG_COND_GE
},
2596 .windowed_register_op
= 0x1,
2599 .translate
= translate_b
,
2600 .par
= (const uint32_t[]){TCG_COND_GEU
},
2601 .windowed_register_op
= 0x3,
2604 .translate
= translate_bi
,
2605 .par
= (const uint32_t[]){TCG_COND_GEU
},
2606 .windowed_register_op
= 0x1,
2609 .translate
= translate_bz
,
2610 .par
= (const uint32_t[]){TCG_COND_GE
},
2611 .windowed_register_op
= 0x1,
2614 .translate
= translate_b
,
2615 .par
= (const uint32_t[]){TCG_COND_LT
},
2616 .windowed_register_op
= 0x3,
2619 .translate
= translate_bi
,
2620 .par
= (const uint32_t[]){TCG_COND_LT
},
2621 .windowed_register_op
= 0x1,
2624 .translate
= translate_b
,
2625 .par
= (const uint32_t[]){TCG_COND_LTU
},
2626 .windowed_register_op
= 0x3,
2629 .translate
= translate_bi
,
2630 .par
= (const uint32_t[]){TCG_COND_LTU
},
2631 .windowed_register_op
= 0x1,
2634 .translate
= translate_bz
,
2635 .par
= (const uint32_t[]){TCG_COND_LT
},
2636 .windowed_register_op
= 0x1,
2639 .translate
= translate_ball
,
2640 .par
= (const uint32_t[]){TCG_COND_NE
},
2641 .windowed_register_op
= 0x3,
2644 .translate
= translate_b
,
2645 .par
= (const uint32_t[]){TCG_COND_NE
},
2646 .windowed_register_op
= 0x3,
2649 .translate
= translate_bi
,
2650 .par
= (const uint32_t[]){TCG_COND_NE
},
2651 .windowed_register_op
= 0x1,
2654 .translate
= translate_bz
,
2655 .par
= (const uint32_t[]){TCG_COND_NE
},
2656 .windowed_register_op
= 0x1,
2659 .translate
= translate_bz
,
2660 .par
= (const uint32_t[]){TCG_COND_NE
},
2661 .windowed_register_op
= 0x1,
2664 .translate
= translate_bany
,
2665 .par
= (const uint32_t[]){TCG_COND_EQ
},
2666 .windowed_register_op
= 0x3,
2669 .translate
= translate_nop
,
2670 .par
= (const uint32_t[]){DEBUGCAUSE_BI
},
2671 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
2674 .translate
= translate_nop
,
2675 .par
= (const uint32_t[]){DEBUGCAUSE_BN
},
2676 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
2679 .translate
= translate_bp
,
2680 .par
= (const uint32_t[]){TCG_COND_NE
},
2683 .translate
= translate_call0
,
2686 .translate
= translate_callw
,
2687 .test_overflow
= test_overflow_callw
,
2688 .par
= (const uint32_t[]){3},
2691 .translate
= translate_callw
,
2692 .test_overflow
= test_overflow_callw
,
2693 .par
= (const uint32_t[]){1},
2696 .translate
= translate_callw
,
2697 .test_overflow
= test_overflow_callw
,
2698 .par
= (const uint32_t[]){2},
2701 .translate
= translate_callx0
,
2702 .windowed_register_op
= 0x1,
2705 .translate
= translate_callxw
,
2706 .test_overflow
= test_overflow_callw
,
2707 .par
= (const uint32_t[]){3},
2708 .windowed_register_op
= 0x1,
2711 .translate
= translate_callxw
,
2712 .test_overflow
= test_overflow_callw
,
2713 .par
= (const uint32_t[]){1},
2714 .windowed_register_op
= 0x1,
2717 .translate
= translate_callxw
,
2718 .test_overflow
= test_overflow_callw
,
2719 .par
= (const uint32_t[]){2},
2720 .windowed_register_op
= 0x1,
2723 .translate
= translate_clamps
,
2724 .windowed_register_op
= 0x3,
2726 .name
= "clrb_expstate",
2727 .translate
= translate_clrb_expstate
,
2730 .translate
= translate_const16
,
2731 .windowed_register_op
= 0x1,
2734 .translate
= translate_depbits
,
2735 .windowed_register_op
= 0x3,
2738 .translate
= translate_dcache
,
2739 .op_flags
= XTENSA_OP_PRIVILEGED
,
2740 .windowed_register_op
= 0x1,
2743 .translate
= translate_dcache
,
2744 .op_flags
= XTENSA_OP_PRIVILEGED
,
2745 .windowed_register_op
= 0x1,
2748 .translate
= translate_dcache
,
2749 .windowed_register_op
= 0x1,
2752 .translate
= translate_dcache
,
2753 .windowed_register_op
= 0x1,
2756 .translate
= translate_nop
,
2757 .op_flags
= XTENSA_OP_PRIVILEGED
,
2758 .windowed_register_op
= 0x1,
2761 .translate
= translate_nop
,
2762 .op_flags
= XTENSA_OP_PRIVILEGED
,
2763 .windowed_register_op
= 0x1,
2766 .translate
= translate_nop
,
2767 .op_flags
= XTENSA_OP_PRIVILEGED
,
2768 .windowed_register_op
= 0x1,
2771 .translate
= translate_nop
,
2772 .op_flags
= XTENSA_OP_PRIVILEGED
,
2773 .windowed_register_op
= 0x1,
2776 .translate
= translate_dcache
,
2777 .op_flags
= XTENSA_OP_PRIVILEGED
,
2778 .windowed_register_op
= 0x1,
2781 .translate
= translate_nop
,
2782 .windowed_register_op
= 0x1,
2785 .translate
= translate_nop
,
2786 .windowed_register_op
= 0x1,
2789 .translate
= translate_nop
,
2790 .windowed_register_op
= 0x1,
2793 .translate
= translate_nop
,
2794 .windowed_register_op
= 0x1,
2797 .translate
= translate_nop
,
2800 .translate
= translate_entry
,
2801 .test_ill
= test_ill_entry
,
2802 .test_overflow
= test_overflow_entry
,
2803 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
2806 .translate
= translate_nop
,
2809 .translate
= translate_nop
,
2812 .translate
= translate_extui
,
2813 .windowed_register_op
= 0x3,
2816 .translate
= translate_memw
,
2819 .op_flags
= XTENSA_OP_ILL
,
2822 .op_flags
= XTENSA_OP_ILL
,
2825 .translate
= translate_itlb
,
2826 .par
= (const uint32_t[]){true},
2827 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
2828 .windowed_register_op
= 0x1,
2831 .translate
= translate_icache
,
2832 .windowed_register_op
= 0x1,
2835 .translate
= translate_icache
,
2836 .op_flags
= XTENSA_OP_PRIVILEGED
,
2837 .windowed_register_op
= 0x1,
2840 .translate
= translate_nop
,
2841 .op_flags
= XTENSA_OP_PRIVILEGED
,
2842 .windowed_register_op
= 0x1,
2845 .translate
= translate_itlb
,
2846 .par
= (const uint32_t[]){false},
2847 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
2848 .windowed_register_op
= 0x1,
2851 .translate
= translate_nop
,
2852 .op_flags
= XTENSA_OP_PRIVILEGED
,
2853 .windowed_register_op
= 0x1,
2856 .op_flags
= XTENSA_OP_ILL
,
2859 .op_flags
= XTENSA_OP_ILL
,
2862 .translate
= translate_nop
,
2863 .windowed_register_op
= 0x1,
2866 .translate
= translate_icache
,
2867 .op_flags
= XTENSA_OP_PRIVILEGED
,
2868 .windowed_register_op
= 0x1,
2871 .translate
= translate_nop
,
2874 .translate
= translate_j
,
2877 .translate
= translate_jx
,
2878 .windowed_register_op
= 0x1,
2881 .translate
= translate_ldst
,
2882 .par
= (const uint32_t[]){MO_TESW
, false, false},
2883 .windowed_register_op
= 0x3,
2886 .translate
= translate_ldst
,
2887 .par
= (const uint32_t[]){MO_TEUW
, false, false},
2888 .windowed_register_op
= 0x3,
2891 .translate
= translate_ldst
,
2892 .par
= (const uint32_t[]){MO_TEUL
, true, false},
2893 .windowed_register_op
= 0x3,
2896 .translate
= translate_l32e
,
2897 .op_flags
= XTENSA_OP_PRIVILEGED
,
2898 .windowed_register_op
= 0x3,
2901 .translate
= translate_ldst
,
2902 .par
= (const uint32_t[]){MO_TEUL
, false, false},
2903 .windowed_register_op
= 0x3,
2906 .translate
= translate_ldst
,
2907 .par
= (const uint32_t[]){MO_TEUL
, false, false},
2908 .windowed_register_op
= 0x3,
2911 .translate
= translate_l32r
,
2912 .windowed_register_op
= 0x1,
2915 .translate
= translate_ldst
,
2916 .par
= (const uint32_t[]){MO_UB
, false, false},
2917 .windowed_register_op
= 0x3,
2920 .translate
= translate_mac16
,
2921 .par
= (const uint32_t[]){MAC16_NONE
, 0, 0, -4},
2922 .windowed_register_op
= 0x2,
2925 .translate
= translate_mac16
,
2926 .par
= (const uint32_t[]){MAC16_NONE
, 0, 0, 4},
2927 .windowed_register_op
= 0x2,
2930 .op_flags
= XTENSA_OP_ILL
,
2933 .translate
= translate_loop
,
2934 .par
= (const uint32_t[]){TCG_COND_NEVER
},
2935 .windowed_register_op
= 0x1,
2938 .translate
= translate_loop
,
2939 .par
= (const uint32_t[]){TCG_COND_GT
},
2940 .windowed_register_op
= 0x1,
2943 .translate
= translate_loop
,
2944 .par
= (const uint32_t[]){TCG_COND_NE
},
2945 .windowed_register_op
= 0x1,
2948 .translate
= translate_smax
,
2949 .windowed_register_op
= 0x7,
2952 .translate
= translate_umax
,
2953 .windowed_register_op
= 0x7,
2956 .translate
= translate_memw
,
2959 .translate
= translate_smin
,
2960 .windowed_register_op
= 0x7,
2963 .translate
= translate_umin
,
2964 .windowed_register_op
= 0x7,
2967 .translate
= translate_mov
,
2968 .windowed_register_op
= 0x3,
2971 .translate
= translate_mov
,
2972 .windowed_register_op
= 0x3,
2975 .translate
= translate_movcond
,
2976 .par
= (const uint32_t[]){TCG_COND_EQ
},
2977 .windowed_register_op
= 0x7,
2980 .translate
= translate_movp
,
2981 .par
= (const uint32_t[]){TCG_COND_EQ
},
2982 .windowed_register_op
= 0x3,
2985 .translate
= translate_movcond
,
2986 .par
= (const uint32_t[]){TCG_COND_GE
},
2987 .windowed_register_op
= 0x7,
2990 .translate
= translate_movi
,
2991 .windowed_register_op
= 0x1,
2994 .translate
= translate_movi
,
2995 .windowed_register_op
= 0x1,
2998 .translate
= translate_movcond
,
2999 .par
= (const uint32_t[]){TCG_COND_LT
},
3000 .windowed_register_op
= 0x7,
3003 .translate
= translate_movcond
,
3004 .par
= (const uint32_t[]){TCG_COND_NE
},
3005 .windowed_register_op
= 0x7,
3008 .translate
= translate_movsp
,
3009 .windowed_register_op
= 0x3,
3010 .op_flags
= XTENSA_OP_ALLOCA
,
3013 .translate
= translate_movp
,
3014 .par
= (const uint32_t[]){TCG_COND_NE
},
3015 .windowed_register_op
= 0x3,
3017 .name
= "mul.aa.hh",
3018 .translate
= translate_mac16
,
3019 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_AA
, MAC16_HH
, 0},
3020 .windowed_register_op
= 0x3,
3022 .name
= "mul.aa.hl",
3023 .translate
= translate_mac16
,
3024 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_AA
, MAC16_HL
, 0},
3025 .windowed_register_op
= 0x3,
3027 .name
= "mul.aa.lh",
3028 .translate
= translate_mac16
,
3029 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_AA
, MAC16_LH
, 0},
3030 .windowed_register_op
= 0x3,
3032 .name
= "mul.aa.ll",
3033 .translate
= translate_mac16
,
3034 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_AA
, MAC16_LL
, 0},
3035 .windowed_register_op
= 0x3,
3037 .name
= "mul.ad.hh",
3038 .translate
= translate_mac16
,
3039 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_AD
, MAC16_HH
, 0},
3040 .windowed_register_op
= 0x1,
3042 .name
= "mul.ad.hl",
3043 .translate
= translate_mac16
,
3044 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_AD
, MAC16_HL
, 0},
3045 .windowed_register_op
= 0x1,
3047 .name
= "mul.ad.lh",
3048 .translate
= translate_mac16
,
3049 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_AD
, MAC16_LH
, 0},
3050 .windowed_register_op
= 0x1,
3052 .name
= "mul.ad.ll",
3053 .translate
= translate_mac16
,
3054 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_AD
, MAC16_LL
, 0},
3055 .windowed_register_op
= 0x1,
3057 .name
= "mul.da.hh",
3058 .translate
= translate_mac16
,
3059 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_DA
, MAC16_HH
, 0},
3060 .windowed_register_op
= 0x2,
3062 .name
= "mul.da.hl",
3063 .translate
= translate_mac16
,
3064 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_DA
, MAC16_HL
, 0},
3065 .windowed_register_op
= 0x2,
3067 .name
= "mul.da.lh",
3068 .translate
= translate_mac16
,
3069 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_DA
, MAC16_LH
, 0},
3070 .windowed_register_op
= 0x2,
3072 .name
= "mul.da.ll",
3073 .translate
= translate_mac16
,
3074 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_DA
, MAC16_LL
, 0},
3075 .windowed_register_op
= 0x2,
3077 .name
= "mul.dd.hh",
3078 .translate
= translate_mac16
,
3079 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_DD
, MAC16_HH
, 0},
3081 .name
= "mul.dd.hl",
3082 .translate
= translate_mac16
,
3083 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_DD
, MAC16_HL
, 0},
3085 .name
= "mul.dd.lh",
3086 .translate
= translate_mac16
,
3087 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_DD
, MAC16_LH
, 0},
3089 .name
= "mul.dd.ll",
3090 .translate
= translate_mac16
,
3091 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_DD
, MAC16_LL
, 0},
3094 .translate
= translate_mul16
,
3095 .par
= (const uint32_t[]){true},
3096 .windowed_register_op
= 0x7,
3099 .translate
= translate_mul16
,
3100 .par
= (const uint32_t[]){false},
3101 .windowed_register_op
= 0x7,
3103 .name
= "mula.aa.hh",
3104 .translate
= translate_mac16
,
3105 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_AA
, MAC16_HH
, 0},
3106 .windowed_register_op
= 0x3,
3108 .name
= "mula.aa.hl",
3109 .translate
= translate_mac16
,
3110 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_AA
, MAC16_HL
, 0},
3111 .windowed_register_op
= 0x3,
3113 .name
= "mula.aa.lh",
3114 .translate
= translate_mac16
,
3115 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_AA
, MAC16_LH
, 0},
3116 .windowed_register_op
= 0x3,
3118 .name
= "mula.aa.ll",
3119 .translate
= translate_mac16
,
3120 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_AA
, MAC16_LL
, 0},
3121 .windowed_register_op
= 0x3,
3123 .name
= "mula.ad.hh",
3124 .translate
= translate_mac16
,
3125 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_AD
, MAC16_HH
, 0},
3126 .windowed_register_op
= 0x1,
3128 .name
= "mula.ad.hl",
3129 .translate
= translate_mac16
,
3130 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_AD
, MAC16_HL
, 0},
3131 .windowed_register_op
= 0x1,
3133 .name
= "mula.ad.lh",
3134 .translate
= translate_mac16
,
3135 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_AD
, MAC16_LH
, 0},
3136 .windowed_register_op
= 0x1,
3138 .name
= "mula.ad.ll",
3139 .translate
= translate_mac16
,
3140 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_AD
, MAC16_LL
, 0},
3141 .windowed_register_op
= 0x1,
3143 .name
= "mula.da.hh",
3144 .translate
= translate_mac16
,
3145 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DA
, MAC16_HH
, 0},
3146 .windowed_register_op
= 0x2,
3148 .name
= "mula.da.hh.lddec",
3149 .translate
= translate_mac16
,
3150 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DA
, MAC16_HH
, -4},
3151 .windowed_register_op
= 0xa,
3153 .name
= "mula.da.hh.ldinc",
3154 .translate
= translate_mac16
,
3155 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DA
, MAC16_HH
, 4},
3156 .windowed_register_op
= 0xa,
3158 .name
= "mula.da.hl",
3159 .translate
= translate_mac16
,
3160 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DA
, MAC16_HL
, 0},
3161 .windowed_register_op
= 0x2,
3163 .name
= "mula.da.hl.lddec",
3164 .translate
= translate_mac16
,
3165 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DA
, MAC16_HL
, -4},
3166 .windowed_register_op
= 0xa,
3168 .name
= "mula.da.hl.ldinc",
3169 .translate
= translate_mac16
,
3170 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DA
, MAC16_HL
, 4},
3171 .windowed_register_op
= 0xa,
3173 .name
= "mula.da.lh",
3174 .translate
= translate_mac16
,
3175 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DA
, MAC16_LH
, 0},
3176 .windowed_register_op
= 0x2,
3178 .name
= "mula.da.lh.lddec",
3179 .translate
= translate_mac16
,
3180 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DA
, MAC16_LH
, -4},
3181 .windowed_register_op
= 0xa,
3183 .name
= "mula.da.lh.ldinc",
3184 .translate
= translate_mac16
,
3185 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DA
, MAC16_LH
, 4},
3186 .windowed_register_op
= 0xa,
3188 .name
= "mula.da.ll",
3189 .translate
= translate_mac16
,
3190 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DA
, MAC16_LL
, 0},
3191 .windowed_register_op
= 0x2,
3193 .name
= "mula.da.ll.lddec",
3194 .translate
= translate_mac16
,
3195 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DA
, MAC16_LL
, -4},
3196 .windowed_register_op
= 0xa,
3198 .name
= "mula.da.ll.ldinc",
3199 .translate
= translate_mac16
,
3200 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DA
, MAC16_LL
, 4},
3201 .windowed_register_op
= 0xa,
3203 .name
= "mula.dd.hh",
3204 .translate
= translate_mac16
,
3205 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DD
, MAC16_HH
, 0},
3207 .name
= "mula.dd.hh.lddec",
3208 .translate
= translate_mac16
,
3209 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DD
, MAC16_HH
, -4},
3210 .windowed_register_op
= 0x2,
3212 .name
= "mula.dd.hh.ldinc",
3213 .translate
= translate_mac16
,
3214 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DD
, MAC16_HH
, 4},
3215 .windowed_register_op
= 0x2,
3217 .name
= "mula.dd.hl",
3218 .translate
= translate_mac16
,
3219 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DD
, MAC16_HL
, 0},
3221 .name
= "mula.dd.hl.lddec",
3222 .translate
= translate_mac16
,
3223 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DD
, MAC16_HL
, -4},
3224 .windowed_register_op
= 0x2,
3226 .name
= "mula.dd.hl.ldinc",
3227 .translate
= translate_mac16
,
3228 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DD
, MAC16_HL
, 4},
3229 .windowed_register_op
= 0x2,
3231 .name
= "mula.dd.lh",
3232 .translate
= translate_mac16
,
3233 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DD
, MAC16_LH
, 0},
3235 .name
= "mula.dd.lh.lddec",
3236 .translate
= translate_mac16
,
3237 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DD
, MAC16_LH
, -4},
3238 .windowed_register_op
= 0x2,
3240 .name
= "mula.dd.lh.ldinc",
3241 .translate
= translate_mac16
,
3242 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DD
, MAC16_LH
, 4},
3243 .windowed_register_op
= 0x2,
3245 .name
= "mula.dd.ll",
3246 .translate
= translate_mac16
,
3247 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DD
, MAC16_LL
, 0},
3249 .name
= "mula.dd.ll.lddec",
3250 .translate
= translate_mac16
,
3251 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DD
, MAC16_LL
, -4},
3252 .windowed_register_op
= 0x2,
3254 .name
= "mula.dd.ll.ldinc",
3255 .translate
= translate_mac16
,
3256 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_DD
, MAC16_LL
, 4},
3257 .windowed_register_op
= 0x2,
3260 .translate
= translate_mull
,
3261 .windowed_register_op
= 0x7,
3263 .name
= "muls.aa.hh",
3264 .translate
= translate_mac16
,
3265 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_AA
, MAC16_HH
, 0},
3266 .windowed_register_op
= 0x3,
3268 .name
= "muls.aa.hl",
3269 .translate
= translate_mac16
,
3270 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_AA
, MAC16_HL
, 0},
3271 .windowed_register_op
= 0x3,
3273 .name
= "muls.aa.lh",
3274 .translate
= translate_mac16
,
3275 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_AA
, MAC16_LH
, 0},
3276 .windowed_register_op
= 0x3,
3278 .name
= "muls.aa.ll",
3279 .translate
= translate_mac16
,
3280 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_AA
, MAC16_LL
, 0},
3281 .windowed_register_op
= 0x3,
3283 .name
= "muls.ad.hh",
3284 .translate
= translate_mac16
,
3285 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_AD
, MAC16_HH
, 0},
3286 .windowed_register_op
= 0x1,
3288 .name
= "muls.ad.hl",
3289 .translate
= translate_mac16
,
3290 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_AD
, MAC16_HL
, 0},
3291 .windowed_register_op
= 0x1,
3293 .name
= "muls.ad.lh",
3294 .translate
= translate_mac16
,
3295 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_AD
, MAC16_LH
, 0},
3296 .windowed_register_op
= 0x1,
3298 .name
= "muls.ad.ll",
3299 .translate
= translate_mac16
,
3300 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_AD
, MAC16_LL
, 0},
3301 .windowed_register_op
= 0x1,
3303 .name
= "muls.da.hh",
3304 .translate
= translate_mac16
,
3305 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_DA
, MAC16_HH
, 0},
3306 .windowed_register_op
= 0x2,
3308 .name
= "muls.da.hl",
3309 .translate
= translate_mac16
,
3310 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_DA
, MAC16_HL
, 0},
3311 .windowed_register_op
= 0x2,
3313 .name
= "muls.da.lh",
3314 .translate
= translate_mac16
,
3315 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_DA
, MAC16_LH
, 0},
3316 .windowed_register_op
= 0x2,
3318 .name
= "muls.da.ll",
3319 .translate
= translate_mac16
,
3320 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_DA
, MAC16_LL
, 0},
3321 .windowed_register_op
= 0x2,
3323 .name
= "muls.dd.hh",
3324 .translate
= translate_mac16
,
3325 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_DD
, MAC16_HH
, 0},
3327 .name
= "muls.dd.hl",
3328 .translate
= translate_mac16
,
3329 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_DD
, MAC16_HL
, 0},
3331 .name
= "muls.dd.lh",
3332 .translate
= translate_mac16
,
3333 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_DD
, MAC16_LH
, 0},
3335 .name
= "muls.dd.ll",
3336 .translate
= translate_mac16
,
3337 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_DD
, MAC16_LL
, 0},
3340 .translate
= translate_mulh
,
3341 .par
= (const uint32_t[]){true},
3342 .windowed_register_op
= 0x7,
3345 .translate
= translate_mulh
,
3346 .par
= (const uint32_t[]){false},
3347 .windowed_register_op
= 0x7,
3350 .translate
= translate_neg
,
3351 .windowed_register_op
= 0x3,
3354 .translate
= translate_nop
,
3357 .translate
= translate_nop
,
3360 .translate
= translate_nsa
,
3361 .windowed_register_op
= 0x3,
3364 .translate
= translate_nsau
,
3365 .windowed_register_op
= 0x3,
3368 .translate
= translate_or
,
3369 .windowed_register_op
= 0x7,
3372 .translate
= translate_boolean
,
3373 .par
= (const uint32_t[]){BOOLEAN_OR
},
3376 .translate
= translate_boolean
,
3377 .par
= (const uint32_t[]){BOOLEAN_ORC
},
3380 .translate
= translate_ptlb
,
3381 .par
= (const uint32_t[]){true},
3382 .op_flags
= XTENSA_OP_PRIVILEGED
,
3383 .windowed_register_op
= 0x3,
3386 .translate
= translate_ptlb
,
3387 .par
= (const uint32_t[]){false},
3388 .op_flags
= XTENSA_OP_PRIVILEGED
,
3389 .windowed_register_op
= 0x3,
3392 .translate
= translate_quos
,
3393 .par
= (const uint32_t[]){true},
3394 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3395 .windowed_register_op
= 0x7,
3398 .translate
= translate_quou
,
3399 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3400 .windowed_register_op
= 0x7,
3403 .translate
= translate_rtlb
,
3404 .par
= (const uint32_t[]){true, 0},
3405 .op_flags
= XTENSA_OP_PRIVILEGED
,
3406 .windowed_register_op
= 0x3,
3409 .translate
= translate_rtlb
,
3410 .par
= (const uint32_t[]){true, 1},
3411 .op_flags
= XTENSA_OP_PRIVILEGED
,
3412 .windowed_register_op
= 0x3,
3414 .name
= "read_impwire",
3415 .translate
= translate_read_impwire
,
3416 .windowed_register_op
= 0x1,
3419 .translate
= translate_quos
,
3420 .par
= (const uint32_t[]){false},
3421 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3422 .windowed_register_op
= 0x7,
3425 .translate
= translate_remu
,
3426 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3427 .windowed_register_op
= 0x7,
3430 .translate
= translate_rer
,
3431 .op_flags
= XTENSA_OP_PRIVILEGED
,
3432 .windowed_register_op
= 0x3,
3435 .translate
= translate_ret
,
3438 .translate
= translate_ret
,
3441 .translate
= translate_retw
,
3442 .test_ill
= test_ill_retw
,
3443 .op_flags
= XTENSA_OP_UNDERFLOW
,
3446 .translate
= translate_retw
,
3447 .test_ill
= test_ill_retw
,
3448 .op_flags
= XTENSA_OP_UNDERFLOW
,
3451 .op_flags
= XTENSA_OP_ILL
,
3454 .translate
= translate_rfde
,
3455 .op_flags
= XTENSA_OP_PRIVILEGED
,
3458 .op_flags
= XTENSA_OP_ILL
,
3461 .translate
= translate_rfe
,
3462 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3465 .translate
= translate_rfi
,
3466 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3469 .translate
= translate_rfw
,
3470 .par
= (const uint32_t[]){true},
3471 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3474 .translate
= translate_rfw
,
3475 .par
= (const uint32_t[]){false},
3476 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3479 .translate
= translate_rtlb
,
3480 .par
= (const uint32_t[]){false, 0},
3481 .op_flags
= XTENSA_OP_PRIVILEGED
,
3482 .windowed_register_op
= 0x3,
3485 .translate
= translate_rtlb
,
3486 .par
= (const uint32_t[]){false, 1},
3487 .op_flags
= XTENSA_OP_PRIVILEGED
,
3488 .windowed_register_op
= 0x3,
3491 .translate
= translate_rotw
,
3492 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3495 .translate
= translate_rsil
,
3497 XTENSA_OP_PRIVILEGED
|
3498 XTENSA_OP_EXIT_TB_0
|
3499 XTENSA_OP_CHECK_INTERRUPTS
,
3500 .windowed_register_op
= 0x1,
3503 .translate
= translate_rsr
,
3504 .test_ill
= test_ill_rsr
,
3505 .par
= (const uint32_t[]){176},
3506 .op_flags
= XTENSA_OP_PRIVILEGED
,
3507 .windowed_register_op
= 0x1,
3510 .translate
= translate_rsr
,
3511 .test_ill
= test_ill_rsr
,
3512 .par
= (const uint32_t[]){208},
3513 .op_flags
= XTENSA_OP_PRIVILEGED
,
3514 .windowed_register_op
= 0x1,
3516 .name
= "rsr.acchi",
3517 .translate
= translate_rsr
,
3518 .test_ill
= test_ill_rsr
,
3519 .par
= (const uint32_t[]){ACCHI
},
3520 .windowed_register_op
= 0x1,
3522 .name
= "rsr.acclo",
3523 .translate
= translate_rsr
,
3524 .test_ill
= test_ill_rsr
,
3525 .par
= (const uint32_t[]){ACCLO
},
3526 .windowed_register_op
= 0x1,
3528 .name
= "rsr.atomctl",
3529 .translate
= translate_rsr
,
3530 .test_ill
= test_ill_rsr
,
3531 .par
= (const uint32_t[]){ATOMCTL
},
3532 .op_flags
= XTENSA_OP_PRIVILEGED
,
3533 .windowed_register_op
= 0x1,
3536 .translate
= translate_rsr
,
3537 .test_ill
= test_ill_rsr
,
3538 .par
= (const uint32_t[]){BR
},
3539 .windowed_register_op
= 0x1,
3541 .name
= "rsr.cacheattr",
3542 .translate
= translate_rsr
,
3543 .test_ill
= test_ill_rsr
,
3544 .par
= (const uint32_t[]){CACHEATTR
},
3545 .op_flags
= XTENSA_OP_PRIVILEGED
,
3546 .windowed_register_op
= 0x1,
3548 .name
= "rsr.ccompare0",
3549 .translate
= translate_rsr
,
3550 .test_ill
= test_ill_rsr
,
3551 .par
= (const uint32_t[]){CCOMPARE
},
3552 .op_flags
= XTENSA_OP_PRIVILEGED
,
3553 .windowed_register_op
= 0x1,
3555 .name
= "rsr.ccompare1",
3556 .translate
= translate_rsr
,
3557 .test_ill
= test_ill_rsr
,
3558 .par
= (const uint32_t[]){CCOMPARE
+ 1},
3559 .op_flags
= XTENSA_OP_PRIVILEGED
,
3560 .windowed_register_op
= 0x1,
3562 .name
= "rsr.ccompare2",
3563 .translate
= translate_rsr
,
3564 .test_ill
= test_ill_rsr
,
3565 .par
= (const uint32_t[]){CCOMPARE
+ 2},
3566 .op_flags
= XTENSA_OP_PRIVILEGED
,
3567 .windowed_register_op
= 0x1,
3569 .name
= "rsr.ccount",
3570 .translate
= translate_rsr
,
3571 .test_ill
= test_ill_rsr
,
3572 .par
= (const uint32_t[]){CCOUNT
},
3573 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
3574 .windowed_register_op
= 0x1,
3576 .name
= "rsr.configid0",
3577 .translate
= translate_rsr
,
3578 .test_ill
= test_ill_rsr
,
3579 .par
= (const uint32_t[]){CONFIGID0
},
3580 .op_flags
= XTENSA_OP_PRIVILEGED
,
3581 .windowed_register_op
= 0x1,
3583 .name
= "rsr.configid1",
3584 .translate
= translate_rsr
,
3585 .test_ill
= test_ill_rsr
,
3586 .par
= (const uint32_t[]){CONFIGID1
},
3587 .op_flags
= XTENSA_OP_PRIVILEGED
,
3588 .windowed_register_op
= 0x1,
3590 .name
= "rsr.cpenable",
3591 .translate
= translate_rsr
,
3592 .test_ill
= test_ill_rsr
,
3593 .par
= (const uint32_t[]){CPENABLE
},
3594 .op_flags
= XTENSA_OP_PRIVILEGED
,
3595 .windowed_register_op
= 0x1,
3597 .name
= "rsr.dbreaka0",
3598 .translate
= translate_rsr
,
3599 .test_ill
= test_ill_rsr
,
3600 .par
= (const uint32_t[]){DBREAKA
},
3601 .op_flags
= XTENSA_OP_PRIVILEGED
,
3602 .windowed_register_op
= 0x1,
3604 .name
= "rsr.dbreaka1",
3605 .translate
= translate_rsr
,
3606 .test_ill
= test_ill_rsr
,
3607 .par
= (const uint32_t[]){DBREAKA
+ 1},
3608 .op_flags
= XTENSA_OP_PRIVILEGED
,
3609 .windowed_register_op
= 0x1,
3611 .name
= "rsr.dbreakc0",
3612 .translate
= translate_rsr
,
3613 .test_ill
= test_ill_rsr
,
3614 .par
= (const uint32_t[]){DBREAKC
},
3615 .op_flags
= XTENSA_OP_PRIVILEGED
,
3616 .windowed_register_op
= 0x1,
3618 .name
= "rsr.dbreakc1",
3619 .translate
= translate_rsr
,
3620 .test_ill
= test_ill_rsr
,
3621 .par
= (const uint32_t[]){DBREAKC
+ 1},
3622 .op_flags
= XTENSA_OP_PRIVILEGED
,
3623 .windowed_register_op
= 0x1,
3626 .translate
= translate_rsr
,
3627 .test_ill
= test_ill_rsr
,
3628 .par
= (const uint32_t[]){DDR
},
3629 .op_flags
= XTENSA_OP_PRIVILEGED
,
3630 .windowed_register_op
= 0x1,
3632 .name
= "rsr.debugcause",
3633 .translate
= translate_rsr
,
3634 .test_ill
= test_ill_rsr
,
3635 .par
= (const uint32_t[]){DEBUGCAUSE
},
3636 .op_flags
= XTENSA_OP_PRIVILEGED
,
3637 .windowed_register_op
= 0x1,
3640 .translate
= translate_rsr
,
3641 .test_ill
= test_ill_rsr
,
3642 .par
= (const uint32_t[]){DEPC
},
3643 .op_flags
= XTENSA_OP_PRIVILEGED
,
3644 .windowed_register_op
= 0x1,
3646 .name
= "rsr.dtlbcfg",
3647 .translate
= translate_rsr
,
3648 .test_ill
= test_ill_rsr
,
3649 .par
= (const uint32_t[]){DTLBCFG
},
3650 .op_flags
= XTENSA_OP_PRIVILEGED
,
3651 .windowed_register_op
= 0x1,
3654 .translate
= translate_rsr
,
3655 .test_ill
= test_ill_rsr
,
3656 .par
= (const uint32_t[]){EPC1
},
3657 .op_flags
= XTENSA_OP_PRIVILEGED
,
3658 .windowed_register_op
= 0x1,
3661 .translate
= translate_rsr
,
3662 .test_ill
= test_ill_rsr
,
3663 .par
= (const uint32_t[]){EPC1
+ 1},
3664 .op_flags
= XTENSA_OP_PRIVILEGED
,
3665 .windowed_register_op
= 0x1,
3668 .translate
= translate_rsr
,
3669 .test_ill
= test_ill_rsr
,
3670 .par
= (const uint32_t[]){EPC1
+ 2},
3671 .op_flags
= XTENSA_OP_PRIVILEGED
,
3672 .windowed_register_op
= 0x1,
3675 .translate
= translate_rsr
,
3676 .test_ill
= test_ill_rsr
,
3677 .par
= (const uint32_t[]){EPC1
+ 3},
3678 .op_flags
= XTENSA_OP_PRIVILEGED
,
3679 .windowed_register_op
= 0x1,
3682 .translate
= translate_rsr
,
3683 .test_ill
= test_ill_rsr
,
3684 .par
= (const uint32_t[]){EPC1
+ 4},
3685 .op_flags
= XTENSA_OP_PRIVILEGED
,
3686 .windowed_register_op
= 0x1,
3689 .translate
= translate_rsr
,
3690 .test_ill
= test_ill_rsr
,
3691 .par
= (const uint32_t[]){EPC1
+ 5},
3692 .op_flags
= XTENSA_OP_PRIVILEGED
,
3693 .windowed_register_op
= 0x1,
3696 .translate
= translate_rsr
,
3697 .test_ill
= test_ill_rsr
,
3698 .par
= (const uint32_t[]){EPC1
+ 6},
3699 .op_flags
= XTENSA_OP_PRIVILEGED
,
3700 .windowed_register_op
= 0x1,
3703 .translate
= translate_rsr
,
3704 .test_ill
= test_ill_rsr
,
3705 .par
= (const uint32_t[]){EPS2
},
3706 .op_flags
= XTENSA_OP_PRIVILEGED
,
3707 .windowed_register_op
= 0x1,
3710 .translate
= translate_rsr
,
3711 .test_ill
= test_ill_rsr
,
3712 .par
= (const uint32_t[]){EPS2
+ 1},
3713 .op_flags
= XTENSA_OP_PRIVILEGED
,
3714 .windowed_register_op
= 0x1,
3717 .translate
= translate_rsr
,
3718 .test_ill
= test_ill_rsr
,
3719 .par
= (const uint32_t[]){EPS2
+ 2},
3720 .op_flags
= XTENSA_OP_PRIVILEGED
,
3721 .windowed_register_op
= 0x1,
3724 .translate
= translate_rsr
,
3725 .test_ill
= test_ill_rsr
,
3726 .par
= (const uint32_t[]){EPS2
+ 3},
3727 .op_flags
= XTENSA_OP_PRIVILEGED
,
3728 .windowed_register_op
= 0x1,
3731 .translate
= translate_rsr
,
3732 .test_ill
= test_ill_rsr
,
3733 .par
= (const uint32_t[]){EPS2
+ 4},
3734 .op_flags
= XTENSA_OP_PRIVILEGED
,
3735 .windowed_register_op
= 0x1,
3738 .translate
= translate_rsr
,
3739 .test_ill
= test_ill_rsr
,
3740 .par
= (const uint32_t[]){EPS2
+ 5},
3741 .op_flags
= XTENSA_OP_PRIVILEGED
,
3742 .windowed_register_op
= 0x1,
3744 .name
= "rsr.exccause",
3745 .translate
= translate_rsr
,
3746 .test_ill
= test_ill_rsr
,
3747 .par
= (const uint32_t[]){EXCCAUSE
},
3748 .op_flags
= XTENSA_OP_PRIVILEGED
,
3749 .windowed_register_op
= 0x1,
3751 .name
= "rsr.excsave1",
3752 .translate
= translate_rsr
,
3753 .test_ill
= test_ill_rsr
,
3754 .par
= (const uint32_t[]){EXCSAVE1
},
3755 .op_flags
= XTENSA_OP_PRIVILEGED
,
3756 .windowed_register_op
= 0x1,
3758 .name
= "rsr.excsave2",
3759 .translate
= translate_rsr
,
3760 .test_ill
= test_ill_rsr
,
3761 .par
= (const uint32_t[]){EXCSAVE1
+ 1},
3762 .op_flags
= XTENSA_OP_PRIVILEGED
,
3763 .windowed_register_op
= 0x1,
3765 .name
= "rsr.excsave3",
3766 .translate
= translate_rsr
,
3767 .test_ill
= test_ill_rsr
,
3768 .par
= (const uint32_t[]){EXCSAVE1
+ 2},
3769 .op_flags
= XTENSA_OP_PRIVILEGED
,
3770 .windowed_register_op
= 0x1,
3772 .name
= "rsr.excsave4",
3773 .translate
= translate_rsr
,
3774 .test_ill
= test_ill_rsr
,
3775 .par
= (const uint32_t[]){EXCSAVE1
+ 3},
3776 .op_flags
= XTENSA_OP_PRIVILEGED
,
3777 .windowed_register_op
= 0x1,
3779 .name
= "rsr.excsave5",
3780 .translate
= translate_rsr
,
3781 .test_ill
= test_ill_rsr
,
3782 .par
= (const uint32_t[]){EXCSAVE1
+ 4},
3783 .op_flags
= XTENSA_OP_PRIVILEGED
,
3784 .windowed_register_op
= 0x1,
3786 .name
= "rsr.excsave6",
3787 .translate
= translate_rsr
,
3788 .test_ill
= test_ill_rsr
,
3789 .par
= (const uint32_t[]){EXCSAVE1
+ 5},
3790 .op_flags
= XTENSA_OP_PRIVILEGED
,
3791 .windowed_register_op
= 0x1,
3793 .name
= "rsr.excsave7",
3794 .translate
= translate_rsr
,
3795 .test_ill
= test_ill_rsr
,
3796 .par
= (const uint32_t[]){EXCSAVE1
+ 6},
3797 .op_flags
= XTENSA_OP_PRIVILEGED
,
3798 .windowed_register_op
= 0x1,
3800 .name
= "rsr.excvaddr",
3801 .translate
= translate_rsr
,
3802 .test_ill
= test_ill_rsr
,
3803 .par
= (const uint32_t[]){EXCVADDR
},
3804 .op_flags
= XTENSA_OP_PRIVILEGED
,
3805 .windowed_register_op
= 0x1,
3807 .name
= "rsr.ibreaka0",
3808 .translate
= translate_rsr
,
3809 .test_ill
= test_ill_rsr
,
3810 .par
= (const uint32_t[]){IBREAKA
},
3811 .op_flags
= XTENSA_OP_PRIVILEGED
,
3812 .windowed_register_op
= 0x1,
3814 .name
= "rsr.ibreaka1",
3815 .translate
= translate_rsr
,
3816 .test_ill
= test_ill_rsr
,
3817 .par
= (const uint32_t[]){IBREAKA
+ 1},
3818 .op_flags
= XTENSA_OP_PRIVILEGED
,
3819 .windowed_register_op
= 0x1,
3821 .name
= "rsr.ibreakenable",
3822 .translate
= translate_rsr
,
3823 .test_ill
= test_ill_rsr
,
3824 .par
= (const uint32_t[]){IBREAKENABLE
},
3825 .op_flags
= XTENSA_OP_PRIVILEGED
,
3826 .windowed_register_op
= 0x1,
3828 .name
= "rsr.icount",
3829 .translate
= translate_rsr
,
3830 .test_ill
= test_ill_rsr
,
3831 .par
= (const uint32_t[]){ICOUNT
},
3832 .op_flags
= XTENSA_OP_PRIVILEGED
,
3833 .windowed_register_op
= 0x1,
3835 .name
= "rsr.icountlevel",
3836 .translate
= translate_rsr
,
3837 .test_ill
= test_ill_rsr
,
3838 .par
= (const uint32_t[]){ICOUNTLEVEL
},
3839 .op_flags
= XTENSA_OP_PRIVILEGED
,
3840 .windowed_register_op
= 0x1,
3842 .name
= "rsr.intclear",
3843 .translate
= translate_rsr
,
3844 .test_ill
= test_ill_rsr
,
3845 .par
= (const uint32_t[]){INTCLEAR
},
3846 .op_flags
= XTENSA_OP_PRIVILEGED
,
3847 .windowed_register_op
= 0x1,
3849 .name
= "rsr.intenable",
3850 .translate
= translate_rsr
,
3851 .test_ill
= test_ill_rsr
,
3852 .par
= (const uint32_t[]){INTENABLE
},
3853 .op_flags
= XTENSA_OP_PRIVILEGED
,
3854 .windowed_register_op
= 0x1,
3856 .name
= "rsr.interrupt",
3857 .translate
= translate_rsr
,
3858 .test_ill
= test_ill_rsr
,
3859 .par
= (const uint32_t[]){INTSET
},
3860 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
3861 .windowed_register_op
= 0x1,
3863 .name
= "rsr.intset",
3864 .translate
= translate_rsr
,
3865 .test_ill
= test_ill_rsr
,
3866 .par
= (const uint32_t[]){INTSET
},
3867 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
3868 .windowed_register_op
= 0x1,
3870 .name
= "rsr.itlbcfg",
3871 .translate
= translate_rsr
,
3872 .test_ill
= test_ill_rsr
,
3873 .par
= (const uint32_t[]){ITLBCFG
},
3874 .op_flags
= XTENSA_OP_PRIVILEGED
,
3875 .windowed_register_op
= 0x1,
3878 .translate
= translate_rsr
,
3879 .test_ill
= test_ill_rsr
,
3880 .par
= (const uint32_t[]){LBEG
},
3881 .windowed_register_op
= 0x1,
3883 .name
= "rsr.lcount",
3884 .translate
= translate_rsr
,
3885 .test_ill
= test_ill_rsr
,
3886 .par
= (const uint32_t[]){LCOUNT
},
3887 .windowed_register_op
= 0x1,
3890 .translate
= translate_rsr
,
3891 .test_ill
= test_ill_rsr
,
3892 .par
= (const uint32_t[]){LEND
},
3893 .windowed_register_op
= 0x1,
3895 .name
= "rsr.litbase",
3896 .translate
= translate_rsr
,
3897 .test_ill
= test_ill_rsr
,
3898 .par
= (const uint32_t[]){LITBASE
},
3899 .windowed_register_op
= 0x1,
3902 .translate
= translate_rsr
,
3903 .test_ill
= test_ill_rsr
,
3904 .par
= (const uint32_t[]){MR
},
3905 .windowed_register_op
= 0x1,
3908 .translate
= translate_rsr
,
3909 .test_ill
= test_ill_rsr
,
3910 .par
= (const uint32_t[]){MR
+ 1},
3911 .windowed_register_op
= 0x1,
3914 .translate
= translate_rsr
,
3915 .test_ill
= test_ill_rsr
,
3916 .par
= (const uint32_t[]){MR
+ 2},
3917 .windowed_register_op
= 0x1,
3920 .translate
= translate_rsr
,
3921 .test_ill
= test_ill_rsr
,
3922 .par
= (const uint32_t[]){MR
+ 3},
3923 .windowed_register_op
= 0x1,
3925 .name
= "rsr.memctl",
3926 .translate
= translate_rsr
,
3927 .test_ill
= test_ill_rsr
,
3928 .par
= (const uint32_t[]){MEMCTL
},
3929 .op_flags
= XTENSA_OP_PRIVILEGED
,
3930 .windowed_register_op
= 0x1,
3932 .name
= "rsr.misc0",
3933 .translate
= translate_rsr
,
3934 .test_ill
= test_ill_rsr
,
3935 .par
= (const uint32_t[]){MISC
},
3936 .op_flags
= XTENSA_OP_PRIVILEGED
,
3937 .windowed_register_op
= 0x1,
3939 .name
= "rsr.misc1",
3940 .translate
= translate_rsr
,
3941 .test_ill
= test_ill_rsr
,
3942 .par
= (const uint32_t[]){MISC
+ 1},
3943 .op_flags
= XTENSA_OP_PRIVILEGED
,
3944 .windowed_register_op
= 0x1,
3946 .name
= "rsr.misc2",
3947 .translate
= translate_rsr
,
3948 .test_ill
= test_ill_rsr
,
3949 .par
= (const uint32_t[]){MISC
+ 2},
3950 .op_flags
= XTENSA_OP_PRIVILEGED
,
3951 .windowed_register_op
= 0x1,
3953 .name
= "rsr.misc3",
3954 .translate
= translate_rsr
,
3955 .test_ill
= test_ill_rsr
,
3956 .par
= (const uint32_t[]){MISC
+ 3},
3957 .op_flags
= XTENSA_OP_PRIVILEGED
,
3958 .windowed_register_op
= 0x1,
3961 .translate
= translate_rsr
,
3962 .test_ill
= test_ill_rsr
,
3963 .par
= (const uint32_t[]){PRID
},
3964 .op_flags
= XTENSA_OP_PRIVILEGED
,
3965 .windowed_register_op
= 0x1,
3968 .translate
= translate_rsr
,
3969 .test_ill
= test_ill_rsr
,
3970 .par
= (const uint32_t[]){PS
},
3971 .op_flags
= XTENSA_OP_PRIVILEGED
,
3972 .windowed_register_op
= 0x1,
3974 .name
= "rsr.ptevaddr",
3975 .translate
= translate_rsr
,
3976 .test_ill
= test_ill_rsr
,
3977 .par
= (const uint32_t[]){PTEVADDR
},
3978 .op_flags
= XTENSA_OP_PRIVILEGED
,
3979 .windowed_register_op
= 0x1,
3981 .name
= "rsr.rasid",
3982 .translate
= translate_rsr
,
3983 .test_ill
= test_ill_rsr
,
3984 .par
= (const uint32_t[]){RASID
},
3985 .op_flags
= XTENSA_OP_PRIVILEGED
,
3986 .windowed_register_op
= 0x1,
3989 .translate
= translate_rsr
,
3990 .test_ill
= test_ill_rsr
,
3991 .par
= (const uint32_t[]){SAR
},
3992 .windowed_register_op
= 0x1,
3994 .name
= "rsr.scompare1",
3995 .translate
= translate_rsr
,
3996 .test_ill
= test_ill_rsr
,
3997 .par
= (const uint32_t[]){SCOMPARE1
},
3998 .windowed_register_op
= 0x1,
4000 .name
= "rsr.vecbase",
4001 .translate
= translate_rsr
,
4002 .test_ill
= test_ill_rsr
,
4003 .par
= (const uint32_t[]){VECBASE
},
4004 .op_flags
= XTENSA_OP_PRIVILEGED
,
4005 .windowed_register_op
= 0x1,
4007 .name
= "rsr.windowbase",
4008 .translate
= translate_rsr
,
4009 .test_ill
= test_ill_rsr
,
4010 .par
= (const uint32_t[]){WINDOW_BASE
},
4011 .op_flags
= XTENSA_OP_PRIVILEGED
,
4012 .windowed_register_op
= 0x1,
4014 .name
= "rsr.windowstart",
4015 .translate
= translate_rsr
,
4016 .test_ill
= test_ill_rsr
,
4017 .par
= (const uint32_t[]){WINDOW_START
},
4018 .op_flags
= XTENSA_OP_PRIVILEGED
,
4019 .windowed_register_op
= 0x1,
4022 .translate
= translate_nop
,
4024 .name
= "rur.expstate",
4025 .translate
= translate_rur
,
4026 .par
= (const uint32_t[]){EXPSTATE
},
4027 .windowed_register_op
= 0x1,
4030 .translate
= translate_rur
,
4031 .par
= (const uint32_t[]){FCR
},
4032 .windowed_register_op
= 0x1,
4036 .translate
= translate_rur
,
4037 .par
= (const uint32_t[]){FSR
},
4038 .windowed_register_op
= 0x1,
4041 .name
= "rur.threadptr",
4042 .translate
= translate_rur
,
4043 .par
= (const uint32_t[]){THREADPTR
},
4044 .windowed_register_op
= 0x1,
4047 .translate
= translate_ldst
,
4048 .par
= (const uint32_t[]){MO_TEUW
, false, true},
4049 .windowed_register_op
= 0x3,
4052 .translate
= translate_s32c1i
,
4053 .windowed_register_op
= 0x3,
4056 .translate
= translate_s32e
,
4057 .op_flags
= XTENSA_OP_PRIVILEGED
,
4058 .windowed_register_op
= 0x3,
4061 .translate
= translate_ldst
,
4062 .par
= (const uint32_t[]){MO_TEUL
, false, true},
4063 .windowed_register_op
= 0x3,
4066 .translate
= translate_ldst
,
4067 .par
= (const uint32_t[]){MO_TEUL
, false, true},
4068 .windowed_register_op
= 0x3,
4071 .translate
= translate_ldst
,
4072 .par
= (const uint32_t[]){MO_TEUL
, false, true},
4073 .windowed_register_op
= 0x3,
4076 .translate
= translate_ldst
,
4077 .par
= (const uint32_t[]){MO_TEUL
, true, true},
4078 .windowed_register_op
= 0x3,
4081 .translate
= translate_ldst
,
4082 .par
= (const uint32_t[]){MO_UB
, false, true},
4083 .windowed_register_op
= 0x3,
4086 .translate
= translate_salt
,
4087 .par
= (const uint32_t[]){TCG_COND_LT
},
4088 .windowed_register_op
= 0x7,
4091 .translate
= translate_salt
,
4092 .par
= (const uint32_t[]){TCG_COND_LTU
},
4093 .windowed_register_op
= 0x7,
4095 .name
= "setb_expstate",
4096 .translate
= translate_setb_expstate
,
4099 .translate
= translate_sext
,
4100 .windowed_register_op
= 0x3,
4103 .translate
= translate_simcall
,
4104 .test_ill
= test_ill_simcall
,
4105 .op_flags
= XTENSA_OP_PRIVILEGED
,
4108 .translate
= translate_sll
,
4109 .windowed_register_op
= 0x3,
4112 .translate
= translate_slli
,
4113 .windowed_register_op
= 0x3,
4116 .translate
= translate_sra
,
4117 .windowed_register_op
= 0x3,
4120 .translate
= translate_srai
,
4121 .windowed_register_op
= 0x3,
4124 .translate
= translate_src
,
4125 .windowed_register_op
= 0x7,
4128 .translate
= translate_srl
,
4129 .windowed_register_op
= 0x3,
4132 .translate
= translate_srli
,
4133 .windowed_register_op
= 0x3,
4136 .translate
= translate_ssa8b
,
4137 .windowed_register_op
= 0x1,
4140 .translate
= translate_ssa8l
,
4141 .windowed_register_op
= 0x1,
4144 .translate
= translate_ssai
,
4147 .translate
= translate_ssl
,
4148 .windowed_register_op
= 0x1,
4151 .translate
= translate_ssr
,
4152 .windowed_register_op
= 0x1,
4155 .translate
= translate_sub
,
4156 .windowed_register_op
= 0x7,
4159 .translate
= translate_subx
,
4160 .par
= (const uint32_t[]){1},
4161 .windowed_register_op
= 0x7,
4164 .translate
= translate_subx
,
4165 .par
= (const uint32_t[]){2},
4166 .windowed_register_op
= 0x7,
4169 .translate
= translate_subx
,
4170 .par
= (const uint32_t[]){3},
4171 .windowed_register_op
= 0x7,
4174 .op_flags
= XTENSA_OP_SYSCALL
,
4176 .name
= "umul.aa.hh",
4177 .translate
= translate_mac16
,
4178 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_AA
, MAC16_HH
, 0},
4179 .windowed_register_op
= 0x3,
4181 .name
= "umul.aa.hl",
4182 .translate
= translate_mac16
,
4183 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_AA
, MAC16_HL
, 0},
4184 .windowed_register_op
= 0x3,
4186 .name
= "umul.aa.lh",
4187 .translate
= translate_mac16
,
4188 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_AA
, MAC16_LH
, 0},
4189 .windowed_register_op
= 0x3,
4191 .name
= "umul.aa.ll",
4192 .translate
= translate_mac16
,
4193 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_AA
, MAC16_LL
, 0},
4194 .windowed_register_op
= 0x3,
4197 .translate
= translate_waiti
,
4198 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4201 .translate
= translate_wtlb
,
4202 .par
= (const uint32_t[]){true},
4203 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4204 .windowed_register_op
= 0x3,
4207 .translate
= translate_wer
,
4208 .op_flags
= XTENSA_OP_PRIVILEGED
,
4209 .windowed_register_op
= 0x3,
4212 .translate
= translate_wtlb
,
4213 .par
= (const uint32_t[]){false},
4214 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4215 .windowed_register_op
= 0x3,
4217 .name
= "wrmsk_expstate",
4218 .translate
= translate_wrmsk_expstate
,
4219 .windowed_register_op
= 0x3,
4222 .translate
= translate_wsr
,
4223 .test_ill
= test_ill_wsr
,
4224 .par
= (const uint32_t[]){176},
4225 .op_flags
= XTENSA_OP_PRIVILEGED
,
4226 .windowed_register_op
= 0x1,
4229 .translate
= translate_wsr
,
4230 .test_ill
= test_ill_wsr
,
4231 .par
= (const uint32_t[]){208},
4232 .op_flags
= XTENSA_OP_PRIVILEGED
,
4233 .windowed_register_op
= 0x1,
4235 .name
= "wsr.acchi",
4236 .translate
= translate_wsr
,
4237 .test_ill
= test_ill_wsr
,
4238 .par
= (const uint32_t[]){ACCHI
},
4239 .windowed_register_op
= 0x1,
4241 .name
= "wsr.acclo",
4242 .translate
= translate_wsr
,
4243 .test_ill
= test_ill_wsr
,
4244 .par
= (const uint32_t[]){ACCLO
},
4245 .windowed_register_op
= 0x1,
4247 .name
= "wsr.atomctl",
4248 .translate
= translate_wsr
,
4249 .test_ill
= test_ill_wsr
,
4250 .par
= (const uint32_t[]){ATOMCTL
},
4251 .op_flags
= XTENSA_OP_PRIVILEGED
,
4252 .windowed_register_op
= 0x1,
4255 .translate
= translate_wsr
,
4256 .test_ill
= test_ill_wsr
,
4257 .par
= (const uint32_t[]){BR
},
4258 .windowed_register_op
= 0x1,
4260 .name
= "wsr.cacheattr",
4261 .translate
= translate_wsr
,
4262 .test_ill
= test_ill_wsr
,
4263 .par
= (const uint32_t[]){CACHEATTR
},
4264 .op_flags
= XTENSA_OP_PRIVILEGED
,
4265 .windowed_register_op
= 0x1,
4267 .name
= "wsr.ccompare0",
4268 .translate
= translate_wsr
,
4269 .test_ill
= test_ill_wsr
,
4270 .par
= (const uint32_t[]){CCOMPARE
},
4271 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4272 .windowed_register_op
= 0x1,
4274 .name
= "wsr.ccompare1",
4275 .translate
= translate_wsr
,
4276 .test_ill
= test_ill_wsr
,
4277 .par
= (const uint32_t[]){CCOMPARE
+ 1},
4278 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4279 .windowed_register_op
= 0x1,
4281 .name
= "wsr.ccompare2",
4282 .translate
= translate_wsr
,
4283 .test_ill
= test_ill_wsr
,
4284 .par
= (const uint32_t[]){CCOMPARE
+ 2},
4285 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4286 .windowed_register_op
= 0x1,
4288 .name
= "wsr.ccount",
4289 .translate
= translate_wsr
,
4290 .test_ill
= test_ill_wsr
,
4291 .par
= (const uint32_t[]){CCOUNT
},
4292 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4293 .windowed_register_op
= 0x1,
4295 .name
= "wsr.configid0",
4296 .translate
= translate_wsr
,
4297 .test_ill
= test_ill_wsr
,
4298 .par
= (const uint32_t[]){CONFIGID0
},
4299 .op_flags
= XTENSA_OP_PRIVILEGED
,
4300 .windowed_register_op
= 0x1,
4302 .name
= "wsr.configid1",
4303 .translate
= translate_wsr
,
4304 .test_ill
= test_ill_wsr
,
4305 .par
= (const uint32_t[]){CONFIGID1
},
4306 .op_flags
= XTENSA_OP_PRIVILEGED
,
4307 .windowed_register_op
= 0x1,
4309 .name
= "wsr.cpenable",
4310 .translate
= translate_wsr
,
4311 .test_ill
= test_ill_wsr
,
4312 .par
= (const uint32_t[]){CPENABLE
},
4313 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4314 .windowed_register_op
= 0x1,
4316 .name
= "wsr.dbreaka0",
4317 .translate
= translate_wsr
,
4318 .test_ill
= test_ill_wsr
,
4319 .par
= (const uint32_t[]){DBREAKA
},
4320 .op_flags
= XTENSA_OP_PRIVILEGED
,
4321 .windowed_register_op
= 0x1,
4323 .name
= "wsr.dbreaka1",
4324 .translate
= translate_wsr
,
4325 .test_ill
= test_ill_wsr
,
4326 .par
= (const uint32_t[]){DBREAKA
+ 1},
4327 .op_flags
= XTENSA_OP_PRIVILEGED
,
4328 .windowed_register_op
= 0x1,
4330 .name
= "wsr.dbreakc0",
4331 .translate
= translate_wsr
,
4332 .test_ill
= test_ill_wsr
,
4333 .par
= (const uint32_t[]){DBREAKC
},
4334 .op_flags
= XTENSA_OP_PRIVILEGED
,
4335 .windowed_register_op
= 0x1,
4337 .name
= "wsr.dbreakc1",
4338 .translate
= translate_wsr
,
4339 .test_ill
= test_ill_wsr
,
4340 .par
= (const uint32_t[]){DBREAKC
+ 1},
4341 .op_flags
= XTENSA_OP_PRIVILEGED
,
4342 .windowed_register_op
= 0x1,
4345 .translate
= translate_wsr
,
4346 .test_ill
= test_ill_wsr
,
4347 .par
= (const uint32_t[]){DDR
},
4348 .op_flags
= XTENSA_OP_PRIVILEGED
,
4349 .windowed_register_op
= 0x1,
4351 .name
= "wsr.debugcause",
4352 .translate
= translate_wsr
,
4353 .test_ill
= test_ill_wsr
,
4354 .par
= (const uint32_t[]){DEBUGCAUSE
},
4355 .op_flags
= XTENSA_OP_PRIVILEGED
,
4356 .windowed_register_op
= 0x1,
4359 .translate
= translate_wsr
,
4360 .test_ill
= test_ill_wsr
,
4361 .par
= (const uint32_t[]){DEPC
},
4362 .op_flags
= XTENSA_OP_PRIVILEGED
,
4363 .windowed_register_op
= 0x1,
4365 .name
= "wsr.dtlbcfg",
4366 .translate
= translate_wsr
,
4367 .test_ill
= test_ill_wsr
,
4368 .par
= (const uint32_t[]){DTLBCFG
},
4369 .op_flags
= XTENSA_OP_PRIVILEGED
,
4370 .windowed_register_op
= 0x1,
4373 .translate
= translate_wsr
,
4374 .test_ill
= test_ill_wsr
,
4375 .par
= (const uint32_t[]){EPC1
},
4376 .op_flags
= XTENSA_OP_PRIVILEGED
,
4377 .windowed_register_op
= 0x1,
4380 .translate
= translate_wsr
,
4381 .test_ill
= test_ill_wsr
,
4382 .par
= (const uint32_t[]){EPC1
+ 1},
4383 .op_flags
= XTENSA_OP_PRIVILEGED
,
4384 .windowed_register_op
= 0x1,
4387 .translate
= translate_wsr
,
4388 .test_ill
= test_ill_wsr
,
4389 .par
= (const uint32_t[]){EPC1
+ 2},
4390 .op_flags
= XTENSA_OP_PRIVILEGED
,
4391 .windowed_register_op
= 0x1,
4394 .translate
= translate_wsr
,
4395 .test_ill
= test_ill_wsr
,
4396 .par
= (const uint32_t[]){EPC1
+ 3},
4397 .op_flags
= XTENSA_OP_PRIVILEGED
,
4398 .windowed_register_op
= 0x1,
4401 .translate
= translate_wsr
,
4402 .test_ill
= test_ill_wsr
,
4403 .par
= (const uint32_t[]){EPC1
+ 4},
4404 .op_flags
= XTENSA_OP_PRIVILEGED
,
4405 .windowed_register_op
= 0x1,
4408 .translate
= translate_wsr
,
4409 .test_ill
= test_ill_wsr
,
4410 .par
= (const uint32_t[]){EPC1
+ 5},
4411 .op_flags
= XTENSA_OP_PRIVILEGED
,
4412 .windowed_register_op
= 0x1,
4415 .translate
= translate_wsr
,
4416 .test_ill
= test_ill_wsr
,
4417 .par
= (const uint32_t[]){EPC1
+ 6},
4418 .op_flags
= XTENSA_OP_PRIVILEGED
,
4419 .windowed_register_op
= 0x1,
4422 .translate
= translate_wsr
,
4423 .test_ill
= test_ill_wsr
,
4424 .par
= (const uint32_t[]){EPS2
},
4425 .op_flags
= XTENSA_OP_PRIVILEGED
,
4426 .windowed_register_op
= 0x1,
4429 .translate
= translate_wsr
,
4430 .test_ill
= test_ill_wsr
,
4431 .par
= (const uint32_t[]){EPS2
+ 1},
4432 .op_flags
= XTENSA_OP_PRIVILEGED
,
4433 .windowed_register_op
= 0x1,
4436 .translate
= translate_wsr
,
4437 .test_ill
= test_ill_wsr
,
4438 .par
= (const uint32_t[]){EPS2
+ 2},
4439 .op_flags
= XTENSA_OP_PRIVILEGED
,
4440 .windowed_register_op
= 0x1,
4443 .translate
= translate_wsr
,
4444 .test_ill
= test_ill_wsr
,
4445 .par
= (const uint32_t[]){EPS2
+ 3},
4446 .op_flags
= XTENSA_OP_PRIVILEGED
,
4447 .windowed_register_op
= 0x1,
4450 .translate
= translate_wsr
,
4451 .test_ill
= test_ill_wsr
,
4452 .par
= (const uint32_t[]){EPS2
+ 4},
4453 .op_flags
= XTENSA_OP_PRIVILEGED
,
4454 .windowed_register_op
= 0x1,
4457 .translate
= translate_wsr
,
4458 .test_ill
= test_ill_wsr
,
4459 .par
= (const uint32_t[]){EPS2
+ 5},
4460 .op_flags
= XTENSA_OP_PRIVILEGED
,
4461 .windowed_register_op
= 0x1,
4463 .name
= "wsr.exccause",
4464 .translate
= translate_wsr
,
4465 .test_ill
= test_ill_wsr
,
4466 .par
= (const uint32_t[]){EXCCAUSE
},
4467 .op_flags
= XTENSA_OP_PRIVILEGED
,
4468 .windowed_register_op
= 0x1,
4470 .name
= "wsr.excsave1",
4471 .translate
= translate_wsr
,
4472 .test_ill
= test_ill_wsr
,
4473 .par
= (const uint32_t[]){EXCSAVE1
},
4474 .op_flags
= XTENSA_OP_PRIVILEGED
,
4475 .windowed_register_op
= 0x1,
4477 .name
= "wsr.excsave2",
4478 .translate
= translate_wsr
,
4479 .test_ill
= test_ill_wsr
,
4480 .par
= (const uint32_t[]){EXCSAVE1
+ 1},
4481 .op_flags
= XTENSA_OP_PRIVILEGED
,
4482 .windowed_register_op
= 0x1,
4484 .name
= "wsr.excsave3",
4485 .translate
= translate_wsr
,
4486 .test_ill
= test_ill_wsr
,
4487 .par
= (const uint32_t[]){EXCSAVE1
+ 2},
4488 .op_flags
= XTENSA_OP_PRIVILEGED
,
4489 .windowed_register_op
= 0x1,
4491 .name
= "wsr.excsave4",
4492 .translate
= translate_wsr
,
4493 .test_ill
= test_ill_wsr
,
4494 .par
= (const uint32_t[]){EXCSAVE1
+ 3},
4495 .op_flags
= XTENSA_OP_PRIVILEGED
,
4496 .windowed_register_op
= 0x1,
4498 .name
= "wsr.excsave5",
4499 .translate
= translate_wsr
,
4500 .test_ill
= test_ill_wsr
,
4501 .par
= (const uint32_t[]){EXCSAVE1
+ 4},
4502 .op_flags
= XTENSA_OP_PRIVILEGED
,
4503 .windowed_register_op
= 0x1,
4505 .name
= "wsr.excsave6",
4506 .translate
= translate_wsr
,
4507 .test_ill
= test_ill_wsr
,
4508 .par
= (const uint32_t[]){EXCSAVE1
+ 5},
4509 .op_flags
= XTENSA_OP_PRIVILEGED
,
4510 .windowed_register_op
= 0x1,
4512 .name
= "wsr.excsave7",
4513 .translate
= translate_wsr
,
4514 .test_ill
= test_ill_wsr
,
4515 .par
= (const uint32_t[]){EXCSAVE1
+ 6},
4516 .op_flags
= XTENSA_OP_PRIVILEGED
,
4517 .windowed_register_op
= 0x1,
4519 .name
= "wsr.excvaddr",
4520 .translate
= translate_wsr
,
4521 .test_ill
= test_ill_wsr
,
4522 .par
= (const uint32_t[]){EXCVADDR
},
4523 .op_flags
= XTENSA_OP_PRIVILEGED
,
4524 .windowed_register_op
= 0x1,
4526 .name
= "wsr.ibreaka0",
4527 .translate
= translate_wsr
,
4528 .test_ill
= test_ill_wsr
,
4529 .par
= (const uint32_t[]){IBREAKA
},
4530 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4531 .windowed_register_op
= 0x1,
4533 .name
= "wsr.ibreaka1",
4534 .translate
= translate_wsr
,
4535 .test_ill
= test_ill_wsr
,
4536 .par
= (const uint32_t[]){IBREAKA
+ 1},
4537 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4538 .windowed_register_op
= 0x1,
4540 .name
= "wsr.ibreakenable",
4541 .translate
= translate_wsr
,
4542 .test_ill
= test_ill_wsr
,
4543 .par
= (const uint32_t[]){IBREAKENABLE
},
4544 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4545 .windowed_register_op
= 0x1,
4547 .name
= "wsr.icount",
4548 .translate
= translate_wsr
,
4549 .test_ill
= test_ill_wsr
,
4550 .par
= (const uint32_t[]){ICOUNT
},
4551 .op_flags
= XTENSA_OP_PRIVILEGED
,
4552 .windowed_register_op
= 0x1,
4554 .name
= "wsr.icountlevel",
4555 .translate
= translate_wsr
,
4556 .test_ill
= test_ill_wsr
,
4557 .par
= (const uint32_t[]){ICOUNTLEVEL
},
4558 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4559 .windowed_register_op
= 0x1,
4561 .name
= "wsr.intclear",
4562 .translate
= translate_wsr
,
4563 .test_ill
= test_ill_wsr
,
4564 .par
= (const uint32_t[]){INTCLEAR
},
4566 XTENSA_OP_PRIVILEGED
|
4567 XTENSA_OP_EXIT_TB_0
|
4568 XTENSA_OP_CHECK_INTERRUPTS
,
4569 .windowed_register_op
= 0x1,
4571 .name
= "wsr.intenable",
4572 .translate
= translate_wsr
,
4573 .test_ill
= test_ill_wsr
,
4574 .par
= (const uint32_t[]){INTENABLE
},
4576 XTENSA_OP_PRIVILEGED
|
4577 XTENSA_OP_EXIT_TB_0
|
4578 XTENSA_OP_CHECK_INTERRUPTS
,
4579 .windowed_register_op
= 0x1,
4581 .name
= "wsr.interrupt",
4582 .translate
= translate_wsr
,
4583 .test_ill
= test_ill_wsr
,
4584 .par
= (const uint32_t[]){INTSET
},
4586 XTENSA_OP_PRIVILEGED
|
4587 XTENSA_OP_EXIT_TB_0
|
4588 XTENSA_OP_CHECK_INTERRUPTS
,
4589 .windowed_register_op
= 0x1,
4591 .name
= "wsr.intset",
4592 .translate
= translate_wsr
,
4593 .test_ill
= test_ill_wsr
,
4594 .par
= (const uint32_t[]){INTSET
},
4596 XTENSA_OP_PRIVILEGED
|
4597 XTENSA_OP_EXIT_TB_0
|
4598 XTENSA_OP_CHECK_INTERRUPTS
,
4599 .windowed_register_op
= 0x1,
4601 .name
= "wsr.itlbcfg",
4602 .translate
= translate_wsr
,
4603 .test_ill
= test_ill_wsr
,
4604 .par
= (const uint32_t[]){ITLBCFG
},
4605 .op_flags
= XTENSA_OP_PRIVILEGED
,
4606 .windowed_register_op
= 0x1,
4609 .translate
= translate_wsr
,
4610 .test_ill
= test_ill_wsr
,
4611 .par
= (const uint32_t[]){LBEG
},
4612 .op_flags
= XTENSA_OP_EXIT_TB_0
,
4613 .windowed_register_op
= 0x1,
4615 .name
= "wsr.lcount",
4616 .translate
= translate_wsr
,
4617 .test_ill
= test_ill_wsr
,
4618 .par
= (const uint32_t[]){LCOUNT
},
4619 .windowed_register_op
= 0x1,
4622 .translate
= translate_wsr
,
4623 .test_ill
= test_ill_wsr
,
4624 .par
= (const uint32_t[]){LEND
},
4625 .op_flags
= XTENSA_OP_EXIT_TB_0
,
4626 .windowed_register_op
= 0x1,
4628 .name
= "wsr.litbase",
4629 .translate
= translate_wsr
,
4630 .test_ill
= test_ill_wsr
,
4631 .par
= (const uint32_t[]){LITBASE
},
4632 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
4633 .windowed_register_op
= 0x1,
4636 .translate
= translate_wsr
,
4637 .test_ill
= test_ill_wsr
,
4638 .par
= (const uint32_t[]){MR
},
4639 .windowed_register_op
= 0x1,
4642 .translate
= translate_wsr
,
4643 .test_ill
= test_ill_wsr
,
4644 .par
= (const uint32_t[]){MR
+ 1},
4645 .windowed_register_op
= 0x1,
4648 .translate
= translate_wsr
,
4649 .test_ill
= test_ill_wsr
,
4650 .par
= (const uint32_t[]){MR
+ 2},
4651 .windowed_register_op
= 0x1,
4654 .translate
= translate_wsr
,
4655 .test_ill
= test_ill_wsr
,
4656 .par
= (const uint32_t[]){MR
+ 3},
4657 .windowed_register_op
= 0x1,
4659 .name
= "wsr.memctl",
4660 .translate
= translate_wsr
,
4661 .test_ill
= test_ill_wsr
,
4662 .par
= (const uint32_t[]){MEMCTL
},
4663 .op_flags
= XTENSA_OP_PRIVILEGED
,
4664 .windowed_register_op
= 0x1,
4666 .name
= "wsr.misc0",
4667 .translate
= translate_wsr
,
4668 .test_ill
= test_ill_wsr
,
4669 .par
= (const uint32_t[]){MISC
},
4670 .op_flags
= XTENSA_OP_PRIVILEGED
,
4671 .windowed_register_op
= 0x1,
4673 .name
= "wsr.misc1",
4674 .translate
= translate_wsr
,
4675 .test_ill
= test_ill_wsr
,
4676 .par
= (const uint32_t[]){MISC
+ 1},
4677 .op_flags
= XTENSA_OP_PRIVILEGED
,
4678 .windowed_register_op
= 0x1,
4680 .name
= "wsr.misc2",
4681 .translate
= translate_wsr
,
4682 .test_ill
= test_ill_wsr
,
4683 .par
= (const uint32_t[]){MISC
+ 2},
4684 .op_flags
= XTENSA_OP_PRIVILEGED
,
4685 .windowed_register_op
= 0x1,
4687 .name
= "wsr.misc3",
4688 .translate
= translate_wsr
,
4689 .test_ill
= test_ill_wsr
,
4690 .par
= (const uint32_t[]){MISC
+ 3},
4691 .op_flags
= XTENSA_OP_PRIVILEGED
,
4692 .windowed_register_op
= 0x1,
4695 .translate
= translate_wsr
,
4696 .test_ill
= test_ill_wsr
,
4697 .par
= (const uint32_t[]){MMID
},
4698 .op_flags
= XTENSA_OP_PRIVILEGED
,
4699 .windowed_register_op
= 0x1,
4702 .translate
= translate_wsr
,
4703 .test_ill
= test_ill_wsr
,
4704 .par
= (const uint32_t[]){PRID
},
4705 .op_flags
= XTENSA_OP_PRIVILEGED
,
4706 .windowed_register_op
= 0x1,
4709 .translate
= translate_wsr
,
4710 .test_ill
= test_ill_wsr
,
4711 .par
= (const uint32_t[]){PS
},
4713 XTENSA_OP_PRIVILEGED
|
4714 XTENSA_OP_EXIT_TB_M1
|
4715 XTENSA_OP_CHECK_INTERRUPTS
,
4716 .windowed_register_op
= 0x1,
4718 .name
= "wsr.ptevaddr",
4719 .translate
= translate_wsr
,
4720 .test_ill
= test_ill_wsr
,
4721 .par
= (const uint32_t[]){PTEVADDR
},
4722 .op_flags
= XTENSA_OP_PRIVILEGED
,
4723 .windowed_register_op
= 0x1,
4725 .name
= "wsr.rasid",
4726 .translate
= translate_wsr
,
4727 .test_ill
= test_ill_wsr
,
4728 .par
= (const uint32_t[]){RASID
},
4729 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4730 .windowed_register_op
= 0x1,
4733 .translate
= translate_wsr
,
4734 .test_ill
= test_ill_wsr
,
4735 .par
= (const uint32_t[]){SAR
},
4736 .windowed_register_op
= 0x1,
4738 .name
= "wsr.scompare1",
4739 .translate
= translate_wsr
,
4740 .test_ill
= test_ill_wsr
,
4741 .par
= (const uint32_t[]){SCOMPARE1
},
4742 .windowed_register_op
= 0x1,
4744 .name
= "wsr.vecbase",
4745 .translate
= translate_wsr
,
4746 .test_ill
= test_ill_wsr
,
4747 .par
= (const uint32_t[]){VECBASE
},
4748 .op_flags
= XTENSA_OP_PRIVILEGED
,
4749 .windowed_register_op
= 0x1,
4751 .name
= "wsr.windowbase",
4752 .translate
= translate_wsr
,
4753 .test_ill
= test_ill_wsr
,
4754 .par
= (const uint32_t[]){WINDOW_BASE
},
4755 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4756 .windowed_register_op
= 0x1,
4758 .name
= "wsr.windowstart",
4759 .translate
= translate_wsr
,
4760 .test_ill
= test_ill_wsr
,
4761 .par
= (const uint32_t[]){WINDOW_START
},
4762 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4763 .windowed_register_op
= 0x1,
4765 .name
= "wur.expstate",
4766 .translate
= translate_wur
,
4767 .par
= (const uint32_t[]){EXPSTATE
},
4768 .windowed_register_op
= 0x1,
4771 .translate
= translate_wur
,
4772 .par
= (const uint32_t[]){FCR
},
4773 .windowed_register_op
= 0x1,
4777 .translate
= translate_wur
,
4778 .par
= (const uint32_t[]){FSR
},
4779 .windowed_register_op
= 0x1,
4782 .name
= "wur.threadptr",
4783 .translate
= translate_wur
,
4784 .par
= (const uint32_t[]){THREADPTR
},
4785 .windowed_register_op
= 0x1,
4788 .translate
= translate_xor
,
4789 .windowed_register_op
= 0x7,
4792 .translate
= translate_boolean
,
4793 .par
= (const uint32_t[]){BOOLEAN_XOR
},
4796 .translate
= translate_xsr
,
4797 .test_ill
= test_ill_xsr
,
4798 .par
= (const uint32_t[]){176},
4799 .op_flags
= XTENSA_OP_PRIVILEGED
,
4800 .windowed_register_op
= 0x1,
4803 .translate
= translate_xsr
,
4804 .test_ill
= test_ill_xsr
,
4805 .par
= (const uint32_t[]){208},
4806 .op_flags
= XTENSA_OP_PRIVILEGED
,
4807 .windowed_register_op
= 0x1,
4809 .name
= "xsr.acchi",
4810 .translate
= translate_xsr
,
4811 .test_ill
= test_ill_xsr
,
4812 .par
= (const uint32_t[]){ACCHI
},
4813 .windowed_register_op
= 0x1,
4815 .name
= "xsr.acclo",
4816 .translate
= translate_xsr
,
4817 .test_ill
= test_ill_xsr
,
4818 .par
= (const uint32_t[]){ACCLO
},
4819 .windowed_register_op
= 0x1,
4821 .name
= "xsr.atomctl",
4822 .translate
= translate_xsr
,
4823 .test_ill
= test_ill_xsr
,
4824 .par
= (const uint32_t[]){ATOMCTL
},
4825 .op_flags
= XTENSA_OP_PRIVILEGED
,
4826 .windowed_register_op
= 0x1,
4829 .translate
= translate_xsr
,
4830 .test_ill
= test_ill_xsr
,
4831 .par
= (const uint32_t[]){BR
},
4832 .windowed_register_op
= 0x1,
4834 .name
= "xsr.cacheattr",
4835 .translate
= translate_xsr
,
4836 .test_ill
= test_ill_xsr
,
4837 .par
= (const uint32_t[]){CACHEATTR
},
4838 .op_flags
= XTENSA_OP_PRIVILEGED
,
4839 .windowed_register_op
= 0x1,
4841 .name
= "xsr.ccompare0",
4842 .translate
= translate_xsr
,
4843 .test_ill
= test_ill_xsr
,
4844 .par
= (const uint32_t[]){CCOMPARE
},
4845 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4846 .windowed_register_op
= 0x1,
4848 .name
= "xsr.ccompare1",
4849 .translate
= translate_xsr
,
4850 .test_ill
= test_ill_xsr
,
4851 .par
= (const uint32_t[]){CCOMPARE
+ 1},
4852 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4853 .windowed_register_op
= 0x1,
4855 .name
= "xsr.ccompare2",
4856 .translate
= translate_xsr
,
4857 .test_ill
= test_ill_xsr
,
4858 .par
= (const uint32_t[]){CCOMPARE
+ 2},
4859 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4860 .windowed_register_op
= 0x1,
4862 .name
= "xsr.ccount",
4863 .translate
= translate_xsr
,
4864 .test_ill
= test_ill_xsr
,
4865 .par
= (const uint32_t[]){CCOUNT
},
4866 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4867 .windowed_register_op
= 0x1,
4869 .name
= "xsr.configid0",
4870 .translate
= translate_xsr
,
4871 .test_ill
= test_ill_xsr
,
4872 .par
= (const uint32_t[]){CONFIGID0
},
4873 .op_flags
= XTENSA_OP_PRIVILEGED
,
4874 .windowed_register_op
= 0x1,
4876 .name
= "xsr.configid1",
4877 .translate
= translate_xsr
,
4878 .test_ill
= test_ill_xsr
,
4879 .par
= (const uint32_t[]){CONFIGID1
},
4880 .op_flags
= XTENSA_OP_PRIVILEGED
,
4881 .windowed_register_op
= 0x1,
4883 .name
= "xsr.cpenable",
4884 .translate
= translate_xsr
,
4885 .test_ill
= test_ill_xsr
,
4886 .par
= (const uint32_t[]){CPENABLE
},
4887 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4888 .windowed_register_op
= 0x1,
4890 .name
= "xsr.dbreaka0",
4891 .translate
= translate_xsr
,
4892 .test_ill
= test_ill_xsr
,
4893 .par
= (const uint32_t[]){DBREAKA
},
4894 .op_flags
= XTENSA_OP_PRIVILEGED
,
4895 .windowed_register_op
= 0x1,
4897 .name
= "xsr.dbreaka1",
4898 .translate
= translate_xsr
,
4899 .test_ill
= test_ill_xsr
,
4900 .par
= (const uint32_t[]){DBREAKA
+ 1},
4901 .op_flags
= XTENSA_OP_PRIVILEGED
,
4902 .windowed_register_op
= 0x1,
4904 .name
= "xsr.dbreakc0",
4905 .translate
= translate_xsr
,
4906 .test_ill
= test_ill_xsr
,
4907 .par
= (const uint32_t[]){DBREAKC
},
4908 .op_flags
= XTENSA_OP_PRIVILEGED
,
4909 .windowed_register_op
= 0x1,
4911 .name
= "xsr.dbreakc1",
4912 .translate
= translate_xsr
,
4913 .test_ill
= test_ill_xsr
,
4914 .par
= (const uint32_t[]){DBREAKC
+ 1},
4915 .op_flags
= XTENSA_OP_PRIVILEGED
,
4916 .windowed_register_op
= 0x1,
4919 .translate
= translate_xsr
,
4920 .test_ill
= test_ill_xsr
,
4921 .par
= (const uint32_t[]){DDR
},
4922 .op_flags
= XTENSA_OP_PRIVILEGED
,
4923 .windowed_register_op
= 0x1,
4925 .name
= "xsr.debugcause",
4926 .translate
= translate_xsr
,
4927 .test_ill
= test_ill_xsr
,
4928 .par
= (const uint32_t[]){DEBUGCAUSE
},
4929 .op_flags
= XTENSA_OP_PRIVILEGED
,
4930 .windowed_register_op
= 0x1,
4933 .translate
= translate_xsr
,
4934 .test_ill
= test_ill_xsr
,
4935 .par
= (const uint32_t[]){DEPC
},
4936 .op_flags
= XTENSA_OP_PRIVILEGED
,
4937 .windowed_register_op
= 0x1,
4939 .name
= "xsr.dtlbcfg",
4940 .translate
= translate_xsr
,
4941 .test_ill
= test_ill_xsr
,
4942 .par
= (const uint32_t[]){DTLBCFG
},
4943 .op_flags
= XTENSA_OP_PRIVILEGED
,
4944 .windowed_register_op
= 0x1,
4947 .translate
= translate_xsr
,
4948 .test_ill
= test_ill_xsr
,
4949 .par
= (const uint32_t[]){EPC1
},
4950 .op_flags
= XTENSA_OP_PRIVILEGED
,
4951 .windowed_register_op
= 0x1,
4954 .translate
= translate_xsr
,
4955 .test_ill
= test_ill_xsr
,
4956 .par
= (const uint32_t[]){EPC1
+ 1},
4957 .op_flags
= XTENSA_OP_PRIVILEGED
,
4958 .windowed_register_op
= 0x1,
4961 .translate
= translate_xsr
,
4962 .test_ill
= test_ill_xsr
,
4963 .par
= (const uint32_t[]){EPC1
+ 2},
4964 .op_flags
= XTENSA_OP_PRIVILEGED
,
4965 .windowed_register_op
= 0x1,
4968 .translate
= translate_xsr
,
4969 .test_ill
= test_ill_xsr
,
4970 .par
= (const uint32_t[]){EPC1
+ 3},
4971 .op_flags
= XTENSA_OP_PRIVILEGED
,
4972 .windowed_register_op
= 0x1,
4975 .translate
= translate_xsr
,
4976 .test_ill
= test_ill_xsr
,
4977 .par
= (const uint32_t[]){EPC1
+ 4},
4978 .op_flags
= XTENSA_OP_PRIVILEGED
,
4979 .windowed_register_op
= 0x1,
4982 .translate
= translate_xsr
,
4983 .test_ill
= test_ill_xsr
,
4984 .par
= (const uint32_t[]){EPC1
+ 5},
4985 .op_flags
= XTENSA_OP_PRIVILEGED
,
4986 .windowed_register_op
= 0x1,
4989 .translate
= translate_xsr
,
4990 .test_ill
= test_ill_xsr
,
4991 .par
= (const uint32_t[]){EPC1
+ 6},
4992 .op_flags
= XTENSA_OP_PRIVILEGED
,
4993 .windowed_register_op
= 0x1,
4996 .translate
= translate_xsr
,
4997 .test_ill
= test_ill_xsr
,
4998 .par
= (const uint32_t[]){EPS2
},
4999 .op_flags
= XTENSA_OP_PRIVILEGED
,
5000 .windowed_register_op
= 0x1,
5003 .translate
= translate_xsr
,
5004 .test_ill
= test_ill_xsr
,
5005 .par
= (const uint32_t[]){EPS2
+ 1},
5006 .op_flags
= XTENSA_OP_PRIVILEGED
,
5007 .windowed_register_op
= 0x1,
5010 .translate
= translate_xsr
,
5011 .test_ill
= test_ill_xsr
,
5012 .par
= (const uint32_t[]){EPS2
+ 2},
5013 .op_flags
= XTENSA_OP_PRIVILEGED
,
5014 .windowed_register_op
= 0x1,
5017 .translate
= translate_xsr
,
5018 .test_ill
= test_ill_xsr
,
5019 .par
= (const uint32_t[]){EPS2
+ 3},
5020 .op_flags
= XTENSA_OP_PRIVILEGED
,
5021 .windowed_register_op
= 0x1,
5024 .translate
= translate_xsr
,
5025 .test_ill
= test_ill_xsr
,
5026 .par
= (const uint32_t[]){EPS2
+ 4},
5027 .op_flags
= XTENSA_OP_PRIVILEGED
,
5028 .windowed_register_op
= 0x1,
5031 .translate
= translate_xsr
,
5032 .test_ill
= test_ill_xsr
,
5033 .par
= (const uint32_t[]){EPS2
+ 5},
5034 .op_flags
= XTENSA_OP_PRIVILEGED
,
5035 .windowed_register_op
= 0x1,
5037 .name
= "xsr.exccause",
5038 .translate
= translate_xsr
,
5039 .test_ill
= test_ill_xsr
,
5040 .par
= (const uint32_t[]){EXCCAUSE
},
5041 .op_flags
= XTENSA_OP_PRIVILEGED
,
5042 .windowed_register_op
= 0x1,
5044 .name
= "xsr.excsave1",
5045 .translate
= translate_xsr
,
5046 .test_ill
= test_ill_xsr
,
5047 .par
= (const uint32_t[]){EXCSAVE1
},
5048 .op_flags
= XTENSA_OP_PRIVILEGED
,
5049 .windowed_register_op
= 0x1,
5051 .name
= "xsr.excsave2",
5052 .translate
= translate_xsr
,
5053 .test_ill
= test_ill_xsr
,
5054 .par
= (const uint32_t[]){EXCSAVE1
+ 1},
5055 .op_flags
= XTENSA_OP_PRIVILEGED
,
5056 .windowed_register_op
= 0x1,
5058 .name
= "xsr.excsave3",
5059 .translate
= translate_xsr
,
5060 .test_ill
= test_ill_xsr
,
5061 .par
= (const uint32_t[]){EXCSAVE1
+ 2},
5062 .op_flags
= XTENSA_OP_PRIVILEGED
,
5063 .windowed_register_op
= 0x1,
5065 .name
= "xsr.excsave4",
5066 .translate
= translate_xsr
,
5067 .test_ill
= test_ill_xsr
,
5068 .par
= (const uint32_t[]){EXCSAVE1
+ 3},
5069 .op_flags
= XTENSA_OP_PRIVILEGED
,
5070 .windowed_register_op
= 0x1,
5072 .name
= "xsr.excsave5",
5073 .translate
= translate_xsr
,
5074 .test_ill
= test_ill_xsr
,
5075 .par
= (const uint32_t[]){EXCSAVE1
+ 4},
5076 .op_flags
= XTENSA_OP_PRIVILEGED
,
5077 .windowed_register_op
= 0x1,
5079 .name
= "xsr.excsave6",
5080 .translate
= translate_xsr
,
5081 .test_ill
= test_ill_xsr
,
5082 .par
= (const uint32_t[]){EXCSAVE1
+ 5},
5083 .op_flags
= XTENSA_OP_PRIVILEGED
,
5084 .windowed_register_op
= 0x1,
5086 .name
= "xsr.excsave7",
5087 .translate
= translate_xsr
,
5088 .test_ill
= test_ill_xsr
,
5089 .par
= (const uint32_t[]){EXCSAVE1
+ 6},
5090 .op_flags
= XTENSA_OP_PRIVILEGED
,
5091 .windowed_register_op
= 0x1,
5093 .name
= "xsr.excvaddr",
5094 .translate
= translate_xsr
,
5095 .test_ill
= test_ill_xsr
,
5096 .par
= (const uint32_t[]){EXCVADDR
},
5097 .op_flags
= XTENSA_OP_PRIVILEGED
,
5098 .windowed_register_op
= 0x1,
5100 .name
= "xsr.ibreaka0",
5101 .translate
= translate_xsr
,
5102 .test_ill
= test_ill_xsr
,
5103 .par
= (const uint32_t[]){IBREAKA
},
5104 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5105 .windowed_register_op
= 0x1,
5107 .name
= "xsr.ibreaka1",
5108 .translate
= translate_xsr
,
5109 .test_ill
= test_ill_xsr
,
5110 .par
= (const uint32_t[]){IBREAKA
+ 1},
5111 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5112 .windowed_register_op
= 0x1,
5114 .name
= "xsr.ibreakenable",
5115 .translate
= translate_xsr
,
5116 .test_ill
= test_ill_xsr
,
5117 .par
= (const uint32_t[]){IBREAKENABLE
},
5118 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5119 .windowed_register_op
= 0x1,
5121 .name
= "xsr.icount",
5122 .translate
= translate_xsr
,
5123 .test_ill
= test_ill_xsr
,
5124 .par
= (const uint32_t[]){ICOUNT
},
5125 .op_flags
= XTENSA_OP_PRIVILEGED
,
5126 .windowed_register_op
= 0x1,
5128 .name
= "xsr.icountlevel",
5129 .translate
= translate_xsr
,
5130 .test_ill
= test_ill_xsr
,
5131 .par
= (const uint32_t[]){ICOUNTLEVEL
},
5132 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5133 .windowed_register_op
= 0x1,
5135 .name
= "xsr.intclear",
5136 .translate
= translate_xsr
,
5137 .test_ill
= test_ill_xsr
,
5138 .par
= (const uint32_t[]){INTCLEAR
},
5140 XTENSA_OP_PRIVILEGED
|
5141 XTENSA_OP_EXIT_TB_0
|
5142 XTENSA_OP_CHECK_INTERRUPTS
,
5143 .windowed_register_op
= 0x1,
5145 .name
= "xsr.intenable",
5146 .translate
= translate_xsr
,
5147 .test_ill
= test_ill_xsr
,
5148 .par
= (const uint32_t[]){INTENABLE
},
5150 XTENSA_OP_PRIVILEGED
|
5151 XTENSA_OP_EXIT_TB_0
|
5152 XTENSA_OP_CHECK_INTERRUPTS
,
5153 .windowed_register_op
= 0x1,
5155 .name
= "xsr.interrupt",
5156 .translate
= translate_xsr
,
5157 .test_ill
= test_ill_xsr
,
5158 .par
= (const uint32_t[]){INTSET
},
5160 XTENSA_OP_PRIVILEGED
|
5161 XTENSA_OP_EXIT_TB_0
|
5162 XTENSA_OP_CHECK_INTERRUPTS
,
5163 .windowed_register_op
= 0x1,
5165 .name
= "xsr.intset",
5166 .translate
= translate_xsr
,
5167 .test_ill
= test_ill_xsr
,
5168 .par
= (const uint32_t[]){INTSET
},
5170 XTENSA_OP_PRIVILEGED
|
5171 XTENSA_OP_EXIT_TB_0
|
5172 XTENSA_OP_CHECK_INTERRUPTS
,
5173 .windowed_register_op
= 0x1,
5175 .name
= "xsr.itlbcfg",
5176 .translate
= translate_xsr
,
5177 .test_ill
= test_ill_xsr
,
5178 .par
= (const uint32_t[]){ITLBCFG
},
5179 .op_flags
= XTENSA_OP_PRIVILEGED
,
5180 .windowed_register_op
= 0x1,
5183 .translate
= translate_xsr
,
5184 .test_ill
= test_ill_xsr
,
5185 .par
= (const uint32_t[]){LBEG
},
5186 .op_flags
= XTENSA_OP_EXIT_TB_0
,
5187 .windowed_register_op
= 0x1,
5189 .name
= "xsr.lcount",
5190 .translate
= translate_xsr
,
5191 .test_ill
= test_ill_xsr
,
5192 .par
= (const uint32_t[]){LCOUNT
},
5193 .windowed_register_op
= 0x1,
5196 .translate
= translate_xsr
,
5197 .test_ill
= test_ill_xsr
,
5198 .par
= (const uint32_t[]){LEND
},
5199 .op_flags
= XTENSA_OP_EXIT_TB_0
,
5200 .windowed_register_op
= 0x1,
5202 .name
= "xsr.litbase",
5203 .translate
= translate_xsr
,
5204 .test_ill
= test_ill_xsr
,
5205 .par
= (const uint32_t[]){LITBASE
},
5206 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5207 .windowed_register_op
= 0x1,
5210 .translate
= translate_xsr
,
5211 .test_ill
= test_ill_xsr
,
5212 .par
= (const uint32_t[]){MR
},
5213 .windowed_register_op
= 0x1,
5216 .translate
= translate_xsr
,
5217 .test_ill
= test_ill_xsr
,
5218 .par
= (const uint32_t[]){MR
+ 1},
5219 .windowed_register_op
= 0x1,
5222 .translate
= translate_xsr
,
5223 .test_ill
= test_ill_xsr
,
5224 .par
= (const uint32_t[]){MR
+ 2},
5225 .windowed_register_op
= 0x1,
5228 .translate
= translate_xsr
,
5229 .test_ill
= test_ill_xsr
,
5230 .par
= (const uint32_t[]){MR
+ 3},
5231 .windowed_register_op
= 0x1,
5233 .name
= "xsr.memctl",
5234 .translate
= translate_xsr
,
5235 .test_ill
= test_ill_xsr
,
5236 .par
= (const uint32_t[]){MEMCTL
},
5237 .op_flags
= XTENSA_OP_PRIVILEGED
,
5238 .windowed_register_op
= 0x1,
5240 .name
= "xsr.misc0",
5241 .translate
= translate_xsr
,
5242 .test_ill
= test_ill_xsr
,
5243 .par
= (const uint32_t[]){MISC
},
5244 .op_flags
= XTENSA_OP_PRIVILEGED
,
5245 .windowed_register_op
= 0x1,
5247 .name
= "xsr.misc1",
5248 .translate
= translate_xsr
,
5249 .test_ill
= test_ill_xsr
,
5250 .par
= (const uint32_t[]){MISC
+ 1},
5251 .op_flags
= XTENSA_OP_PRIVILEGED
,
5252 .windowed_register_op
= 0x1,
5254 .name
= "xsr.misc2",
5255 .translate
= translate_xsr
,
5256 .test_ill
= test_ill_xsr
,
5257 .par
= (const uint32_t[]){MISC
+ 2},
5258 .op_flags
= XTENSA_OP_PRIVILEGED
,
5259 .windowed_register_op
= 0x1,
5261 .name
= "xsr.misc3",
5262 .translate
= translate_xsr
,
5263 .test_ill
= test_ill_xsr
,
5264 .par
= (const uint32_t[]){MISC
+ 3},
5265 .op_flags
= XTENSA_OP_PRIVILEGED
,
5266 .windowed_register_op
= 0x1,
5269 .translate
= translate_xsr
,
5270 .test_ill
= test_ill_xsr
,
5271 .par
= (const uint32_t[]){PRID
},
5272 .op_flags
= XTENSA_OP_PRIVILEGED
,
5273 .windowed_register_op
= 0x1,
5276 .translate
= translate_xsr
,
5277 .test_ill
= test_ill_xsr
,
5278 .par
= (const uint32_t[]){PS
},
5280 XTENSA_OP_PRIVILEGED
|
5281 XTENSA_OP_EXIT_TB_M1
|
5282 XTENSA_OP_CHECK_INTERRUPTS
,
5283 .windowed_register_op
= 0x1,
5285 .name
= "xsr.ptevaddr",
5286 .translate
= translate_xsr
,
5287 .test_ill
= test_ill_xsr
,
5288 .par
= (const uint32_t[]){PTEVADDR
},
5289 .op_flags
= XTENSA_OP_PRIVILEGED
,
5290 .windowed_register_op
= 0x1,
5292 .name
= "xsr.rasid",
5293 .translate
= translate_xsr
,
5294 .test_ill
= test_ill_xsr
,
5295 .par
= (const uint32_t[]){RASID
},
5296 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5297 .windowed_register_op
= 0x1,
5300 .translate
= translate_xsr
,
5301 .test_ill
= test_ill_xsr
,
5302 .par
= (const uint32_t[]){SAR
},
5303 .windowed_register_op
= 0x1,
5305 .name
= "xsr.scompare1",
5306 .translate
= translate_xsr
,
5307 .test_ill
= test_ill_xsr
,
5308 .par
= (const uint32_t[]){SCOMPARE1
},
5309 .windowed_register_op
= 0x1,
5311 .name
= "xsr.vecbase",
5312 .translate
= translate_xsr
,
5313 .test_ill
= test_ill_xsr
,
5314 .par
= (const uint32_t[]){VECBASE
},
5315 .op_flags
= XTENSA_OP_PRIVILEGED
,
5316 .windowed_register_op
= 0x1,
5318 .name
= "xsr.windowbase",
5319 .translate
= translate_xsr
,
5320 .test_ill
= test_ill_xsr
,
5321 .par
= (const uint32_t[]){WINDOW_BASE
},
5322 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5323 .windowed_register_op
= 0x1,
5325 .name
= "xsr.windowstart",
5326 .translate
= translate_xsr
,
5327 .test_ill
= test_ill_xsr
,
5328 .par
= (const uint32_t[]){WINDOW_START
},
5329 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5330 .windowed_register_op
= 0x1,
5334 const XtensaOpcodeTranslators xtensa_core_opcodes
= {
5335 .num_opcodes
= ARRAY_SIZE(core_ops
),
5340 static void translate_abs_s(DisasContext
*dc
, const uint32_t arg
[],
5341 const uint32_t par
[])
5343 gen_helper_abs_s(cpu_FR
[arg
[0]], cpu_FR
[arg
[1]]);
5346 static void translate_add_s(DisasContext
*dc
, const uint32_t arg
[],
5347 const uint32_t par
[])
5349 gen_helper_add_s(cpu_FR
[arg
[0]], cpu_env
,
5350 cpu_FR
[arg
[1]], cpu_FR
[arg
[2]]);
5363 static void translate_compare_s(DisasContext
*dc
, const uint32_t arg
[],
5364 const uint32_t par
[])
5366 static void (* const helper
[])(TCGv_env env
, TCGv_i32 bit
,
5367 TCGv_i32 s
, TCGv_i32 t
) = {
5368 [COMPARE_UN
] = gen_helper_un_s
,
5369 [COMPARE_OEQ
] = gen_helper_oeq_s
,
5370 [COMPARE_UEQ
] = gen_helper_ueq_s
,
5371 [COMPARE_OLT
] = gen_helper_olt_s
,
5372 [COMPARE_ULT
] = gen_helper_ult_s
,
5373 [COMPARE_OLE
] = gen_helper_ole_s
,
5374 [COMPARE_ULE
] = gen_helper_ule_s
,
5376 TCGv_i32 bit
= tcg_const_i32(1 << arg
[0]);
5378 helper
[par
[0]](cpu_env
, bit
, cpu_FR
[arg
[1]], cpu_FR
[arg
[2]]);
5382 static void translate_float_s(DisasContext
*dc
, const uint32_t arg
[],
5383 const uint32_t par
[])
5385 TCGv_i32 scale
= tcg_const_i32(-arg
[2]);
5388 gen_helper_uitof(cpu_FR
[arg
[0]], cpu_env
, cpu_R
[arg
[1]], scale
);
5390 gen_helper_itof(cpu_FR
[arg
[0]], cpu_env
, cpu_R
[arg
[1]], scale
);
5392 tcg_temp_free(scale
);
5395 static void translate_ftoi_s(DisasContext
*dc
, const uint32_t arg
[],
5396 const uint32_t par
[])
5398 TCGv_i32 rounding_mode
= tcg_const_i32(par
[0]);
5399 TCGv_i32 scale
= tcg_const_i32(arg
[2]);
5402 gen_helper_ftoui(cpu_R
[arg
[0]], cpu_FR
[arg
[1]],
5403 rounding_mode
, scale
);
5405 gen_helper_ftoi(cpu_R
[arg
[0]], cpu_FR
[arg
[1]],
5406 rounding_mode
, scale
);
5408 tcg_temp_free(rounding_mode
);
5409 tcg_temp_free(scale
);
5412 static void translate_ldsti(DisasContext
*dc
, const uint32_t arg
[],
5413 const uint32_t par
[])
5415 TCGv_i32 addr
= tcg_temp_new_i32();
5417 tcg_gen_addi_i32(addr
, cpu_R
[arg
[1]], arg
[2]);
5418 gen_load_store_alignment(dc
, 2, addr
, false);
5420 tcg_gen_qemu_st32(cpu_FR
[arg
[0]], addr
, dc
->cring
);
5422 tcg_gen_qemu_ld32u(cpu_FR
[arg
[0]], addr
, dc
->cring
);
5425 tcg_gen_mov_i32(cpu_R
[arg
[1]], addr
);
5427 tcg_temp_free(addr
);
5430 static void translate_ldstx(DisasContext
*dc
, const uint32_t arg
[],
5431 const uint32_t par
[])
5433 TCGv_i32 addr
= tcg_temp_new_i32();
5435 tcg_gen_add_i32(addr
, cpu_R
[arg
[1]], cpu_R
[arg
[2]]);
5436 gen_load_store_alignment(dc
, 2, addr
, false);
5438 tcg_gen_qemu_st32(cpu_FR
[arg
[0]], addr
, dc
->cring
);
5440 tcg_gen_qemu_ld32u(cpu_FR
[arg
[0]], addr
, dc
->cring
);
5443 tcg_gen_mov_i32(cpu_R
[arg
[1]], addr
);
5445 tcg_temp_free(addr
);
5448 static void translate_madd_s(DisasContext
*dc
, const uint32_t arg
[],
5449 const uint32_t par
[])
5451 gen_helper_madd_s(cpu_FR
[arg
[0]], cpu_env
,
5452 cpu_FR
[arg
[0]], cpu_FR
[arg
[1]], cpu_FR
[arg
[2]]);
5455 static void translate_mov_s(DisasContext
*dc
, const uint32_t arg
[],
5456 const uint32_t par
[])
5458 tcg_gen_mov_i32(cpu_FR
[arg
[0]], cpu_FR
[arg
[1]]);
5461 static void translate_movcond_s(DisasContext
*dc
, const uint32_t arg
[],
5462 const uint32_t par
[])
5464 TCGv_i32 zero
= tcg_const_i32(0);
5466 tcg_gen_movcond_i32(par
[0], cpu_FR
[arg
[0]],
5467 cpu_R
[arg
[2]], zero
,
5468 cpu_FR
[arg
[1]], cpu_FR
[arg
[0]]);
5469 tcg_temp_free(zero
);
5472 static void translate_movp_s(DisasContext
*dc
, const uint32_t arg
[],
5473 const uint32_t par
[])
5475 TCGv_i32 zero
= tcg_const_i32(0);
5476 TCGv_i32 tmp
= tcg_temp_new_i32();
5478 tcg_gen_andi_i32(tmp
, cpu_SR
[BR
], 1 << arg
[2]);
5479 tcg_gen_movcond_i32(par
[0],
5480 cpu_FR
[arg
[0]], tmp
, zero
,
5481 cpu_FR
[arg
[1]], cpu_FR
[arg
[0]]);
5483 tcg_temp_free(zero
);
5486 static void translate_mul_s(DisasContext
*dc
, const uint32_t arg
[],
5487 const uint32_t par
[])
5489 gen_helper_mul_s(cpu_FR
[arg
[0]], cpu_env
,
5490 cpu_FR
[arg
[1]], cpu_FR
[arg
[2]]);
5493 static void translate_msub_s(DisasContext
*dc
, const uint32_t arg
[],
5494 const uint32_t par
[])
5496 gen_helper_msub_s(cpu_FR
[arg
[0]], cpu_env
,
5497 cpu_FR
[arg
[0]], cpu_FR
[arg
[1]], cpu_FR
[arg
[2]]);
5500 static void translate_neg_s(DisasContext
*dc
, const uint32_t arg
[],
5501 const uint32_t par
[])
5503 gen_helper_neg_s(cpu_FR
[arg
[0]], cpu_FR
[arg
[1]]);
5506 static void translate_rfr_s(DisasContext
*dc
, const uint32_t arg
[],
5507 const uint32_t par
[])
5509 tcg_gen_mov_i32(cpu_R
[arg
[0]], cpu_FR
[arg
[1]]);
5512 static void translate_sub_s(DisasContext
*dc
, const uint32_t arg
[],
5513 const uint32_t par
[])
5515 gen_helper_sub_s(cpu_FR
[arg
[0]], cpu_env
,
5516 cpu_FR
[arg
[1]], cpu_FR
[arg
[2]]);
5519 static void translate_wfr_s(DisasContext
*dc
, const uint32_t arg
[],
5520 const uint32_t par
[])
5522 tcg_gen_mov_i32(cpu_FR
[arg
[0]], cpu_R
[arg
[1]]);
5525 static const XtensaOpcodeOps fpu2000_ops
[] = {
5528 .translate
= translate_abs_s
,
5532 .translate
= translate_add_s
,
5536 .translate
= translate_ftoi_s
,
5537 .par
= (const uint32_t[]){float_round_up
, false},
5538 .windowed_register_op
= 0x1,
5542 .translate
= translate_float_s
,
5543 .par
= (const uint32_t[]){false},
5544 .windowed_register_op
= 0x2,
5548 .translate
= translate_ftoi_s
,
5549 .par
= (const uint32_t[]){float_round_down
, false},
5550 .windowed_register_op
= 0x1,
5554 .translate
= translate_ldsti
,
5555 .par
= (const uint32_t[]){false, false},
5556 .windowed_register_op
= 0x2,
5560 .translate
= translate_ldsti
,
5561 .par
= (const uint32_t[]){false, true},
5562 .windowed_register_op
= 0x2,
5566 .translate
= translate_ldstx
,
5567 .par
= (const uint32_t[]){false, false},
5568 .windowed_register_op
= 0x6,
5572 .translate
= translate_ldstx
,
5573 .par
= (const uint32_t[]){false, true},
5574 .windowed_register_op
= 0x6,
5578 .translate
= translate_madd_s
,
5582 .translate
= translate_mov_s
,
5586 .translate
= translate_movcond_s
,
5587 .par
= (const uint32_t[]){TCG_COND_EQ
},
5588 .windowed_register_op
= 0x4,
5592 .translate
= translate_movp_s
,
5593 .par
= (const uint32_t[]){TCG_COND_EQ
},
5597 .translate
= translate_movcond_s
,
5598 .par
= (const uint32_t[]){TCG_COND_GE
},
5599 .windowed_register_op
= 0x4,
5603 .translate
= translate_movcond_s
,
5604 .par
= (const uint32_t[]){TCG_COND_LT
},
5605 .windowed_register_op
= 0x4,
5609 .translate
= translate_movcond_s
,
5610 .par
= (const uint32_t[]){TCG_COND_NE
},
5611 .windowed_register_op
= 0x4,
5615 .translate
= translate_movp_s
,
5616 .par
= (const uint32_t[]){TCG_COND_NE
},
5620 .translate
= translate_msub_s
,
5624 .translate
= translate_mul_s
,
5628 .translate
= translate_neg_s
,
5632 .translate
= translate_compare_s
,
5633 .par
= (const uint32_t[]){COMPARE_OEQ
},
5637 .translate
= translate_compare_s
,
5638 .par
= (const uint32_t[]){COMPARE_OLE
},
5642 .translate
= translate_compare_s
,
5643 .par
= (const uint32_t[]){COMPARE_OLT
},
5647 .translate
= translate_rfr_s
,
5648 .windowed_register_op
= 0x1,
5652 .translate
= translate_ftoi_s
,
5653 .par
= (const uint32_t[]){float_round_nearest_even
, false},
5654 .windowed_register_op
= 0x1,
5658 .translate
= translate_ldsti
,
5659 .par
= (const uint32_t[]){true, false},
5660 .windowed_register_op
= 0x2,
5664 .translate
= translate_ldsti
,
5665 .par
= (const uint32_t[]){true, true},
5666 .windowed_register_op
= 0x2,
5670 .translate
= translate_ldstx
,
5671 .par
= (const uint32_t[]){true, false},
5672 .windowed_register_op
= 0x6,
5676 .translate
= translate_ldstx
,
5677 .par
= (const uint32_t[]){true, true},
5678 .windowed_register_op
= 0x6,
5682 .translate
= translate_sub_s
,
5686 .translate
= translate_ftoi_s
,
5687 .par
= (const uint32_t[]){float_round_to_zero
, false},
5688 .windowed_register_op
= 0x1,
5692 .translate
= translate_compare_s
,
5693 .par
= (const uint32_t[]){COMPARE_UEQ
},
5697 .translate
= translate_float_s
,
5698 .par
= (const uint32_t[]){true},
5699 .windowed_register_op
= 0x2,
5703 .translate
= translate_compare_s
,
5704 .par
= (const uint32_t[]){COMPARE_ULE
},
5708 .translate
= translate_compare_s
,
5709 .par
= (const uint32_t[]){COMPARE_ULT
},
5713 .translate
= translate_compare_s
,
5714 .par
= (const uint32_t[]){COMPARE_UN
},
5718 .translate
= translate_ftoi_s
,
5719 .par
= (const uint32_t[]){float_round_to_zero
, true},
5720 .windowed_register_op
= 0x1,
5724 .translate
= translate_wfr_s
,
5725 .windowed_register_op
= 0x2,
5730 const XtensaOpcodeTranslators xtensa_fpu2000_opcodes
= {
5731 .num_opcodes
= ARRAY_SIZE(fpu2000_ops
),
5732 .opcode
= fpu2000_ops
,