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"
36 #include "tcg/tcg-op.h"
38 #include "qemu/qemu-print.h"
39 #include "exec/cpu_ldst.h"
40 #include "semihosting/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_word insnbuf
[MAX_INSNBUF_LENGTH
];
76 xtensa_insnbuf_word slotbuf
[MAX_INSNBUF_LENGTH
];
79 static TCGv_i32 cpu_pc
;
80 static TCGv_i32 cpu_R
[16];
81 static TCGv_i32 cpu_FR
[16];
82 static TCGv_i64 cpu_FRD
[16];
83 static TCGv_i32 cpu_MR
[4];
84 static TCGv_i32 cpu_BR
[16];
85 static TCGv_i32 cpu_BR4
[4];
86 static TCGv_i32 cpu_BR8
[2];
87 static TCGv_i32 cpu_SR
[256];
88 static TCGv_i32 cpu_UR
[256];
89 static TCGv_i32 cpu_windowbase_next
;
90 static TCGv_i32 cpu_exclusive_addr
;
91 static TCGv_i32 cpu_exclusive_val
;
93 static GHashTable
*xtensa_regfile_table
;
95 #include "exec/gen-icount.h"
97 static char *sr_name
[256];
98 static char *ur_name
[256];
100 void xtensa_collect_sr_names(const XtensaConfig
*config
)
102 xtensa_isa isa
= config
->isa
;
103 int n
= xtensa_isa_num_sysregs(isa
);
106 for (i
= 0; i
< n
; ++i
) {
107 int sr
= xtensa_sysreg_number(isa
, i
);
109 if (sr
>= 0 && sr
< 256) {
110 const char *name
= xtensa_sysreg_name(isa
, i
);
112 (xtensa_sysreg_is_user(isa
, i
) ? ur_name
: sr_name
) + sr
;
115 if (strstr(*pname
, name
) == NULL
) {
117 malloc(strlen(*pname
) + strlen(name
) + 2);
119 strcpy(new_name
, *pname
);
120 strcat(new_name
, "/");
121 strcat(new_name
, name
);
126 *pname
= strdup(name
);
132 void xtensa_translate_init(void)
134 static const char * const regnames
[] = {
135 "ar0", "ar1", "ar2", "ar3",
136 "ar4", "ar5", "ar6", "ar7",
137 "ar8", "ar9", "ar10", "ar11",
138 "ar12", "ar13", "ar14", "ar15",
140 static const char * const fregnames
[] = {
141 "f0", "f1", "f2", "f3",
142 "f4", "f5", "f6", "f7",
143 "f8", "f9", "f10", "f11",
144 "f12", "f13", "f14", "f15",
146 static const char * const mregnames
[] = {
147 "m0", "m1", "m2", "m3",
149 static const char * const bregnames
[] = {
150 "b0", "b1", "b2", "b3",
151 "b4", "b5", "b6", "b7",
152 "b8", "b9", "b10", "b11",
153 "b12", "b13", "b14", "b15",
157 cpu_pc
= tcg_global_mem_new_i32(cpu_env
,
158 offsetof(CPUXtensaState
, pc
), "pc");
160 for (i
= 0; i
< 16; i
++) {
161 cpu_R
[i
] = tcg_global_mem_new_i32(cpu_env
,
162 offsetof(CPUXtensaState
, regs
[i
]),
166 for (i
= 0; i
< 16; i
++) {
167 cpu_FR
[i
] = tcg_global_mem_new_i32(cpu_env
,
168 offsetof(CPUXtensaState
,
169 fregs
[i
].f32
[FP_F32_LOW
]),
173 for (i
= 0; i
< 16; i
++) {
174 cpu_FRD
[i
] = tcg_global_mem_new_i64(cpu_env
,
175 offsetof(CPUXtensaState
,
180 for (i
= 0; i
< 4; i
++) {
181 cpu_MR
[i
] = tcg_global_mem_new_i32(cpu_env
,
182 offsetof(CPUXtensaState
,
187 for (i
= 0; i
< 16; i
++) {
188 cpu_BR
[i
] = tcg_global_mem_new_i32(cpu_env
,
189 offsetof(CPUXtensaState
,
193 cpu_BR4
[i
/ 4] = tcg_global_mem_new_i32(cpu_env
,
194 offsetof(CPUXtensaState
,
199 cpu_BR8
[i
/ 8] = tcg_global_mem_new_i32(cpu_env
,
200 offsetof(CPUXtensaState
,
206 for (i
= 0; i
< 256; ++i
) {
208 cpu_SR
[i
] = tcg_global_mem_new_i32(cpu_env
,
209 offsetof(CPUXtensaState
,
215 for (i
= 0; i
< 256; ++i
) {
217 cpu_UR
[i
] = tcg_global_mem_new_i32(cpu_env
,
218 offsetof(CPUXtensaState
,
224 cpu_windowbase_next
=
225 tcg_global_mem_new_i32(cpu_env
,
226 offsetof(CPUXtensaState
, windowbase_next
),
229 tcg_global_mem_new_i32(cpu_env
,
230 offsetof(CPUXtensaState
, exclusive_addr
),
233 tcg_global_mem_new_i32(cpu_env
,
234 offsetof(CPUXtensaState
, exclusive_val
),
238 void **xtensa_get_regfile_by_name(const char *name
, int entries
, int bits
)
243 if (xtensa_regfile_table
== NULL
) {
244 xtensa_regfile_table
= g_hash_table_new(g_str_hash
, g_str_equal
);
246 * AR is special. Xtensa translator uses it as a current register
247 * window, but configuration overlays represent it as a complete
248 * physical register file.
250 g_hash_table_insert(xtensa_regfile_table
,
251 (void *)"AR 16x32", (void *)cpu_R
);
252 g_hash_table_insert(xtensa_regfile_table
,
253 (void *)"AR 32x32", (void *)cpu_R
);
254 g_hash_table_insert(xtensa_regfile_table
,
255 (void *)"AR 64x32", (void *)cpu_R
);
257 g_hash_table_insert(xtensa_regfile_table
,
258 (void *)"MR 4x32", (void *)cpu_MR
);
260 g_hash_table_insert(xtensa_regfile_table
,
261 (void *)"FR 16x32", (void *)cpu_FR
);
262 g_hash_table_insert(xtensa_regfile_table
,
263 (void *)"FR 16x64", (void *)cpu_FRD
);
265 g_hash_table_insert(xtensa_regfile_table
,
266 (void *)"BR 16x1", (void *)cpu_BR
);
267 g_hash_table_insert(xtensa_regfile_table
,
268 (void *)"BR4 4x4", (void *)cpu_BR4
);
269 g_hash_table_insert(xtensa_regfile_table
,
270 (void *)"BR8 2x8", (void *)cpu_BR8
);
273 geometry_name
= g_strdup_printf("%s %dx%d", name
, entries
, bits
);
274 res
= (void **)g_hash_table_lookup(xtensa_regfile_table
, geometry_name
);
275 g_free(geometry_name
);
279 static inline bool option_enabled(DisasContext
*dc
, int opt
)
281 return xtensa_option_enabled(dc
->config
, opt
);
284 static void init_sar_tracker(DisasContext
*dc
)
286 dc
->sar_5bit
= false;
287 dc
->sar_m32_5bit
= false;
288 dc
->sar_m32_allocated
= false;
291 static void reset_sar_tracker(DisasContext
*dc
)
293 if (dc
->sar_m32_allocated
) {
294 tcg_temp_free(dc
->sar_m32
);
298 static void gen_right_shift_sar(DisasContext
*dc
, TCGv_i32 sa
)
300 tcg_gen_andi_i32(cpu_SR
[SAR
], sa
, 0x1f);
301 if (dc
->sar_m32_5bit
) {
302 tcg_gen_discard_i32(dc
->sar_m32
);
305 dc
->sar_m32_5bit
= false;
308 static void gen_left_shift_sar(DisasContext
*dc
, TCGv_i32 sa
)
310 TCGv_i32 tmp
= tcg_const_i32(32);
311 if (!dc
->sar_m32_allocated
) {
312 dc
->sar_m32
= tcg_temp_local_new_i32();
313 dc
->sar_m32_allocated
= true;
315 tcg_gen_andi_i32(dc
->sar_m32
, sa
, 0x1f);
316 tcg_gen_sub_i32(cpu_SR
[SAR
], tmp
, dc
->sar_m32
);
317 dc
->sar_5bit
= false;
318 dc
->sar_m32_5bit
= true;
322 static void gen_exception(DisasContext
*dc
, int excp
)
324 TCGv_i32 tmp
= tcg_const_i32(excp
);
325 gen_helper_exception(cpu_env
, tmp
);
329 static void gen_exception_cause(DisasContext
*dc
, uint32_t cause
)
331 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
332 TCGv_i32 tcause
= tcg_const_i32(cause
);
333 gen_helper_exception_cause(cpu_env
, tpc
, tcause
);
335 tcg_temp_free(tcause
);
336 if (cause
== ILLEGAL_INSTRUCTION_CAUSE
||
337 cause
== SYSCALL_CAUSE
) {
338 dc
->base
.is_jmp
= DISAS_NORETURN
;
342 static void gen_exception_cause_vaddr(DisasContext
*dc
, uint32_t cause
,
345 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
346 TCGv_i32 tcause
= tcg_const_i32(cause
);
347 gen_helper_exception_cause_vaddr(cpu_env
, tpc
, tcause
, vaddr
);
349 tcg_temp_free(tcause
);
352 static void gen_debug_exception(DisasContext
*dc
, uint32_t cause
)
354 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
355 TCGv_i32 tcause
= tcg_const_i32(cause
);
356 gen_helper_debug_exception(cpu_env
, tpc
, tcause
);
358 tcg_temp_free(tcause
);
359 if (cause
& (DEBUGCAUSE_IB
| DEBUGCAUSE_BI
| DEBUGCAUSE_BN
)) {
360 dc
->base
.is_jmp
= DISAS_NORETURN
;
364 static bool gen_check_privilege(DisasContext
*dc
)
366 #ifndef CONFIG_USER_ONLY
371 gen_exception_cause(dc
, PRIVILEGED_CAUSE
);
372 dc
->base
.is_jmp
= DISAS_NORETURN
;
376 static bool gen_check_cpenable(DisasContext
*dc
, uint32_t cp_mask
)
378 cp_mask
&= ~dc
->cpenable
;
380 if (option_enabled(dc
, XTENSA_OPTION_COPROCESSOR
) && cp_mask
) {
381 gen_exception_cause(dc
, COPROCESSOR0_DISABLED
+ ctz32(cp_mask
));
382 dc
->base
.is_jmp
= DISAS_NORETURN
;
388 static int gen_postprocess(DisasContext
*dc
, int slot
);
390 static void gen_jump_slot(DisasContext
*dc
, TCGv dest
, int slot
)
392 tcg_gen_mov_i32(cpu_pc
, dest
);
394 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
396 if (dc
->base
.singlestep_enabled
) {
397 gen_exception(dc
, EXCP_DEBUG
);
399 if (dc
->op_flags
& XTENSA_OP_POSTPROCESS
) {
400 slot
= gen_postprocess(dc
, slot
);
403 tcg_gen_goto_tb(slot
);
404 tcg_gen_exit_tb(dc
->base
.tb
, slot
);
406 tcg_gen_exit_tb(NULL
, 0);
409 dc
->base
.is_jmp
= DISAS_NORETURN
;
412 static void gen_jump(DisasContext
*dc
, TCGv dest
)
414 gen_jump_slot(dc
, dest
, -1);
417 static int adjust_jump_slot(DisasContext
*dc
, uint32_t dest
, int slot
)
419 if (((dc
->base
.pc_first
^ dest
) & TARGET_PAGE_MASK
) != 0) {
426 static void gen_jumpi(DisasContext
*dc
, uint32_t dest
, int slot
)
428 TCGv_i32 tmp
= tcg_const_i32(dest
);
429 gen_jump_slot(dc
, tmp
, adjust_jump_slot(dc
, dest
, slot
));
433 static void gen_callw_slot(DisasContext
*dc
, int callinc
, TCGv_i32 dest
,
436 TCGv_i32 tcallinc
= tcg_const_i32(callinc
);
438 tcg_gen_deposit_i32(cpu_SR
[PS
], cpu_SR
[PS
],
439 tcallinc
, PS_CALLINC_SHIFT
, PS_CALLINC_LEN
);
440 tcg_temp_free(tcallinc
);
441 tcg_gen_movi_i32(cpu_R
[callinc
<< 2],
442 (callinc
<< 30) | (dc
->base
.pc_next
& 0x3fffffff));
443 gen_jump_slot(dc
, dest
, slot
);
446 static bool gen_check_loop_end(DisasContext
*dc
, int slot
)
448 if (dc
->base
.pc_next
== dc
->lend
) {
449 TCGLabel
*label
= gen_new_label();
451 tcg_gen_brcondi_i32(TCG_COND_EQ
, cpu_SR
[LCOUNT
], 0, label
);
452 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], cpu_SR
[LCOUNT
], 1);
454 gen_jumpi(dc
, dc
->base
.pc_next
- dc
->lbeg_off
, slot
);
456 gen_jump(dc
, cpu_SR
[LBEG
]);
458 gen_set_label(label
);
459 gen_jumpi(dc
, dc
->base
.pc_next
, -1);
465 static void gen_jumpi_check_loop_end(DisasContext
*dc
, int slot
)
467 if (!gen_check_loop_end(dc
, slot
)) {
468 gen_jumpi(dc
, dc
->base
.pc_next
, slot
);
472 static void gen_brcond(DisasContext
*dc
, TCGCond cond
,
473 TCGv_i32 t0
, TCGv_i32 t1
, uint32_t addr
)
475 TCGLabel
*label
= gen_new_label();
477 tcg_gen_brcond_i32(cond
, t0
, t1
, label
);
478 gen_jumpi_check_loop_end(dc
, 0);
479 gen_set_label(label
);
480 gen_jumpi(dc
, addr
, 1);
483 static void gen_brcondi(DisasContext
*dc
, TCGCond cond
,
484 TCGv_i32 t0
, uint32_t t1
, uint32_t addr
)
486 TCGv_i32 tmp
= tcg_const_i32(t1
);
487 gen_brcond(dc
, cond
, t0
, tmp
, addr
);
491 static uint32_t test_exceptions_sr(DisasContext
*dc
, const OpcodeArg arg
[],
492 const uint32_t par
[])
494 return xtensa_option_enabled(dc
->config
, par
[1]) ? 0 : XTENSA_OP_ILL
;
497 static uint32_t test_exceptions_ccompare(DisasContext
*dc
,
498 const OpcodeArg arg
[],
499 const uint32_t par
[])
501 unsigned n
= par
[0] - CCOMPARE
;
503 if (n
>= dc
->config
->nccompare
) {
504 return XTENSA_OP_ILL
;
506 return test_exceptions_sr(dc
, arg
, par
);
509 static uint32_t test_exceptions_dbreak(DisasContext
*dc
, const OpcodeArg arg
[],
510 const uint32_t par
[])
512 unsigned n
= MAX_NDBREAK
;
514 if (par
[0] >= DBREAKA
&& par
[0] < DBREAKA
+ MAX_NDBREAK
) {
515 n
= par
[0] - DBREAKA
;
517 if (par
[0] >= DBREAKC
&& par
[0] < DBREAKC
+ MAX_NDBREAK
) {
518 n
= par
[0] - DBREAKC
;
520 if (n
>= dc
->config
->ndbreak
) {
521 return XTENSA_OP_ILL
;
523 return test_exceptions_sr(dc
, arg
, par
);
526 static uint32_t test_exceptions_ibreak(DisasContext
*dc
, const OpcodeArg arg
[],
527 const uint32_t par
[])
529 unsigned n
= par
[0] - IBREAKA
;
531 if (n
>= dc
->config
->nibreak
) {
532 return XTENSA_OP_ILL
;
534 return test_exceptions_sr(dc
, arg
, par
);
537 static uint32_t test_exceptions_hpi(DisasContext
*dc
, const OpcodeArg arg
[],
538 const uint32_t par
[])
540 unsigned n
= MAX_NLEVEL
+ 1;
542 if (par
[0] >= EXCSAVE1
&& par
[0] < EXCSAVE1
+ MAX_NLEVEL
) {
543 n
= par
[0] - EXCSAVE1
+ 1;
545 if (par
[0] >= EPC1
&& par
[0] < EPC1
+ MAX_NLEVEL
) {
546 n
= par
[0] - EPC1
+ 1;
548 if (par
[0] >= EPS2
&& par
[0] < EPS2
+ MAX_NLEVEL
- 1) {
549 n
= par
[0] - EPS2
+ 2;
551 if (n
> dc
->config
->nlevel
) {
552 return XTENSA_OP_ILL
;
554 return test_exceptions_sr(dc
, arg
, par
);
557 static void gen_load_store_alignment(DisasContext
*dc
, int shift
,
558 TCGv_i32 addr
, bool no_hw_alignment
)
560 if (!option_enabled(dc
, XTENSA_OPTION_UNALIGNED_EXCEPTION
)) {
561 tcg_gen_andi_i32(addr
, addr
, ~0 << shift
);
562 } else if (option_enabled(dc
, XTENSA_OPTION_HW_ALIGNMENT
) &&
564 TCGLabel
*label
= gen_new_label();
565 TCGv_i32 tmp
= tcg_temp_new_i32();
566 tcg_gen_andi_i32(tmp
, addr
, ~(~0 << shift
));
567 tcg_gen_brcondi_i32(TCG_COND_EQ
, tmp
, 0, label
);
568 gen_exception_cause_vaddr(dc
, LOAD_STORE_ALIGNMENT_CAUSE
, addr
);
569 gen_set_label(label
);
574 #ifndef CONFIG_USER_ONLY
575 static void gen_waiti(DisasContext
*dc
, uint32_t imm4
)
577 TCGv_i32 pc
= tcg_const_i32(dc
->base
.pc_next
);
578 TCGv_i32 intlevel
= tcg_const_i32(imm4
);
580 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
583 gen_helper_waiti(cpu_env
, pc
, intlevel
);
585 tcg_temp_free(intlevel
);
589 static bool gen_window_check(DisasContext
*dc
, uint32_t mask
)
591 unsigned r
= 31 - clz32(mask
);
593 if (r
/ 4 > dc
->window
) {
594 TCGv_i32 pc
= tcg_const_i32(dc
->pc
);
595 TCGv_i32 w
= tcg_const_i32(r
/ 4);
597 gen_helper_window_check(cpu_env
, pc
, w
);
598 dc
->base
.is_jmp
= DISAS_NORETURN
;
604 static TCGv_i32
gen_mac16_m(TCGv_i32 v
, bool hi
, bool is_unsigned
)
606 TCGv_i32 m
= tcg_temp_new_i32();
609 (is_unsigned
? tcg_gen_shri_i32
: tcg_gen_sari_i32
)(m
, v
, 16);
611 (is_unsigned
? tcg_gen_ext16u_i32
: tcg_gen_ext16s_i32
)(m
, v
);
616 static void gen_zero_check(DisasContext
*dc
, const OpcodeArg arg
[])
618 TCGLabel
*label
= gen_new_label();
620 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[2].in
, 0, label
);
621 gen_exception_cause(dc
, INTEGER_DIVIDE_BY_ZERO_CAUSE
);
622 gen_set_label(label
);
625 static inline unsigned xtensa_op0_insn_len(DisasContext
*dc
, uint8_t op0
)
627 return xtensa_isa_length_from_chars(dc
->config
->isa
, &op0
);
630 static int gen_postprocess(DisasContext
*dc
, int slot
)
632 uint32_t op_flags
= dc
->op_flags
;
634 #ifndef CONFIG_USER_ONLY
635 if (op_flags
& XTENSA_OP_CHECK_INTERRUPTS
) {
636 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
639 gen_helper_check_interrupts(cpu_env
);
642 if (op_flags
& XTENSA_OP_SYNC_REGISTER_WINDOW
) {
643 gen_helper_sync_windowbase(cpu_env
);
645 if (op_flags
& XTENSA_OP_EXIT_TB_M1
) {
651 struct opcode_arg_copy
{
657 struct opcode_arg_info
{
663 XtensaOpcodeOps
*ops
;
664 OpcodeArg arg
[MAX_OPCODE_ARGS
];
665 struct opcode_arg_info in
[MAX_OPCODE_ARGS
];
666 struct opcode_arg_info out
[MAX_OPCODE_ARGS
];
678 static uint32_t encode_resource(enum resource_type r
, unsigned g
, unsigned n
)
680 assert(r
< RES_MAX
&& g
< 256 && n
< 65536);
681 return (r
<< 24) | (g
<< 16) | n
;
684 static enum resource_type
get_resource_type(uint32_t resource
)
686 return resource
>> 24;
690 * a depends on b if b must be executed before a,
691 * because a's side effects will destroy b's inputs.
693 static bool op_depends_on(const struct slot_prop
*a
,
694 const struct slot_prop
*b
)
699 if (a
->op_flags
& XTENSA_OP_CONTROL_FLOW
) {
702 if ((a
->op_flags
& XTENSA_OP_LOAD_STORE
) <
703 (b
->op_flags
& XTENSA_OP_LOAD_STORE
)) {
706 while (i
< a
->n_out
&& j
< b
->n_in
) {
707 if (a
->out
[i
].resource
< b
->in
[j
].resource
) {
709 } else if (a
->out
[i
].resource
> b
->in
[j
].resource
) {
719 * Try to break a dependency on b, append temporary register copy records
720 * to the end of copy and update n_copy in case of success.
721 * This is not always possible: e.g. control flow must always be the last,
722 * load/store must be first and state dependencies are not supported yet.
724 static bool break_dependency(struct slot_prop
*a
,
726 struct opcode_arg_copy
*copy
,
731 unsigned n
= *n_copy
;
734 if (a
->op_flags
& XTENSA_OP_CONTROL_FLOW
) {
737 if ((a
->op_flags
& XTENSA_OP_LOAD_STORE
) <
738 (b
->op_flags
& XTENSA_OP_LOAD_STORE
)) {
741 while (i
< a
->n_out
&& j
< b
->n_in
) {
742 if (a
->out
[i
].resource
< b
->in
[j
].resource
) {
744 } else if (a
->out
[i
].resource
> b
->in
[j
].resource
) {
747 int index
= b
->in
[j
].index
;
749 if (get_resource_type(a
->out
[i
].resource
) != RES_REGFILE
||
753 copy
[n
].resource
= b
->in
[j
].resource
;
754 copy
[n
].arg
= b
->arg
+ index
;
765 * Calculate evaluation order for slot opcodes.
766 * Build opcode order graph and output its nodes in topological sort order.
767 * An edge a -> b in the graph means that opcode a must be followed by
770 static bool tsort(struct slot_prop
*slot
,
771 struct slot_prop
*sorted
[],
773 struct opcode_arg_copy
*copy
,
779 unsigned out_edge
[MAX_INSN_SLOTS
];
780 } node
[MAX_INSN_SLOTS
];
782 unsigned in
[MAX_INSN_SLOTS
];
788 unsigned node_idx
= 0;
790 for (i
= 0; i
< n
; ++i
) {
791 node
[i
].n_in_edge
= 0;
792 node
[i
].n_out_edge
= 0;
795 for (i
= 0; i
< n
; ++i
) {
796 unsigned n_out_edge
= 0;
798 for (j
= 0; j
< n
; ++j
) {
799 if (i
!= j
&& op_depends_on(slot
+ j
, slot
+ i
)) {
800 node
[i
].out_edge
[n_out_edge
] = j
;
806 node
[i
].n_out_edge
= n_out_edge
;
809 for (i
= 0; i
< n
; ++i
) {
810 if (!node
[i
].n_in_edge
) {
817 for (; in_idx
< n_in
; ++in_idx
) {
819 sorted
[n_out
] = slot
+ i
;
821 for (j
= 0; j
< node
[i
].n_out_edge
; ++j
) {
823 if (--node
[node
[i
].out_edge
[j
]].n_in_edge
== 0) {
824 in
[n_in
] = node
[i
].out_edge
[j
];
830 for (; node_idx
< n
; ++node_idx
) {
831 struct tsnode
*cnode
= node
+ node_idx
;
833 if (cnode
->n_in_edge
) {
834 for (j
= 0; j
< cnode
->n_out_edge
; ++j
) {
835 unsigned k
= cnode
->out_edge
[j
];
837 if (break_dependency(slot
+ k
, slot
+ node_idx
,
839 --node
[k
].n_in_edge
== 0) {
844 cnode
->out_edge
[cnode
->n_out_edge
- 1];
855 static void opcode_add_resource(struct slot_prop
*op
,
856 uint32_t resource
, char direction
,
862 assert(op
->n_in
< ARRAY_SIZE(op
->in
));
863 op
->in
[op
->n_in
].resource
= resource
;
864 op
->in
[op
->n_in
].index
= index
;
868 if (direction
== 'm' || direction
== 'o') {
869 assert(op
->n_out
< ARRAY_SIZE(op
->out
));
870 op
->out
[op
->n_out
].resource
= resource
;
871 op
->out
[op
->n_out
].index
= index
;
876 g_assert_not_reached();
880 static int resource_compare(const void *a
, const void *b
)
882 const struct opcode_arg_info
*pa
= a
;
883 const struct opcode_arg_info
*pb
= b
;
885 return pa
->resource
< pb
->resource
?
886 -1 : (pa
->resource
> pb
->resource
? 1 : 0);
889 static int arg_copy_compare(const void *a
, const void *b
)
891 const struct opcode_arg_copy
*pa
= a
;
892 const struct opcode_arg_copy
*pb
= b
;
894 return pa
->resource
< pb
->resource
?
895 -1 : (pa
->resource
> pb
->resource
? 1 : 0);
898 static void disas_xtensa_insn(CPUXtensaState
*env
, DisasContext
*dc
)
900 xtensa_isa isa
= dc
->config
->isa
;
901 unsigned char b
[MAX_INSN_LENGTH
] = {translator_ldub(env
, dc
->pc
)};
902 unsigned len
= xtensa_op0_insn_len(dc
, b
[0]);
906 uint32_t op_flags
= 0;
907 struct slot_prop slot_prop
[MAX_INSN_SLOTS
];
908 struct slot_prop
*ordered
[MAX_INSN_SLOTS
];
909 struct opcode_arg_copy arg_copy
[MAX_INSN_SLOTS
* MAX_OPCODE_ARGS
];
910 unsigned n_arg_copy
= 0;
911 uint32_t debug_cause
= 0;
912 uint32_t windowed_register
= 0;
913 uint32_t coprocessor
= 0;
915 if (len
== XTENSA_UNDEFINED
) {
916 qemu_log_mask(LOG_GUEST_ERROR
,
917 "unknown instruction length (pc = %08x)\n",
919 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
920 dc
->base
.pc_next
= dc
->pc
+ 1;
924 dc
->base
.pc_next
= dc
->pc
+ len
;
925 for (i
= 1; i
< len
; ++i
) {
926 b
[i
] = translator_ldub(env
, dc
->pc
+ i
);
928 xtensa_insnbuf_from_chars(isa
, dc
->insnbuf
, b
, len
);
929 fmt
= xtensa_format_decode(isa
, dc
->insnbuf
);
930 if (fmt
== XTENSA_UNDEFINED
) {
931 qemu_log_mask(LOG_GUEST_ERROR
,
932 "unrecognized instruction format (pc = %08x)\n",
934 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
937 slots
= xtensa_format_num_slots(isa
, fmt
);
938 for (slot
= 0; slot
< slots
; ++slot
) {
940 int opnd
, vopnd
, opnds
;
941 OpcodeArg
*arg
= slot_prop
[slot
].arg
;
942 XtensaOpcodeOps
*ops
;
944 xtensa_format_get_slot(isa
, fmt
, slot
, dc
->insnbuf
, dc
->slotbuf
);
945 opc
= xtensa_opcode_decode(isa
, fmt
, slot
, dc
->slotbuf
);
946 if (opc
== XTENSA_UNDEFINED
) {
947 qemu_log_mask(LOG_GUEST_ERROR
,
948 "unrecognized opcode in slot %d (pc = %08x)\n",
950 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
953 opnds
= xtensa_opcode_num_operands(isa
, opc
);
955 for (opnd
= vopnd
= 0; opnd
< opnds
; ++opnd
) {
956 void **register_file
= NULL
;
959 if (xtensa_operand_is_register(isa
, opc
, opnd
)) {
960 rf
= xtensa_operand_regfile(isa
, opc
, opnd
);
961 register_file
= dc
->config
->regfile
[rf
];
963 if (rf
== dc
->config
->a_regfile
) {
966 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
968 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
969 windowed_register
|= 1u << v
;
972 if (xtensa_operand_is_visible(isa
, opc
, opnd
)) {
975 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
977 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
978 arg
[vopnd
].raw_imm
= v
;
979 if (xtensa_operand_is_PCrelative(isa
, opc
, opnd
)) {
980 xtensa_operand_undo_reloc(isa
, opc
, opnd
, &v
, dc
->pc
);
984 arg
[vopnd
].in
= register_file
[v
];
985 arg
[vopnd
].out
= register_file
[v
];
986 arg
[vopnd
].num_bits
= xtensa_regfile_num_bits(isa
, rf
);
988 arg
[vopnd
].num_bits
= 32;
993 ops
= dc
->config
->opcode_ops
[opc
];
994 slot_prop
[slot
].ops
= ops
;
997 op_flags
|= ops
->op_flags
;
998 if (ops
->test_exceptions
) {
999 op_flags
|= ops
->test_exceptions(dc
, arg
, ops
->par
);
1002 qemu_log_mask(LOG_UNIMP
,
1003 "unimplemented opcode '%s' in slot %d (pc = %08x)\n",
1004 xtensa_opcode_name(isa
, opc
), slot
, dc
->pc
);
1005 op_flags
|= XTENSA_OP_ILL
;
1007 if (op_flags
& XTENSA_OP_ILL
) {
1008 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
1011 if (op_flags
& XTENSA_OP_DEBUG_BREAK
) {
1012 debug_cause
|= ops
->par
[0];
1014 if (ops
->test_overflow
) {
1015 windowed_register
|= ops
->test_overflow(dc
, arg
, ops
->par
);
1017 coprocessor
|= ops
->coprocessor
;
1020 slot_prop
[slot
].n_in
= 0;
1021 slot_prop
[slot
].n_out
= 0;
1022 slot_prop
[slot
].op_flags
= ops
->op_flags
& XTENSA_OP_LOAD_STORE
;
1024 opnds
= xtensa_opcode_num_operands(isa
, opc
);
1026 for (opnd
= vopnd
= 0; opnd
< opnds
; ++opnd
) {
1027 bool visible
= xtensa_operand_is_visible(isa
, opc
, opnd
);
1029 if (xtensa_operand_is_register(isa
, opc
, opnd
)) {
1030 xtensa_regfile rf
= xtensa_operand_regfile(isa
, opc
, opnd
);
1033 xtensa_operand_get_field(isa
, opc
, opnd
, fmt
, slot
,
1035 xtensa_operand_decode(isa
, opc
, opnd
, &v
);
1036 opcode_add_resource(slot_prop
+ slot
,
1037 encode_resource(RES_REGFILE
, rf
, v
),
1038 xtensa_operand_inout(isa
, opc
, opnd
),
1039 visible
? vopnd
: -1);
1046 opnds
= xtensa_opcode_num_stateOperands(isa
, opc
);
1048 for (opnd
= 0; opnd
< opnds
; ++opnd
) {
1049 xtensa_state state
= xtensa_stateOperand_state(isa
, opc
, opnd
);
1051 opcode_add_resource(slot_prop
+ slot
,
1052 encode_resource(RES_STATE
, 0, state
),
1053 xtensa_stateOperand_inout(isa
, opc
, opnd
),
1056 if (xtensa_opcode_is_branch(isa
, opc
) ||
1057 xtensa_opcode_is_jump(isa
, opc
) ||
1058 xtensa_opcode_is_loop(isa
, opc
) ||
1059 xtensa_opcode_is_call(isa
, opc
)) {
1060 slot_prop
[slot
].op_flags
|= XTENSA_OP_CONTROL_FLOW
;
1063 qsort(slot_prop
[slot
].in
, slot_prop
[slot
].n_in
,
1064 sizeof(slot_prop
[slot
].in
[0]), resource_compare
);
1065 qsort(slot_prop
[slot
].out
, slot_prop
[slot
].n_out
,
1066 sizeof(slot_prop
[slot
].out
[0]), resource_compare
);
1071 if (!tsort(slot_prop
, ordered
, slots
, arg_copy
, &n_arg_copy
)) {
1072 qemu_log_mask(LOG_UNIMP
,
1073 "Circular resource dependencies (pc = %08x)\n",
1075 gen_exception_cause(dc
, ILLEGAL_INSTRUCTION_CAUSE
);
1079 ordered
[0] = slot_prop
+ 0;
1082 if ((op_flags
& XTENSA_OP_PRIVILEGED
) &&
1083 !gen_check_privilege(dc
)) {
1087 if (op_flags
& XTENSA_OP_SYSCALL
) {
1088 gen_exception_cause(dc
, SYSCALL_CAUSE
);
1092 if ((op_flags
& XTENSA_OP_DEBUG_BREAK
) && dc
->debug
) {
1093 gen_debug_exception(dc
, debug_cause
);
1097 if (windowed_register
&& !gen_window_check(dc
, windowed_register
)) {
1101 if (op_flags
& XTENSA_OP_UNDERFLOW
) {
1102 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
1104 gen_helper_test_underflow_retw(cpu_env
, tmp
);
1108 if (op_flags
& XTENSA_OP_ALLOCA
) {
1109 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
1111 gen_helper_movsp(cpu_env
, tmp
);
1115 if (coprocessor
&& !gen_check_cpenable(dc
, coprocessor
)) {
1124 qsort(arg_copy
, n_arg_copy
, sizeof(*arg_copy
), arg_copy_compare
);
1125 for (i
= j
= 0; i
< n_arg_copy
; ++i
) {
1126 if (i
== 0 || arg_copy
[i
].resource
!= resource
) {
1127 resource
= arg_copy
[i
].resource
;
1128 if (arg_copy
[i
].arg
->num_bits
<= 32) {
1129 temp
= tcg_temp_local_new_i32();
1130 tcg_gen_mov_i32(temp
, arg_copy
[i
].arg
->in
);
1131 } else if (arg_copy
[i
].arg
->num_bits
<= 64) {
1132 temp
= tcg_temp_local_new_i64();
1133 tcg_gen_mov_i64(temp
, arg_copy
[i
].arg
->in
);
1135 g_assert_not_reached();
1137 arg_copy
[i
].temp
= temp
;
1140 arg_copy
[j
] = arg_copy
[i
];
1144 arg_copy
[i
].arg
->in
= temp
;
1149 if (op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1150 for (slot
= 0; slot
< slots
; ++slot
) {
1151 if (slot_prop
[slot
].ops
->op_flags
& XTENSA_OP_DIVIDE_BY_ZERO
) {
1152 gen_zero_check(dc
, slot_prop
[slot
].arg
);
1157 dc
->op_flags
= op_flags
;
1159 for (slot
= 0; slot
< slots
; ++slot
) {
1160 struct slot_prop
*pslot
= ordered
[slot
];
1161 XtensaOpcodeOps
*ops
= pslot
->ops
;
1163 ops
->translate(dc
, pslot
->arg
, ops
->par
);
1166 for (i
= 0; i
< n_arg_copy
; ++i
) {
1167 if (arg_copy
[i
].arg
->num_bits
<= 32) {
1168 tcg_temp_free_i32(arg_copy
[i
].temp
);
1169 } else if (arg_copy
[i
].arg
->num_bits
<= 64) {
1170 tcg_temp_free_i64(arg_copy
[i
].temp
);
1172 g_assert_not_reached();
1176 if (dc
->base
.is_jmp
== DISAS_NEXT
) {
1177 gen_postprocess(dc
, 0);
1179 if (op_flags
& XTENSA_OP_EXIT_TB_M1
) {
1180 /* Change in mmu index, memory mapping or tb->flags; exit tb */
1181 gen_jumpi_check_loop_end(dc
, -1);
1182 } else if (op_flags
& XTENSA_OP_EXIT_TB_0
) {
1183 gen_jumpi_check_loop_end(dc
, 0);
1185 gen_check_loop_end(dc
, 0);
1188 dc
->pc
= dc
->base
.pc_next
;
1191 static inline unsigned xtensa_insn_len(CPUXtensaState
*env
, DisasContext
*dc
)
1193 uint8_t b0
= cpu_ldub_code(env
, dc
->pc
);
1194 return xtensa_op0_insn_len(dc
, b0
);
1197 static void gen_ibreak_check(CPUXtensaState
*env
, DisasContext
*dc
)
1201 for (i
= 0; i
< dc
->config
->nibreak
; ++i
) {
1202 if ((env
->sregs
[IBREAKENABLE
] & (1 << i
)) &&
1203 env
->sregs
[IBREAKA
+ i
] == dc
->pc
) {
1204 gen_debug_exception(dc
, DEBUGCAUSE_IB
);
1210 static void xtensa_tr_init_disas_context(DisasContextBase
*dcbase
,
1213 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1214 CPUXtensaState
*env
= cpu
->env_ptr
;
1215 uint32_t tb_flags
= dc
->base
.tb
->flags
;
1217 dc
->config
= env
->config
;
1218 dc
->pc
= dc
->base
.pc_first
;
1219 dc
->ring
= tb_flags
& XTENSA_TBFLAG_RING_MASK
;
1220 dc
->cring
= (tb_flags
& XTENSA_TBFLAG_EXCM
) ? 0 : dc
->ring
;
1221 dc
->lbeg_off
= (dc
->base
.tb
->cs_base
& XTENSA_CSBASE_LBEG_OFF_MASK
) >>
1222 XTENSA_CSBASE_LBEG_OFF_SHIFT
;
1223 dc
->lend
= (dc
->base
.tb
->cs_base
& XTENSA_CSBASE_LEND_MASK
) +
1224 (dc
->base
.pc_first
& TARGET_PAGE_MASK
);
1225 dc
->debug
= tb_flags
& XTENSA_TBFLAG_DEBUG
;
1226 dc
->icount
= tb_flags
& XTENSA_TBFLAG_ICOUNT
;
1227 dc
->cpenable
= (tb_flags
& XTENSA_TBFLAG_CPENABLE_MASK
) >>
1228 XTENSA_TBFLAG_CPENABLE_SHIFT
;
1229 dc
->window
= ((tb_flags
& XTENSA_TBFLAG_WINDOW_MASK
) >>
1230 XTENSA_TBFLAG_WINDOW_SHIFT
);
1231 dc
->cwoe
= tb_flags
& XTENSA_TBFLAG_CWOE
;
1232 dc
->callinc
= ((tb_flags
& XTENSA_TBFLAG_CALLINC_MASK
) >>
1233 XTENSA_TBFLAG_CALLINC_SHIFT
);
1234 init_sar_tracker(dc
);
1237 static void xtensa_tr_tb_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1239 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1242 dc
->next_icount
= tcg_temp_local_new_i32();
1246 static void xtensa_tr_insn_start(DisasContextBase
*dcbase
, CPUState
*cpu
)
1248 tcg_gen_insn_start(dcbase
->pc_next
);
1251 static bool xtensa_tr_breakpoint_check(DisasContextBase
*dcbase
, CPUState
*cpu
,
1252 const CPUBreakpoint
*bp
)
1254 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1256 tcg_gen_movi_i32(cpu_pc
, dc
->base
.pc_next
);
1257 gen_exception(dc
, EXCP_DEBUG
);
1258 dc
->base
.is_jmp
= DISAS_NORETURN
;
1259 /* The address covered by the breakpoint must be included in
1260 [tb->pc, tb->pc + tb->size) in order to for it to be
1261 properly cleared -- thus we increment the PC here so that
1262 the logic setting tb->size below does the right thing. */
1263 dc
->base
.pc_next
+= 2;
1267 static void xtensa_tr_translate_insn(DisasContextBase
*dcbase
, CPUState
*cpu
)
1269 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1270 CPUXtensaState
*env
= cpu
->env_ptr
;
1271 target_ulong page_start
;
1273 /* These two conditions only apply to the first insn in the TB,
1274 but this is the first TranslateOps hook that allows exiting. */
1275 if ((tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
)
1276 && (dc
->base
.tb
->flags
& XTENSA_TBFLAG_YIELD
)) {
1277 gen_exception(dc
, EXCP_YIELD
);
1278 dc
->base
.pc_next
= dc
->pc
+ 1;
1279 dc
->base
.is_jmp
= DISAS_NORETURN
;
1282 if (dc
->base
.tb
->flags
& XTENSA_TBFLAG_EXCEPTION
) {
1283 gen_exception(dc
, EXCP_DEBUG
);
1284 dc
->base
.pc_next
= dc
->pc
+ 1;
1285 dc
->base
.is_jmp
= DISAS_NORETURN
;
1290 TCGLabel
*label
= gen_new_label();
1292 tcg_gen_addi_i32(dc
->next_icount
, cpu_SR
[ICOUNT
], 1);
1293 tcg_gen_brcondi_i32(TCG_COND_NE
, dc
->next_icount
, 0, label
);
1294 tcg_gen_mov_i32(dc
->next_icount
, cpu_SR
[ICOUNT
]);
1296 gen_debug_exception(dc
, DEBUGCAUSE_IC
);
1298 gen_set_label(label
);
1302 gen_ibreak_check(env
, dc
);
1305 disas_xtensa_insn(env
, dc
);
1308 tcg_gen_mov_i32(cpu_SR
[ICOUNT
], dc
->next_icount
);
1311 /* End the TB if the next insn will cross into the next page. */
1312 page_start
= dc
->base
.pc_first
& TARGET_PAGE_MASK
;
1313 if (dc
->base
.is_jmp
== DISAS_NEXT
&&
1314 (dc
->pc
- page_start
>= TARGET_PAGE_SIZE
||
1315 dc
->pc
- page_start
+ xtensa_insn_len(env
, dc
) > TARGET_PAGE_SIZE
)) {
1316 dc
->base
.is_jmp
= DISAS_TOO_MANY
;
1320 static void xtensa_tr_tb_stop(DisasContextBase
*dcbase
, CPUState
*cpu
)
1322 DisasContext
*dc
= container_of(dcbase
, DisasContext
, base
);
1324 reset_sar_tracker(dc
);
1326 tcg_temp_free(dc
->next_icount
);
1329 switch (dc
->base
.is_jmp
) {
1330 case DISAS_NORETURN
:
1332 case DISAS_TOO_MANY
:
1333 if (dc
->base
.singlestep_enabled
) {
1334 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1335 gen_exception(dc
, EXCP_DEBUG
);
1337 gen_jumpi(dc
, dc
->pc
, 0);
1341 g_assert_not_reached();
1345 static void xtensa_tr_disas_log(const DisasContextBase
*dcbase
, CPUState
*cpu
)
1347 qemu_log("IN: %s\n", lookup_symbol(dcbase
->pc_first
));
1348 log_target_disas(cpu
, dcbase
->pc_first
, dcbase
->tb
->size
);
1351 static const TranslatorOps xtensa_translator_ops
= {
1352 .init_disas_context
= xtensa_tr_init_disas_context
,
1353 .tb_start
= xtensa_tr_tb_start
,
1354 .insn_start
= xtensa_tr_insn_start
,
1355 .breakpoint_check
= xtensa_tr_breakpoint_check
,
1356 .translate_insn
= xtensa_tr_translate_insn
,
1357 .tb_stop
= xtensa_tr_tb_stop
,
1358 .disas_log
= xtensa_tr_disas_log
,
1361 void gen_intermediate_code(CPUState
*cpu
, TranslationBlock
*tb
, int max_insns
)
1363 DisasContext dc
= {};
1364 translator_loop(&xtensa_translator_ops
, &dc
.base
, cpu
, tb
, max_insns
);
1367 void xtensa_cpu_dump_state(CPUState
*cs
, FILE *f
, int flags
)
1369 XtensaCPU
*cpu
= XTENSA_CPU(cs
);
1370 CPUXtensaState
*env
= &cpu
->env
;
1371 xtensa_isa isa
= env
->config
->isa
;
1374 qemu_fprintf(f
, "PC=%08x\n\n", env
->pc
);
1376 for (i
= j
= 0; i
< xtensa_isa_num_sysregs(isa
); ++i
) {
1377 const uint32_t *reg
=
1378 xtensa_sysreg_is_user(isa
, i
) ? env
->uregs
: env
->sregs
;
1379 int regno
= xtensa_sysreg_number(isa
, i
);
1382 qemu_fprintf(f
, "%12s=%08x%c",
1383 xtensa_sysreg_name(isa
, i
),
1385 (j
++ % 4) == 3 ? '\n' : ' ');
1389 qemu_fprintf(f
, (j
% 4) == 0 ? "\n" : "\n\n");
1391 for (i
= 0; i
< 16; ++i
) {
1392 qemu_fprintf(f
, " A%02d=%08x%c",
1393 i
, env
->regs
[i
], (i
% 4) == 3 ? '\n' : ' ');
1396 xtensa_sync_phys_from_window(env
);
1397 qemu_fprintf(f
, "\n");
1399 for (i
= 0; i
< env
->config
->nareg
; ++i
) {
1400 qemu_fprintf(f
, "AR%02d=%08x ", i
, env
->phys_regs
[i
]);
1402 bool ws
= (env
->sregs
[WINDOW_START
] & (1 << (i
/ 4))) != 0;
1403 bool cw
= env
->sregs
[WINDOW_BASE
] == i
/ 4;
1405 qemu_fprintf(f
, "%c%c\n", ws
? '<' : ' ', cw
? '=' : ' ');
1409 if ((flags
& CPU_DUMP_FPU
) &&
1410 xtensa_option_enabled(env
->config
, XTENSA_OPTION_FP_COPROCESSOR
)) {
1411 qemu_fprintf(f
, "\n");
1413 for (i
= 0; i
< 16; ++i
) {
1414 qemu_fprintf(f
, "F%02d=%08x (%-+15.8e)%c", i
,
1415 float32_val(env
->fregs
[i
].f32
[FP_F32_LOW
]),
1416 *(float *)(env
->fregs
[i
].f32
+ FP_F32_LOW
),
1417 (i
% 2) == 1 ? '\n' : ' ');
1421 if ((flags
& CPU_DUMP_FPU
) &&
1422 xtensa_option_enabled(env
->config
, XTENSA_OPTION_DFP_COPROCESSOR
) &&
1423 !xtensa_option_enabled(env
->config
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
1424 qemu_fprintf(f
, "\n");
1426 for (i
= 0; i
< 16; ++i
) {
1427 qemu_fprintf(f
, "F%02d=%016"PRIx64
" (%-+24.16le)%c", i
,
1428 float64_val(env
->fregs
[i
].f64
),
1429 *(double *)(&env
->fregs
[i
].f64
),
1430 (i
% 2) == 1 ? '\n' : ' ');
1435 void restore_state_to_opc(CPUXtensaState
*env
, TranslationBlock
*tb
,
1441 static void translate_abs(DisasContext
*dc
, const OpcodeArg arg
[],
1442 const uint32_t par
[])
1444 tcg_gen_abs_i32(arg
[0].out
, arg
[1].in
);
1447 static void translate_add(DisasContext
*dc
, const OpcodeArg arg
[],
1448 const uint32_t par
[])
1450 tcg_gen_add_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1453 static void translate_addi(DisasContext
*dc
, const OpcodeArg arg
[],
1454 const uint32_t par
[])
1456 tcg_gen_addi_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
1459 static void translate_addx(DisasContext
*dc
, const OpcodeArg arg
[],
1460 const uint32_t par
[])
1462 TCGv_i32 tmp
= tcg_temp_new_i32();
1463 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
1464 tcg_gen_add_i32(arg
[0].out
, tmp
, arg
[2].in
);
1468 static void translate_all(DisasContext
*dc
, const OpcodeArg arg
[],
1469 const uint32_t par
[])
1471 uint32_t shift
= par
[1];
1472 TCGv_i32 mask
= tcg_const_i32(((1 << shift
) - 1) << arg
[1].imm
);
1473 TCGv_i32 tmp
= tcg_temp_new_i32();
1475 tcg_gen_and_i32(tmp
, arg
[1].in
, mask
);
1477 tcg_gen_addi_i32(tmp
, tmp
, 1 << arg
[1].imm
);
1479 tcg_gen_add_i32(tmp
, tmp
, mask
);
1481 tcg_gen_shri_i32(tmp
, tmp
, arg
[1].imm
+ shift
);
1482 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
,
1483 tmp
, arg
[0].imm
, 1);
1484 tcg_temp_free(mask
);
1488 static void translate_and(DisasContext
*dc
, const OpcodeArg arg
[],
1489 const uint32_t par
[])
1491 tcg_gen_and_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1494 static void translate_ball(DisasContext
*dc
, const OpcodeArg arg
[],
1495 const uint32_t par
[])
1497 TCGv_i32 tmp
= tcg_temp_new_i32();
1498 tcg_gen_and_i32(tmp
, arg
[0].in
, arg
[1].in
);
1499 gen_brcond(dc
, par
[0], tmp
, arg
[1].in
, arg
[2].imm
);
1503 static void translate_bany(DisasContext
*dc
, const OpcodeArg arg
[],
1504 const uint32_t par
[])
1506 TCGv_i32 tmp
= tcg_temp_new_i32();
1507 tcg_gen_and_i32(tmp
, arg
[0].in
, arg
[1].in
);
1508 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1512 static void translate_b(DisasContext
*dc
, const OpcodeArg arg
[],
1513 const uint32_t par
[])
1515 gen_brcond(dc
, par
[0], arg
[0].in
, arg
[1].in
, arg
[2].imm
);
1518 static void translate_bb(DisasContext
*dc
, const OpcodeArg arg
[],
1519 const uint32_t par
[])
1521 #ifdef TARGET_WORDS_BIGENDIAN
1522 TCGv_i32 bit
= tcg_const_i32(0x80000000u
);
1524 TCGv_i32 bit
= tcg_const_i32(0x00000001u
);
1526 TCGv_i32 tmp
= tcg_temp_new_i32();
1527 tcg_gen_andi_i32(tmp
, arg
[1].in
, 0x1f);
1528 #ifdef TARGET_WORDS_BIGENDIAN
1529 tcg_gen_shr_i32(bit
, bit
, tmp
);
1531 tcg_gen_shl_i32(bit
, bit
, tmp
);
1533 tcg_gen_and_i32(tmp
, arg
[0].in
, bit
);
1534 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1539 static void translate_bbi(DisasContext
*dc
, const OpcodeArg arg
[],
1540 const uint32_t par
[])
1542 TCGv_i32 tmp
= tcg_temp_new_i32();
1543 #ifdef TARGET_WORDS_BIGENDIAN
1544 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x80000000u
>> arg
[1].imm
);
1546 tcg_gen_andi_i32(tmp
, arg
[0].in
, 0x00000001u
<< arg
[1].imm
);
1548 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[2].imm
);
1552 static void translate_bi(DisasContext
*dc
, const OpcodeArg arg
[],
1553 const uint32_t par
[])
1555 gen_brcondi(dc
, par
[0], arg
[0].in
, arg
[1].imm
, arg
[2].imm
);
1558 static void translate_bz(DisasContext
*dc
, const OpcodeArg arg
[],
1559 const uint32_t par
[])
1561 gen_brcondi(dc
, par
[0], arg
[0].in
, 0, arg
[1].imm
);
1572 static void translate_boolean(DisasContext
*dc
, const OpcodeArg arg
[],
1573 const uint32_t par
[])
1575 static void (* const op
[])(TCGv_i32
, TCGv_i32
, TCGv_i32
) = {
1576 [BOOLEAN_AND
] = tcg_gen_and_i32
,
1577 [BOOLEAN_ANDC
] = tcg_gen_andc_i32
,
1578 [BOOLEAN_OR
] = tcg_gen_or_i32
,
1579 [BOOLEAN_ORC
] = tcg_gen_orc_i32
,
1580 [BOOLEAN_XOR
] = tcg_gen_xor_i32
,
1583 TCGv_i32 tmp1
= tcg_temp_new_i32();
1584 TCGv_i32 tmp2
= tcg_temp_new_i32();
1586 tcg_gen_shri_i32(tmp1
, arg
[1].in
, arg
[1].imm
);
1587 tcg_gen_shri_i32(tmp2
, arg
[2].in
, arg
[2].imm
);
1588 op
[par
[0]](tmp1
, tmp1
, tmp2
);
1589 tcg_gen_deposit_i32(arg
[0].out
, arg
[0].out
, tmp1
, arg
[0].imm
, 1);
1590 tcg_temp_free(tmp1
);
1591 tcg_temp_free(tmp2
);
1594 static void translate_bp(DisasContext
*dc
, const OpcodeArg arg
[],
1595 const uint32_t par
[])
1597 TCGv_i32 tmp
= tcg_temp_new_i32();
1599 tcg_gen_andi_i32(tmp
, arg
[0].in
, 1 << arg
[0].imm
);
1600 gen_brcondi(dc
, par
[0], tmp
, 0, arg
[1].imm
);
1604 static void translate_call0(DisasContext
*dc
, const OpcodeArg arg
[],
1605 const uint32_t par
[])
1607 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1608 gen_jumpi(dc
, arg
[0].imm
, 0);
1611 static void translate_callw(DisasContext
*dc
, const OpcodeArg arg
[],
1612 const uint32_t par
[])
1614 TCGv_i32 tmp
= tcg_const_i32(arg
[0].imm
);
1615 gen_callw_slot(dc
, par
[0], tmp
, adjust_jump_slot(dc
, arg
[0].imm
, 0));
1619 static void translate_callx0(DisasContext
*dc
, const OpcodeArg arg
[],
1620 const uint32_t par
[])
1622 TCGv_i32 tmp
= tcg_temp_new_i32();
1623 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1624 tcg_gen_movi_i32(cpu_R
[0], dc
->base
.pc_next
);
1629 static void translate_callxw(DisasContext
*dc
, const OpcodeArg arg
[],
1630 const uint32_t par
[])
1632 TCGv_i32 tmp
= tcg_temp_new_i32();
1634 tcg_gen_mov_i32(tmp
, arg
[0].in
);
1635 gen_callw_slot(dc
, par
[0], tmp
, -1);
1639 static void translate_clamps(DisasContext
*dc
, const OpcodeArg arg
[],
1640 const uint32_t par
[])
1642 TCGv_i32 tmp1
= tcg_const_i32(-1u << arg
[2].imm
);
1643 TCGv_i32 tmp2
= tcg_const_i32((1 << arg
[2].imm
) - 1);
1645 tcg_gen_smax_i32(tmp1
, tmp1
, arg
[1].in
);
1646 tcg_gen_smin_i32(arg
[0].out
, tmp1
, tmp2
);
1647 tcg_temp_free(tmp1
);
1648 tcg_temp_free(tmp2
);
1651 static void translate_clrb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
1652 const uint32_t par
[])
1654 /* TODO: GPIO32 may be a part of coprocessor */
1655 tcg_gen_andi_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], ~(1u << arg
[0].imm
));
1658 static void translate_clrex(DisasContext
*dc
, const OpcodeArg arg
[],
1659 const uint32_t par
[])
1661 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
1664 static void translate_const16(DisasContext
*dc
, const OpcodeArg arg
[],
1665 const uint32_t par
[])
1667 TCGv_i32 c
= tcg_const_i32(arg
[1].imm
);
1669 tcg_gen_deposit_i32(arg
[0].out
, c
, arg
[0].in
, 16, 16);
1673 static void translate_dcache(DisasContext
*dc
, const OpcodeArg arg
[],
1674 const uint32_t par
[])
1676 TCGv_i32 addr
= tcg_temp_new_i32();
1677 TCGv_i32 res
= tcg_temp_new_i32();
1679 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1680 tcg_gen_qemu_ld8u(res
, addr
, dc
->cring
);
1681 tcg_temp_free(addr
);
1685 static void translate_depbits(DisasContext
*dc
, const OpcodeArg arg
[],
1686 const uint32_t par
[])
1688 tcg_gen_deposit_i32(arg
[1].out
, arg
[1].in
, arg
[0].in
,
1689 arg
[2].imm
, arg
[3].imm
);
1692 static void translate_diwbuip(DisasContext
*dc
, const OpcodeArg arg
[],
1693 const uint32_t par
[])
1695 tcg_gen_addi_i32(arg
[0].out
, arg
[0].in
, dc
->config
->dcache_line_bytes
);
1698 static uint32_t test_exceptions_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1699 const uint32_t par
[])
1701 if (arg
[0].imm
> 3 || !dc
->cwoe
) {
1702 qemu_log_mask(LOG_GUEST_ERROR
,
1703 "Illegal entry instruction(pc = %08x)\n", dc
->pc
);
1704 return XTENSA_OP_ILL
;
1710 static uint32_t test_overflow_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1711 const uint32_t par
[])
1713 return 1 << (dc
->callinc
* 4);
1716 static void translate_entry(DisasContext
*dc
, const OpcodeArg arg
[],
1717 const uint32_t par
[])
1719 TCGv_i32 pc
= tcg_const_i32(dc
->pc
);
1720 TCGv_i32 s
= tcg_const_i32(arg
[0].imm
);
1721 TCGv_i32 imm
= tcg_const_i32(arg
[1].imm
);
1722 gen_helper_entry(cpu_env
, pc
, s
, imm
);
1728 static void translate_extui(DisasContext
*dc
, const OpcodeArg arg
[],
1729 const uint32_t par
[])
1731 int maskimm
= (1 << arg
[3].imm
) - 1;
1733 TCGv_i32 tmp
= tcg_temp_new_i32();
1734 tcg_gen_shri_i32(tmp
, arg
[1].in
, arg
[2].imm
);
1735 tcg_gen_andi_i32(arg
[0].out
, tmp
, maskimm
);
1739 static void translate_getex(DisasContext
*dc
, const OpcodeArg arg
[],
1740 const uint32_t par
[])
1742 TCGv_i32 tmp
= tcg_temp_new_i32();
1744 tcg_gen_extract_i32(tmp
, cpu_SR
[ATOMCTL
], 8, 1);
1745 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], arg
[0].in
, 8, 1);
1746 tcg_gen_mov_i32(arg
[0].out
, tmp
);
1750 static void translate_icache(DisasContext
*dc
, const OpcodeArg arg
[],
1751 const uint32_t par
[])
1753 #ifndef CONFIG_USER_ONLY
1754 TCGv_i32 addr
= tcg_temp_new_i32();
1756 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
1757 tcg_gen_addi_i32(addr
, arg
[0].in
, arg
[1].imm
);
1758 gen_helper_itlb_hit_test(cpu_env
, addr
);
1759 tcg_temp_free(addr
);
1763 static void translate_itlb(DisasContext
*dc
, const OpcodeArg arg
[],
1764 const uint32_t par
[])
1766 #ifndef CONFIG_USER_ONLY
1767 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
1769 gen_helper_itlb(cpu_env
, arg
[0].in
, dtlb
);
1770 tcg_temp_free(dtlb
);
1774 static void translate_j(DisasContext
*dc
, const OpcodeArg arg
[],
1775 const uint32_t par
[])
1777 gen_jumpi(dc
, arg
[0].imm
, 0);
1780 static void translate_jx(DisasContext
*dc
, const OpcodeArg arg
[],
1781 const uint32_t par
[])
1783 gen_jump(dc
, arg
[0].in
);
1786 static void translate_l32e(DisasContext
*dc
, const OpcodeArg arg
[],
1787 const uint32_t par
[])
1789 TCGv_i32 addr
= tcg_temp_new_i32();
1791 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1792 gen_load_store_alignment(dc
, 2, addr
, false);
1793 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->ring
, MO_TEUL
);
1794 tcg_temp_free(addr
);
1797 #ifdef CONFIG_USER_ONLY
1798 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1802 static void gen_check_exclusive(DisasContext
*dc
, TCGv_i32 addr
, bool is_write
)
1804 if (!option_enabled(dc
, XTENSA_OPTION_MPU
)) {
1805 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
1806 TCGv_i32 write
= tcg_const_i32(is_write
);
1808 gen_helper_check_exclusive(cpu_env
, tpc
, addr
, write
);
1810 tcg_temp_free(write
);
1815 static void translate_l32ex(DisasContext
*dc
, const OpcodeArg arg
[],
1816 const uint32_t par
[])
1818 TCGv_i32 addr
= tcg_temp_new_i32();
1820 tcg_gen_mov_i32(addr
, arg
[1].in
);
1821 gen_load_store_alignment(dc
, 2, addr
, true);
1822 gen_check_exclusive(dc
, addr
, false);
1823 tcg_gen_qemu_ld_i32(arg
[0].out
, addr
, dc
->ring
, MO_TEUL
);
1824 tcg_gen_mov_i32(cpu_exclusive_addr
, addr
);
1825 tcg_gen_mov_i32(cpu_exclusive_val
, arg
[0].out
);
1826 tcg_temp_free(addr
);
1829 static void translate_ldst(DisasContext
*dc
, const OpcodeArg arg
[],
1830 const uint32_t par
[])
1832 TCGv_i32 addr
= tcg_temp_new_i32();
1834 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
1835 if (par
[0] & MO_SIZE
) {
1836 gen_load_store_alignment(dc
, par
[0] & MO_SIZE
, addr
, par
[1]);
1840 tcg_gen_mb(TCG_BAR_STRL
| TCG_MO_ALL
);
1842 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->cring
, par
[0]);
1844 tcg_gen_qemu_ld_tl(arg
[0].out
, addr
, dc
->cring
, par
[0]);
1846 tcg_gen_mb(TCG_BAR_LDAQ
| TCG_MO_ALL
);
1849 tcg_temp_free(addr
);
1852 static void translate_l32r(DisasContext
*dc
, const OpcodeArg arg
[],
1853 const uint32_t par
[])
1857 if (dc
->base
.tb
->flags
& XTENSA_TBFLAG_LITBASE
) {
1858 tmp
= tcg_const_i32(arg
[1].raw_imm
- 1);
1859 tcg_gen_add_i32(tmp
, cpu_SR
[LITBASE
], tmp
);
1861 tmp
= tcg_const_i32(arg
[1].imm
);
1863 tcg_gen_qemu_ld32u(arg
[0].out
, tmp
, dc
->cring
);
1867 static void translate_loop(DisasContext
*dc
, const OpcodeArg arg
[],
1868 const uint32_t par
[])
1870 uint32_t lend
= arg
[1].imm
;
1872 tcg_gen_subi_i32(cpu_SR
[LCOUNT
], arg
[0].in
, 1);
1873 tcg_gen_movi_i32(cpu_SR
[LBEG
], dc
->base
.pc_next
);
1874 tcg_gen_movi_i32(cpu_SR
[LEND
], lend
);
1876 if (par
[0] != TCG_COND_NEVER
) {
1877 TCGLabel
*label
= gen_new_label();
1878 tcg_gen_brcondi_i32(par
[0], arg
[0].in
, 0, label
);
1879 gen_jumpi(dc
, lend
, 1);
1880 gen_set_label(label
);
1883 gen_jumpi(dc
, dc
->base
.pc_next
, 0);
1904 static void translate_mac16(DisasContext
*dc
, const OpcodeArg arg
[],
1905 const uint32_t par
[])
1908 unsigned half
= par
[1];
1909 uint32_t ld_offset
= par
[2];
1910 unsigned off
= ld_offset
? 2 : 0;
1911 TCGv_i32 vaddr
= tcg_temp_new_i32();
1912 TCGv_i32 mem32
= tcg_temp_new_i32();
1915 tcg_gen_addi_i32(vaddr
, arg
[1].in
, ld_offset
);
1916 gen_load_store_alignment(dc
, 2, vaddr
, false);
1917 tcg_gen_qemu_ld32u(mem32
, vaddr
, dc
->cring
);
1919 if (op
!= MAC16_NONE
) {
1920 TCGv_i32 m1
= gen_mac16_m(arg
[off
].in
,
1921 half
& MAC16_HX
, op
== MAC16_UMUL
);
1922 TCGv_i32 m2
= gen_mac16_m(arg
[off
+ 1].in
,
1923 half
& MAC16_XH
, op
== MAC16_UMUL
);
1925 if (op
== MAC16_MUL
|| op
== MAC16_UMUL
) {
1926 tcg_gen_mul_i32(cpu_SR
[ACCLO
], m1
, m2
);
1927 if (op
== MAC16_UMUL
) {
1928 tcg_gen_movi_i32(cpu_SR
[ACCHI
], 0);
1930 tcg_gen_sari_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCLO
], 31);
1933 TCGv_i32 lo
= tcg_temp_new_i32();
1934 TCGv_i32 hi
= tcg_temp_new_i32();
1936 tcg_gen_mul_i32(lo
, m1
, m2
);
1937 tcg_gen_sari_i32(hi
, lo
, 31);
1938 if (op
== MAC16_MULA
) {
1939 tcg_gen_add2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1940 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1943 tcg_gen_sub2_i32(cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1944 cpu_SR
[ACCLO
], cpu_SR
[ACCHI
],
1947 tcg_gen_ext8s_i32(cpu_SR
[ACCHI
], cpu_SR
[ACCHI
]);
1949 tcg_temp_free_i32(lo
);
1950 tcg_temp_free_i32(hi
);
1956 tcg_gen_mov_i32(arg
[1].out
, vaddr
);
1957 tcg_gen_mov_i32(cpu_SR
[MR
+ arg
[0].imm
], mem32
);
1959 tcg_temp_free(vaddr
);
1960 tcg_temp_free(mem32
);
1963 static void translate_memw(DisasContext
*dc
, const OpcodeArg arg
[],
1964 const uint32_t par
[])
1966 tcg_gen_mb(TCG_BAR_SC
| TCG_MO_ALL
);
1969 static void translate_smin(DisasContext
*dc
, const OpcodeArg arg
[],
1970 const uint32_t par
[])
1972 tcg_gen_smin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1975 static void translate_umin(DisasContext
*dc
, const OpcodeArg arg
[],
1976 const uint32_t par
[])
1978 tcg_gen_umin_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1981 static void translate_smax(DisasContext
*dc
, const OpcodeArg arg
[],
1982 const uint32_t par
[])
1984 tcg_gen_smax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1987 static void translate_umax(DisasContext
*dc
, const OpcodeArg arg
[],
1988 const uint32_t par
[])
1990 tcg_gen_umax_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
1993 static void translate_mov(DisasContext
*dc
, const OpcodeArg arg
[],
1994 const uint32_t par
[])
1996 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
1999 static void translate_movcond(DisasContext
*dc
, const OpcodeArg arg
[],
2000 const uint32_t par
[])
2002 TCGv_i32 zero
= tcg_const_i32(0);
2004 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
2005 arg
[2].in
, zero
, arg
[1].in
, arg
[0].in
);
2006 tcg_temp_free(zero
);
2009 static void translate_movi(DisasContext
*dc
, const OpcodeArg arg
[],
2010 const uint32_t par
[])
2012 tcg_gen_movi_i32(arg
[0].out
, arg
[1].imm
);
2015 static void translate_movp(DisasContext
*dc
, const OpcodeArg arg
[],
2016 const uint32_t par
[])
2018 TCGv_i32 zero
= tcg_const_i32(0);
2019 TCGv_i32 tmp
= tcg_temp_new_i32();
2021 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
2022 tcg_gen_movcond_i32(par
[0],
2023 arg
[0].out
, tmp
, zero
,
2024 arg
[1].in
, arg
[0].in
);
2026 tcg_temp_free(zero
);
2029 static void translate_movsp(DisasContext
*dc
, const OpcodeArg arg
[],
2030 const uint32_t par
[])
2032 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
2035 static void translate_mul16(DisasContext
*dc
, const OpcodeArg arg
[],
2036 const uint32_t par
[])
2038 TCGv_i32 v1
= tcg_temp_new_i32();
2039 TCGv_i32 v2
= tcg_temp_new_i32();
2042 tcg_gen_ext16s_i32(v1
, arg
[1].in
);
2043 tcg_gen_ext16s_i32(v2
, arg
[2].in
);
2045 tcg_gen_ext16u_i32(v1
, arg
[1].in
);
2046 tcg_gen_ext16u_i32(v2
, arg
[2].in
);
2048 tcg_gen_mul_i32(arg
[0].out
, v1
, v2
);
2053 static void translate_mull(DisasContext
*dc
, const OpcodeArg arg
[],
2054 const uint32_t par
[])
2056 tcg_gen_mul_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2059 static void translate_mulh(DisasContext
*dc
, const OpcodeArg arg
[],
2060 const uint32_t par
[])
2062 TCGv_i32 lo
= tcg_temp_new();
2065 tcg_gen_muls2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
2067 tcg_gen_mulu2_i32(lo
, arg
[0].out
, arg
[1].in
, arg
[2].in
);
2072 static void translate_neg(DisasContext
*dc
, const OpcodeArg arg
[],
2073 const uint32_t par
[])
2075 tcg_gen_neg_i32(arg
[0].out
, arg
[1].in
);
2078 static void translate_nop(DisasContext
*dc
, const OpcodeArg arg
[],
2079 const uint32_t par
[])
2083 static void translate_nsa(DisasContext
*dc
, const OpcodeArg arg
[],
2084 const uint32_t par
[])
2086 tcg_gen_clrsb_i32(arg
[0].out
, arg
[1].in
);
2089 static void translate_nsau(DisasContext
*dc
, const OpcodeArg arg
[],
2090 const uint32_t par
[])
2092 tcg_gen_clzi_i32(arg
[0].out
, arg
[1].in
, 32);
2095 static void translate_or(DisasContext
*dc
, const OpcodeArg arg
[],
2096 const uint32_t par
[])
2098 tcg_gen_or_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2101 static void translate_ptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2102 const uint32_t par
[])
2104 #ifndef CONFIG_USER_ONLY
2105 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2107 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
2108 gen_helper_ptlb(arg
[0].out
, cpu_env
, arg
[1].in
, dtlb
);
2109 tcg_temp_free(dtlb
);
2113 static void translate_pptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2114 const uint32_t par
[])
2116 #ifndef CONFIG_USER_ONLY
2117 tcg_gen_movi_i32(cpu_pc
, dc
->pc
);
2118 gen_helper_pptlb(arg
[0].out
, cpu_env
, arg
[1].in
);
2122 static void translate_quos(DisasContext
*dc
, const OpcodeArg arg
[],
2123 const uint32_t par
[])
2125 TCGLabel
*label1
= gen_new_label();
2126 TCGLabel
*label2
= gen_new_label();
2128 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[1].in
, 0x80000000,
2130 tcg_gen_brcondi_i32(TCG_COND_NE
, arg
[2].in
, 0xffffffff,
2132 tcg_gen_movi_i32(arg
[0].out
,
2133 par
[0] ? 0x80000000 : 0);
2135 gen_set_label(label1
);
2137 tcg_gen_div_i32(arg
[0].out
,
2138 arg
[1].in
, arg
[2].in
);
2140 tcg_gen_rem_i32(arg
[0].out
,
2141 arg
[1].in
, arg
[2].in
);
2143 gen_set_label(label2
);
2146 static void translate_quou(DisasContext
*dc
, const OpcodeArg arg
[],
2147 const uint32_t par
[])
2149 tcg_gen_divu_i32(arg
[0].out
,
2150 arg
[1].in
, arg
[2].in
);
2153 static void translate_read_impwire(DisasContext
*dc
, const OpcodeArg arg
[],
2154 const uint32_t par
[])
2156 /* TODO: GPIO32 may be a part of coprocessor */
2157 tcg_gen_movi_i32(arg
[0].out
, 0);
2160 static void translate_remu(DisasContext
*dc
, const OpcodeArg arg
[],
2161 const uint32_t par
[])
2163 tcg_gen_remu_i32(arg
[0].out
,
2164 arg
[1].in
, arg
[2].in
);
2167 static void translate_rer(DisasContext
*dc
, const OpcodeArg arg
[],
2168 const uint32_t par
[])
2170 gen_helper_rer(arg
[0].out
, cpu_env
, arg
[1].in
);
2173 static void translate_ret(DisasContext
*dc
, const OpcodeArg arg
[],
2174 const uint32_t par
[])
2176 gen_jump(dc
, cpu_R
[0]);
2179 static uint32_t test_exceptions_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2180 const uint32_t par
[])
2183 qemu_log_mask(LOG_GUEST_ERROR
,
2184 "Illegal retw instruction(pc = %08x)\n", dc
->pc
);
2185 return XTENSA_OP_ILL
;
2187 TCGv_i32 tmp
= tcg_const_i32(dc
->pc
);
2189 gen_helper_test_ill_retw(cpu_env
, tmp
);
2195 static void translate_retw(DisasContext
*dc
, const OpcodeArg arg
[],
2196 const uint32_t par
[])
2198 TCGv_i32 tmp
= tcg_const_i32(1);
2199 tcg_gen_shl_i32(tmp
, tmp
, cpu_SR
[WINDOW_BASE
]);
2200 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2201 cpu_SR
[WINDOW_START
], tmp
);
2202 tcg_gen_movi_i32(tmp
, dc
->pc
);
2203 tcg_gen_deposit_i32(tmp
, tmp
, cpu_R
[0], 0, 30);
2204 gen_helper_retw(cpu_env
, cpu_R
[0]);
2209 static void translate_rfde(DisasContext
*dc
, const OpcodeArg arg
[],
2210 const uint32_t par
[])
2212 gen_jump(dc
, cpu_SR
[dc
->config
->ndepc
? DEPC
: EPC1
]);
2215 static void translate_rfe(DisasContext
*dc
, const OpcodeArg arg
[],
2216 const uint32_t par
[])
2218 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2219 gen_jump(dc
, cpu_SR
[EPC1
]);
2222 static void translate_rfi(DisasContext
*dc
, const OpcodeArg arg
[],
2223 const uint32_t par
[])
2225 tcg_gen_mov_i32(cpu_SR
[PS
], cpu_SR
[EPS2
+ arg
[0].imm
- 2]);
2226 gen_jump(dc
, cpu_SR
[EPC1
+ arg
[0].imm
- 1]);
2229 static void translate_rfw(DisasContext
*dc
, const OpcodeArg arg
[],
2230 const uint32_t par
[])
2232 TCGv_i32 tmp
= tcg_const_i32(1);
2234 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_EXCM
);
2235 tcg_gen_shl_i32(tmp
, tmp
, cpu_SR
[WINDOW_BASE
]);
2238 tcg_gen_andc_i32(cpu_SR
[WINDOW_START
],
2239 cpu_SR
[WINDOW_START
], tmp
);
2241 tcg_gen_or_i32(cpu_SR
[WINDOW_START
],
2242 cpu_SR
[WINDOW_START
], tmp
);
2246 gen_helper_restore_owb(cpu_env
);
2247 gen_jump(dc
, cpu_SR
[EPC1
]);
2250 static void translate_rotw(DisasContext
*dc
, const OpcodeArg arg
[],
2251 const uint32_t par
[])
2253 tcg_gen_addi_i32(cpu_windowbase_next
, cpu_SR
[WINDOW_BASE
], arg
[0].imm
);
2256 static void translate_rsil(DisasContext
*dc
, const OpcodeArg arg
[],
2257 const uint32_t par
[])
2259 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[PS
]);
2260 tcg_gen_andi_i32(cpu_SR
[PS
], cpu_SR
[PS
], ~PS_INTLEVEL
);
2261 tcg_gen_ori_i32(cpu_SR
[PS
], cpu_SR
[PS
], arg
[1].imm
);
2264 static void translate_rsr(DisasContext
*dc
, const OpcodeArg arg
[],
2265 const uint32_t par
[])
2267 if (sr_name
[par
[0]]) {
2268 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2270 tcg_gen_movi_i32(arg
[0].out
, 0);
2274 static void translate_rsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2275 const uint32_t par
[])
2277 #ifndef CONFIG_USER_ONLY
2278 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2281 gen_helper_update_ccount(cpu_env
);
2282 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2286 static void translate_rsr_ptevaddr(DisasContext
*dc
, const OpcodeArg arg
[],
2287 const uint32_t par
[])
2289 #ifndef CONFIG_USER_ONLY
2290 TCGv_i32 tmp
= tcg_temp_new_i32();
2292 tcg_gen_shri_i32(tmp
, cpu_SR
[EXCVADDR
], 10);
2293 tcg_gen_or_i32(tmp
, tmp
, cpu_SR
[PTEVADDR
]);
2294 tcg_gen_andi_i32(arg
[0].out
, tmp
, 0xfffffffc);
2299 static void translate_rtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2300 const uint32_t par
[])
2302 #ifndef CONFIG_USER_ONLY
2303 static void (* const helper
[])(TCGv_i32 r
, TCGv_env env
, TCGv_i32 a1
,
2308 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2310 helper
[par
[1]](arg
[0].out
, cpu_env
, arg
[1].in
, dtlb
);
2311 tcg_temp_free(dtlb
);
2315 static void translate_rptlb0(DisasContext
*dc
, const OpcodeArg arg
[],
2316 const uint32_t par
[])
2318 #ifndef CONFIG_USER_ONLY
2319 gen_helper_rptlb0(arg
[0].out
, cpu_env
, arg
[1].in
);
2323 static void translate_rptlb1(DisasContext
*dc
, const OpcodeArg arg
[],
2324 const uint32_t par
[])
2326 #ifndef CONFIG_USER_ONLY
2327 gen_helper_rptlb1(arg
[0].out
, cpu_env
, arg
[1].in
);
2331 static void translate_rur(DisasContext
*dc
, const OpcodeArg arg
[],
2332 const uint32_t par
[])
2334 tcg_gen_mov_i32(arg
[0].out
, cpu_UR
[par
[0]]);
2337 static void translate_setb_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2338 const uint32_t par
[])
2340 /* TODO: GPIO32 may be a part of coprocessor */
2341 tcg_gen_ori_i32(cpu_UR
[EXPSTATE
], cpu_UR
[EXPSTATE
], 1u << arg
[0].imm
);
2344 #ifdef CONFIG_USER_ONLY
2345 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2349 static void gen_check_atomctl(DisasContext
*dc
, TCGv_i32 addr
)
2351 TCGv_i32 tpc
= tcg_const_i32(dc
->pc
);
2353 gen_helper_check_atomctl(cpu_env
, tpc
, addr
);
2358 static void translate_s32c1i(DisasContext
*dc
, const OpcodeArg arg
[],
2359 const uint32_t par
[])
2361 TCGv_i32 tmp
= tcg_temp_local_new_i32();
2362 TCGv_i32 addr
= tcg_temp_local_new_i32();
2364 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2365 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2366 gen_load_store_alignment(dc
, 2, addr
, true);
2367 gen_check_atomctl(dc
, addr
);
2368 tcg_gen_atomic_cmpxchg_i32(arg
[0].out
, addr
, cpu_SR
[SCOMPARE1
],
2369 tmp
, dc
->cring
, MO_TEUL
);
2370 tcg_temp_free(addr
);
2374 static void translate_s32e(DisasContext
*dc
, const OpcodeArg arg
[],
2375 const uint32_t par
[])
2377 TCGv_i32 addr
= tcg_temp_new_i32();
2379 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
2380 gen_load_store_alignment(dc
, 2, addr
, false);
2381 tcg_gen_qemu_st_tl(arg
[0].in
, addr
, dc
->ring
, MO_TEUL
);
2382 tcg_temp_free(addr
);
2385 static void translate_s32ex(DisasContext
*dc
, const OpcodeArg arg
[],
2386 const uint32_t par
[])
2388 TCGv_i32 prev
= tcg_temp_new_i32();
2389 TCGv_i32 addr
= tcg_temp_local_new_i32();
2390 TCGv_i32 res
= tcg_temp_local_new_i32();
2391 TCGLabel
*label
= gen_new_label();
2393 tcg_gen_movi_i32(res
, 0);
2394 tcg_gen_mov_i32(addr
, arg
[1].in
);
2395 gen_load_store_alignment(dc
, 2, addr
, true);
2396 tcg_gen_brcond_i32(TCG_COND_NE
, addr
, cpu_exclusive_addr
, label
);
2397 gen_check_exclusive(dc
, addr
, true);
2398 tcg_gen_atomic_cmpxchg_i32(prev
, cpu_exclusive_addr
, cpu_exclusive_val
,
2399 arg
[0].in
, dc
->cring
, MO_TEUL
);
2400 tcg_gen_setcond_i32(TCG_COND_EQ
, res
, prev
, cpu_exclusive_val
);
2401 tcg_gen_movcond_i32(TCG_COND_EQ
, cpu_exclusive_val
,
2402 prev
, cpu_exclusive_val
, prev
, cpu_exclusive_val
);
2403 tcg_gen_movi_i32(cpu_exclusive_addr
, -1);
2404 gen_set_label(label
);
2405 tcg_gen_extract_i32(arg
[0].out
, cpu_SR
[ATOMCTL
], 8, 1);
2406 tcg_gen_deposit_i32(cpu_SR
[ATOMCTL
], cpu_SR
[ATOMCTL
], res
, 8, 1);
2407 tcg_temp_free(prev
);
2408 tcg_temp_free(addr
);
2412 static void translate_salt(DisasContext
*dc
, const OpcodeArg arg
[],
2413 const uint32_t par
[])
2415 tcg_gen_setcond_i32(par
[0],
2417 arg
[1].in
, arg
[2].in
);
2420 static void translate_sext(DisasContext
*dc
, const OpcodeArg arg
[],
2421 const uint32_t par
[])
2423 int shift
= 31 - arg
[2].imm
;
2426 tcg_gen_ext8s_i32(arg
[0].out
, arg
[1].in
);
2427 } else if (shift
== 16) {
2428 tcg_gen_ext16s_i32(arg
[0].out
, arg
[1].in
);
2430 TCGv_i32 tmp
= tcg_temp_new_i32();
2431 tcg_gen_shli_i32(tmp
, arg
[1].in
, shift
);
2432 tcg_gen_sari_i32(arg
[0].out
, tmp
, shift
);
2437 static uint32_t test_exceptions_simcall(DisasContext
*dc
,
2438 const OpcodeArg arg
[],
2439 const uint32_t par
[])
2441 #ifdef CONFIG_USER_ONLY
2444 /* Between RE.2 and RE.3 simcall opcode's become nop for the hardware. */
2445 bool ill
= dc
->config
->hw_version
<= 250002 && !semihosting_enabled();
2447 if (ill
|| !semihosting_enabled()) {
2448 qemu_log_mask(LOG_GUEST_ERROR
, "SIMCALL but semihosting is disabled\n");
2450 return ill
? XTENSA_OP_ILL
: 0;
2453 static void translate_simcall(DisasContext
*dc
, const OpcodeArg arg
[],
2454 const uint32_t par
[])
2456 #ifndef CONFIG_USER_ONLY
2457 if (semihosting_enabled()) {
2458 gen_helper_simcall(cpu_env
);
2464 * Note: 64 bit ops are used here solely because SAR values
2467 #define gen_shift_reg(cmd, reg) do { \
2468 TCGv_i64 tmp = tcg_temp_new_i64(); \
2469 tcg_gen_extu_i32_i64(tmp, reg); \
2470 tcg_gen_##cmd##_i64(v, v, tmp); \
2471 tcg_gen_extrl_i64_i32(arg[0].out, v); \
2472 tcg_temp_free_i64(v); \
2473 tcg_temp_free_i64(tmp); \
2476 #define gen_shift(cmd) gen_shift_reg(cmd, cpu_SR[SAR])
2478 static void translate_sll(DisasContext
*dc
, const OpcodeArg arg
[],
2479 const uint32_t par
[])
2481 if (dc
->sar_m32_5bit
) {
2482 tcg_gen_shl_i32(arg
[0].out
, arg
[1].in
, dc
->sar_m32
);
2484 TCGv_i64 v
= tcg_temp_new_i64();
2485 TCGv_i32 s
= tcg_const_i32(32);
2486 tcg_gen_sub_i32(s
, s
, cpu_SR
[SAR
]);
2487 tcg_gen_andi_i32(s
, s
, 0x3f);
2488 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2489 gen_shift_reg(shl
, s
);
2494 static void translate_slli(DisasContext
*dc
, const OpcodeArg arg
[],
2495 const uint32_t par
[])
2497 if (arg
[2].imm
== 32) {
2498 qemu_log_mask(LOG_GUEST_ERROR
, "slli a%d, a%d, 32 is undefined\n",
2499 arg
[0].imm
, arg
[1].imm
);
2501 tcg_gen_shli_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
& 0x1f);
2504 static void translate_sra(DisasContext
*dc
, const OpcodeArg arg
[],
2505 const uint32_t par
[])
2507 if (dc
->sar_m32_5bit
) {
2508 tcg_gen_sar_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2510 TCGv_i64 v
= tcg_temp_new_i64();
2511 tcg_gen_ext_i32_i64(v
, arg
[1].in
);
2516 static void translate_srai(DisasContext
*dc
, const OpcodeArg arg
[],
2517 const uint32_t par
[])
2519 tcg_gen_sari_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2522 static void translate_src(DisasContext
*dc
, const OpcodeArg arg
[],
2523 const uint32_t par
[])
2525 TCGv_i64 v
= tcg_temp_new_i64();
2526 tcg_gen_concat_i32_i64(v
, arg
[2].in
, arg
[1].in
);
2530 static void translate_srl(DisasContext
*dc
, const OpcodeArg arg
[],
2531 const uint32_t par
[])
2533 if (dc
->sar_m32_5bit
) {
2534 tcg_gen_shr_i32(arg
[0].out
, arg
[1].in
, cpu_SR
[SAR
]);
2536 TCGv_i64 v
= tcg_temp_new_i64();
2537 tcg_gen_extu_i32_i64(v
, arg
[1].in
);
2543 #undef gen_shift_reg
2545 static void translate_srli(DisasContext
*dc
, const OpcodeArg arg
[],
2546 const uint32_t par
[])
2548 tcg_gen_shri_i32(arg
[0].out
, arg
[1].in
, arg
[2].imm
);
2551 static void translate_ssa8b(DisasContext
*dc
, const OpcodeArg arg
[],
2552 const uint32_t par
[])
2554 TCGv_i32 tmp
= tcg_temp_new_i32();
2555 tcg_gen_shli_i32(tmp
, arg
[0].in
, 3);
2556 gen_left_shift_sar(dc
, tmp
);
2560 static void translate_ssa8l(DisasContext
*dc
, const OpcodeArg arg
[],
2561 const uint32_t par
[])
2563 TCGv_i32 tmp
= tcg_temp_new_i32();
2564 tcg_gen_shli_i32(tmp
, arg
[0].in
, 3);
2565 gen_right_shift_sar(dc
, tmp
);
2569 static void translate_ssai(DisasContext
*dc
, const OpcodeArg arg
[],
2570 const uint32_t par
[])
2572 TCGv_i32 tmp
= tcg_const_i32(arg
[0].imm
);
2573 gen_right_shift_sar(dc
, tmp
);
2577 static void translate_ssl(DisasContext
*dc
, const OpcodeArg arg
[],
2578 const uint32_t par
[])
2580 gen_left_shift_sar(dc
, arg
[0].in
);
2583 static void translate_ssr(DisasContext
*dc
, const OpcodeArg arg
[],
2584 const uint32_t par
[])
2586 gen_right_shift_sar(dc
, arg
[0].in
);
2589 static void translate_sub(DisasContext
*dc
, const OpcodeArg arg
[],
2590 const uint32_t par
[])
2592 tcg_gen_sub_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2595 static void translate_subx(DisasContext
*dc
, const OpcodeArg arg
[],
2596 const uint32_t par
[])
2598 TCGv_i32 tmp
= tcg_temp_new_i32();
2599 tcg_gen_shli_i32(tmp
, arg
[1].in
, par
[0]);
2600 tcg_gen_sub_i32(arg
[0].out
, tmp
, arg
[2].in
);
2604 static void translate_waiti(DisasContext
*dc
, const OpcodeArg arg
[],
2605 const uint32_t par
[])
2607 #ifndef CONFIG_USER_ONLY
2608 gen_waiti(dc
, arg
[0].imm
);
2612 static void translate_wtlb(DisasContext
*dc
, const OpcodeArg arg
[],
2613 const uint32_t par
[])
2615 #ifndef CONFIG_USER_ONLY
2616 TCGv_i32 dtlb
= tcg_const_i32(par
[0]);
2618 gen_helper_wtlb(cpu_env
, arg
[0].in
, arg
[1].in
, dtlb
);
2619 tcg_temp_free(dtlb
);
2623 static void translate_wptlb(DisasContext
*dc
, const OpcodeArg arg
[],
2624 const uint32_t par
[])
2626 #ifndef CONFIG_USER_ONLY
2627 gen_helper_wptlb(cpu_env
, arg
[0].in
, arg
[1].in
);
2631 static void translate_wer(DisasContext
*dc
, const OpcodeArg arg
[],
2632 const uint32_t par
[])
2634 gen_helper_wer(cpu_env
, arg
[0].in
, arg
[1].in
);
2637 static void translate_wrmsk_expstate(DisasContext
*dc
, const OpcodeArg arg
[],
2638 const uint32_t par
[])
2640 /* TODO: GPIO32 may be a part of coprocessor */
2641 tcg_gen_and_i32(cpu_UR
[EXPSTATE
], arg
[0].in
, arg
[1].in
);
2644 static void translate_wsr(DisasContext
*dc
, const OpcodeArg arg
[],
2645 const uint32_t par
[])
2647 if (sr_name
[par
[0]]) {
2648 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2652 static void translate_wsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2653 const uint32_t par
[])
2655 if (sr_name
[par
[0]]) {
2656 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, par
[2]);
2660 static void translate_wsr_acchi(DisasContext
*dc
, const OpcodeArg arg
[],
2661 const uint32_t par
[])
2663 tcg_gen_ext8s_i32(cpu_SR
[par
[0]], arg
[0].in
);
2666 static void translate_wsr_ccompare(DisasContext
*dc
, const OpcodeArg arg
[],
2667 const uint32_t par
[])
2669 #ifndef CONFIG_USER_ONLY
2670 uint32_t id
= par
[0] - CCOMPARE
;
2671 TCGv_i32 tmp
= tcg_const_i32(id
);
2673 assert(id
< dc
->config
->nccompare
);
2674 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2677 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2678 gen_helper_update_ccompare(cpu_env
, tmp
);
2683 static void translate_wsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2684 const uint32_t par
[])
2686 #ifndef CONFIG_USER_ONLY
2687 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2690 gen_helper_wsr_ccount(cpu_env
, arg
[0].in
);
2694 static void translate_wsr_dbreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2695 const uint32_t par
[])
2697 #ifndef CONFIG_USER_ONLY
2698 unsigned id
= par
[0] - DBREAKA
;
2699 TCGv_i32 tmp
= tcg_const_i32(id
);
2701 assert(id
< dc
->config
->ndbreak
);
2702 gen_helper_wsr_dbreaka(cpu_env
, tmp
, arg
[0].in
);
2707 static void translate_wsr_dbreakc(DisasContext
*dc
, const OpcodeArg arg
[],
2708 const uint32_t par
[])
2710 #ifndef CONFIG_USER_ONLY
2711 unsigned id
= par
[0] - DBREAKC
;
2712 TCGv_i32 tmp
= tcg_const_i32(id
);
2714 assert(id
< dc
->config
->ndbreak
);
2715 gen_helper_wsr_dbreakc(cpu_env
, tmp
, arg
[0].in
);
2720 static void translate_wsr_ibreaka(DisasContext
*dc
, const OpcodeArg arg
[],
2721 const uint32_t par
[])
2723 #ifndef CONFIG_USER_ONLY
2724 unsigned id
= par
[0] - IBREAKA
;
2725 TCGv_i32 tmp
= tcg_const_i32(id
);
2727 assert(id
< dc
->config
->nibreak
);
2728 gen_helper_wsr_ibreaka(cpu_env
, tmp
, arg
[0].in
);
2733 static void translate_wsr_ibreakenable(DisasContext
*dc
, const OpcodeArg arg
[],
2734 const uint32_t par
[])
2736 #ifndef CONFIG_USER_ONLY
2737 gen_helper_wsr_ibreakenable(cpu_env
, arg
[0].in
);
2741 static void translate_wsr_icount(DisasContext
*dc
, const OpcodeArg arg
[],
2742 const uint32_t par
[])
2744 #ifndef CONFIG_USER_ONLY
2746 tcg_gen_mov_i32(dc
->next_icount
, arg
[0].in
);
2748 tcg_gen_mov_i32(cpu_SR
[par
[0]], arg
[0].in
);
2753 static void translate_wsr_intclear(DisasContext
*dc
, const OpcodeArg arg
[],
2754 const uint32_t par
[])
2756 #ifndef CONFIG_USER_ONLY
2757 gen_helper_intclear(cpu_env
, arg
[0].in
);
2761 static void translate_wsr_intset(DisasContext
*dc
, const OpcodeArg arg
[],
2762 const uint32_t par
[])
2764 #ifndef CONFIG_USER_ONLY
2765 gen_helper_intset(cpu_env
, arg
[0].in
);
2769 static void translate_wsr_memctl(DisasContext
*dc
, const OpcodeArg arg
[],
2770 const uint32_t par
[])
2772 #ifndef CONFIG_USER_ONLY
2773 gen_helper_wsr_memctl(cpu_env
, arg
[0].in
);
2777 static void translate_wsr_mpuenb(DisasContext
*dc
, const OpcodeArg arg
[],
2778 const uint32_t par
[])
2780 #ifndef CONFIG_USER_ONLY
2781 gen_helper_wsr_mpuenb(cpu_env
, arg
[0].in
);
2785 static void translate_wsr_ps(DisasContext
*dc
, const OpcodeArg arg
[],
2786 const uint32_t par
[])
2788 #ifndef CONFIG_USER_ONLY
2789 uint32_t mask
= PS_WOE
| PS_CALLINC
| PS_OWB
|
2790 PS_UM
| PS_EXCM
| PS_INTLEVEL
;
2792 if (option_enabled(dc
, XTENSA_OPTION_MMU
) ||
2793 option_enabled(dc
, XTENSA_OPTION_MPU
)) {
2796 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, mask
);
2800 static void translate_wsr_rasid(DisasContext
*dc
, const OpcodeArg arg
[],
2801 const uint32_t par
[])
2803 #ifndef CONFIG_USER_ONLY
2804 gen_helper_wsr_rasid(cpu_env
, arg
[0].in
);
2808 static void translate_wsr_sar(DisasContext
*dc
, const OpcodeArg arg
[],
2809 const uint32_t par
[])
2811 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
, 0x3f);
2812 if (dc
->sar_m32_5bit
) {
2813 tcg_gen_discard_i32(dc
->sar_m32
);
2815 dc
->sar_5bit
= false;
2816 dc
->sar_m32_5bit
= false;
2819 static void translate_wsr_windowbase(DisasContext
*dc
, const OpcodeArg arg
[],
2820 const uint32_t par
[])
2822 #ifndef CONFIG_USER_ONLY
2823 tcg_gen_mov_i32(cpu_windowbase_next
, arg
[0].in
);
2827 static void translate_wsr_windowstart(DisasContext
*dc
, const OpcodeArg arg
[],
2828 const uint32_t par
[])
2830 #ifndef CONFIG_USER_ONLY
2831 tcg_gen_andi_i32(cpu_SR
[par
[0]], arg
[0].in
,
2832 (1 << dc
->config
->nareg
/ 4) - 1);
2836 static void translate_wur(DisasContext
*dc
, const OpcodeArg arg
[],
2837 const uint32_t par
[])
2839 tcg_gen_mov_i32(cpu_UR
[par
[0]], arg
[0].in
);
2842 static void translate_xor(DisasContext
*dc
, const OpcodeArg arg
[],
2843 const uint32_t par
[])
2845 tcg_gen_xor_i32(arg
[0].out
, arg
[1].in
, arg
[2].in
);
2848 static void translate_xsr(DisasContext
*dc
, const OpcodeArg arg
[],
2849 const uint32_t par
[])
2851 if (sr_name
[par
[0]]) {
2852 TCGv_i32 tmp
= tcg_temp_new_i32();
2854 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2855 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2856 tcg_gen_mov_i32(cpu_SR
[par
[0]], tmp
);
2859 tcg_gen_movi_i32(arg
[0].out
, 0);
2863 static void translate_xsr_mask(DisasContext
*dc
, const OpcodeArg arg
[],
2864 const uint32_t par
[])
2866 if (sr_name
[par
[0]]) {
2867 TCGv_i32 tmp
= tcg_temp_new_i32();
2869 tcg_gen_mov_i32(tmp
, arg
[0].in
);
2870 tcg_gen_mov_i32(arg
[0].out
, cpu_SR
[par
[0]]);
2871 tcg_gen_andi_i32(cpu_SR
[par
[0]], tmp
, par
[2]);
2874 tcg_gen_movi_i32(arg
[0].out
, 0);
2878 static void translate_xsr_ccount(DisasContext
*dc
, const OpcodeArg arg
[],
2879 const uint32_t par
[])
2881 #ifndef CONFIG_USER_ONLY
2882 TCGv_i32 tmp
= tcg_temp_new_i32();
2884 if (tb_cflags(dc
->base
.tb
) & CF_USE_ICOUNT
) {
2888 gen_helper_update_ccount(cpu_env
);
2889 tcg_gen_mov_i32(tmp
, cpu_SR
[par
[0]]);
2890 gen_helper_wsr_ccount(cpu_env
, arg
[0].in
);
2891 tcg_gen_mov_i32(arg
[0].out
, tmp
);
2897 #define gen_translate_xsr(name) \
2898 static void translate_xsr_##name(DisasContext *dc, const OpcodeArg arg[], \
2899 const uint32_t par[]) \
2901 TCGv_i32 tmp = tcg_temp_new_i32(); \
2903 if (sr_name[par[0]]) { \
2904 tcg_gen_mov_i32(tmp, cpu_SR[par[0]]); \
2906 tcg_gen_movi_i32(tmp, 0); \
2908 translate_wsr_##name(dc, arg, par); \
2909 tcg_gen_mov_i32(arg[0].out, tmp); \
2910 tcg_temp_free(tmp); \
2913 gen_translate_xsr(acchi
)
2914 gen_translate_xsr(ccompare
)
2915 gen_translate_xsr(dbreaka
)
2916 gen_translate_xsr(dbreakc
)
2917 gen_translate_xsr(ibreaka
)
2918 gen_translate_xsr(ibreakenable
)
2919 gen_translate_xsr(icount
)
2920 gen_translate_xsr(memctl
)
2921 gen_translate_xsr(mpuenb
)
2922 gen_translate_xsr(ps
)
2923 gen_translate_xsr(rasid
)
2924 gen_translate_xsr(sar
)
2925 gen_translate_xsr(windowbase
)
2926 gen_translate_xsr(windowstart
)
2928 #undef gen_translate_xsr
2930 static const XtensaOpcodeOps core_ops
[] = {
2933 .translate
= translate_abs
,
2935 .name
= (const char * const[]) {
2936 "add", "add.n", NULL
,
2938 .translate
= translate_add
,
2939 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2941 .name
= (const char * const[]) {
2942 "addi", "addi.n", NULL
,
2944 .translate
= translate_addi
,
2945 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2948 .translate
= translate_addi
,
2951 .translate
= translate_addx
,
2952 .par
= (const uint32_t[]){1},
2955 .translate
= translate_addx
,
2956 .par
= (const uint32_t[]){2},
2959 .translate
= translate_addx
,
2960 .par
= (const uint32_t[]){3},
2963 .translate
= translate_all
,
2964 .par
= (const uint32_t[]){true, 4},
2967 .translate
= translate_all
,
2968 .par
= (const uint32_t[]){true, 8},
2971 .translate
= translate_and
,
2974 .translate
= translate_boolean
,
2975 .par
= (const uint32_t[]){BOOLEAN_AND
},
2978 .translate
= translate_boolean
,
2979 .par
= (const uint32_t[]){BOOLEAN_ANDC
},
2982 .translate
= translate_all
,
2983 .par
= (const uint32_t[]){false, 4},
2986 .translate
= translate_all
,
2987 .par
= (const uint32_t[]){false, 8},
2989 .name
= (const char * const[]) {
2990 "ball", "ball.w15", "ball.w18", NULL
,
2992 .translate
= translate_ball
,
2993 .par
= (const uint32_t[]){TCG_COND_EQ
},
2994 .op_flags
= XTENSA_OP_NAME_ARRAY
,
2996 .name
= (const char * const[]) {
2997 "bany", "bany.w15", "bany.w18", NULL
,
2999 .translate
= translate_bany
,
3000 .par
= (const uint32_t[]){TCG_COND_NE
},
3001 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3003 .name
= (const char * const[]) {
3004 "bbc", "bbc.w15", "bbc.w18", NULL
,
3006 .translate
= translate_bb
,
3007 .par
= (const uint32_t[]){TCG_COND_EQ
},
3008 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3010 .name
= (const char * const[]) {
3011 "bbci", "bbci.w15", "bbci.w18", NULL
,
3013 .translate
= translate_bbi
,
3014 .par
= (const uint32_t[]){TCG_COND_EQ
},
3015 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3017 .name
= (const char * const[]) {
3018 "bbs", "bbs.w15", "bbs.w18", NULL
,
3020 .translate
= translate_bb
,
3021 .par
= (const uint32_t[]){TCG_COND_NE
},
3022 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3024 .name
= (const char * const[]) {
3025 "bbsi", "bbsi.w15", "bbsi.w18", NULL
,
3027 .translate
= translate_bbi
,
3028 .par
= (const uint32_t[]){TCG_COND_NE
},
3029 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3031 .name
= (const char * const[]) {
3032 "beq", "beq.w15", "beq.w18", NULL
,
3034 .translate
= translate_b
,
3035 .par
= (const uint32_t[]){TCG_COND_EQ
},
3036 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3038 .name
= (const char * const[]) {
3039 "beqi", "beqi.w15", "beqi.w18", NULL
,
3041 .translate
= translate_bi
,
3042 .par
= (const uint32_t[]){TCG_COND_EQ
},
3043 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3045 .name
= (const char * const[]) {
3046 "beqz", "beqz.n", "beqz.w15", "beqz.w18", NULL
,
3048 .translate
= translate_bz
,
3049 .par
= (const uint32_t[]){TCG_COND_EQ
},
3050 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3053 .translate
= translate_bp
,
3054 .par
= (const uint32_t[]){TCG_COND_EQ
},
3056 .name
= (const char * const[]) {
3057 "bge", "bge.w15", "bge.w18", NULL
,
3059 .translate
= translate_b
,
3060 .par
= (const uint32_t[]){TCG_COND_GE
},
3061 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3063 .name
= (const char * const[]) {
3064 "bgei", "bgei.w15", "bgei.w18", NULL
,
3066 .translate
= translate_bi
,
3067 .par
= (const uint32_t[]){TCG_COND_GE
},
3068 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3070 .name
= (const char * const[]) {
3071 "bgeu", "bgeu.w15", "bgeu.w18", NULL
,
3073 .translate
= translate_b
,
3074 .par
= (const uint32_t[]){TCG_COND_GEU
},
3075 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3077 .name
= (const char * const[]) {
3078 "bgeui", "bgeui.w15", "bgeui.w18", NULL
,
3080 .translate
= translate_bi
,
3081 .par
= (const uint32_t[]){TCG_COND_GEU
},
3082 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3084 .name
= (const char * const[]) {
3085 "bgez", "bgez.w15", "bgez.w18", NULL
,
3087 .translate
= translate_bz
,
3088 .par
= (const uint32_t[]){TCG_COND_GE
},
3089 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3091 .name
= (const char * const[]) {
3092 "blt", "blt.w15", "blt.w18", NULL
,
3094 .translate
= translate_b
,
3095 .par
= (const uint32_t[]){TCG_COND_LT
},
3096 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3098 .name
= (const char * const[]) {
3099 "blti", "blti.w15", "blti.w18", NULL
,
3101 .translate
= translate_bi
,
3102 .par
= (const uint32_t[]){TCG_COND_LT
},
3103 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3105 .name
= (const char * const[]) {
3106 "bltu", "bltu.w15", "bltu.w18", NULL
,
3108 .translate
= translate_b
,
3109 .par
= (const uint32_t[]){TCG_COND_LTU
},
3110 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3112 .name
= (const char * const[]) {
3113 "bltui", "bltui.w15", "bltui.w18", NULL
,
3115 .translate
= translate_bi
,
3116 .par
= (const uint32_t[]){TCG_COND_LTU
},
3117 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3119 .name
= (const char * const[]) {
3120 "bltz", "bltz.w15", "bltz.w18", NULL
,
3122 .translate
= translate_bz
,
3123 .par
= (const uint32_t[]){TCG_COND_LT
},
3124 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3126 .name
= (const char * const[]) {
3127 "bnall", "bnall.w15", "bnall.w18", NULL
,
3129 .translate
= translate_ball
,
3130 .par
= (const uint32_t[]){TCG_COND_NE
},
3131 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3133 .name
= (const char * const[]) {
3134 "bne", "bne.w15", "bne.w18", NULL
,
3136 .translate
= translate_b
,
3137 .par
= (const uint32_t[]){TCG_COND_NE
},
3138 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3140 .name
= (const char * const[]) {
3141 "bnei", "bnei.w15", "bnei.w18", NULL
,
3143 .translate
= translate_bi
,
3144 .par
= (const uint32_t[]){TCG_COND_NE
},
3145 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3147 .name
= (const char * const[]) {
3148 "bnez", "bnez.n", "bnez.w15", "bnez.w18", NULL
,
3150 .translate
= translate_bz
,
3151 .par
= (const uint32_t[]){TCG_COND_NE
},
3152 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3154 .name
= (const char * const[]) {
3155 "bnone", "bnone.w15", "bnone.w18", NULL
,
3157 .translate
= translate_bany
,
3158 .par
= (const uint32_t[]){TCG_COND_EQ
},
3159 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3162 .translate
= translate_nop
,
3163 .par
= (const uint32_t[]){DEBUGCAUSE_BI
},
3164 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
3167 .translate
= translate_nop
,
3168 .par
= (const uint32_t[]){DEBUGCAUSE_BN
},
3169 .op_flags
= XTENSA_OP_DEBUG_BREAK
,
3172 .translate
= translate_bp
,
3173 .par
= (const uint32_t[]){TCG_COND_NE
},
3176 .translate
= translate_call0
,
3179 .translate
= translate_callw
,
3180 .par
= (const uint32_t[]){3},
3183 .translate
= translate_callw
,
3184 .par
= (const uint32_t[]){1},
3187 .translate
= translate_callw
,
3188 .par
= (const uint32_t[]){2},
3191 .translate
= translate_callx0
,
3194 .translate
= translate_callxw
,
3195 .par
= (const uint32_t[]){3},
3198 .translate
= translate_callxw
,
3199 .par
= (const uint32_t[]){1},
3202 .translate
= translate_callxw
,
3203 .par
= (const uint32_t[]){2},
3206 .translate
= translate_clamps
,
3208 .name
= "clrb_expstate",
3209 .translate
= translate_clrb_expstate
,
3212 .translate
= translate_clrex
,
3215 .translate
= translate_const16
,
3218 .translate
= translate_depbits
,
3221 .translate
= translate_dcache
,
3222 .op_flags
= XTENSA_OP_PRIVILEGED
,
3225 .translate
= translate_nop
,
3228 .translate
= translate_dcache
,
3229 .op_flags
= XTENSA_OP_PRIVILEGED
,
3232 .translate
= translate_dcache
,
3235 .translate
= translate_nop
,
3238 .translate
= translate_dcache
,
3241 .translate
= translate_nop
,
3244 .translate
= translate_nop
,
3245 .op_flags
= XTENSA_OP_PRIVILEGED
,
3248 .translate
= translate_nop
,
3249 .op_flags
= XTENSA_OP_PRIVILEGED
,
3252 .translate
= translate_nop
,
3253 .op_flags
= XTENSA_OP_PRIVILEGED
,
3256 .translate
= translate_nop
,
3257 .op_flags
= XTENSA_OP_PRIVILEGED
,
3260 .translate
= translate_diwbuip
,
3261 .op_flags
= XTENSA_OP_PRIVILEGED
,
3264 .translate
= translate_dcache
,
3265 .op_flags
= XTENSA_OP_PRIVILEGED
,
3268 .translate
= translate_nop
,
3271 .translate
= translate_nop
,
3274 .translate
= translate_nop
,
3277 .translate
= translate_nop
,
3280 .translate
= translate_nop
,
3283 .translate
= translate_nop
,
3286 .translate
= translate_nop
,
3289 .translate
= translate_nop
,
3292 .translate
= translate_nop
,
3295 .translate
= translate_nop
,
3298 .translate
= translate_nop
,
3301 .translate
= translate_entry
,
3302 .test_exceptions
= test_exceptions_entry
,
3303 .test_overflow
= test_overflow_entry
,
3304 .op_flags
= XTENSA_OP_EXIT_TB_M1
|
3305 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3308 .translate
= translate_nop
,
3311 .translate
= translate_nop
,
3314 .translate
= translate_extui
,
3317 .translate
= translate_memw
,
3320 .translate
= translate_getex
,
3323 .op_flags
= XTENSA_OP_ILL
,
3326 .op_flags
= XTENSA_OP_ILL
,
3329 .translate
= translate_itlb
,
3330 .par
= (const uint32_t[]){true},
3331 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3334 .translate
= translate_icache
,
3337 .translate
= translate_icache
,
3338 .op_flags
= XTENSA_OP_PRIVILEGED
,
3341 .translate
= translate_nop
,
3342 .op_flags
= XTENSA_OP_PRIVILEGED
,
3345 .translate
= translate_itlb
,
3346 .par
= (const uint32_t[]){false},
3347 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
3350 .translate
= translate_nop
,
3351 .op_flags
= XTENSA_OP_PRIVILEGED
,
3353 .name
= (const char * const[]) {
3354 "ill", "ill.n", NULL
,
3356 .op_flags
= XTENSA_OP_ILL
| XTENSA_OP_NAME_ARRAY
,
3359 .translate
= translate_nop
,
3362 .translate
= translate_icache
,
3363 .op_flags
= XTENSA_OP_PRIVILEGED
,
3366 .translate
= translate_nop
,
3369 .translate
= translate_j
,
3372 .translate
= translate_jx
,
3375 .translate
= translate_ldst
,
3376 .par
= (const uint32_t[]){MO_TESW
, false, false},
3377 .op_flags
= XTENSA_OP_LOAD
,
3380 .translate
= translate_ldst
,
3381 .par
= (const uint32_t[]){MO_TEUW
, false, false},
3382 .op_flags
= XTENSA_OP_LOAD
,
3385 .translate
= translate_ldst
,
3386 .par
= (const uint32_t[]){MO_TEUL
, true, false},
3387 .op_flags
= XTENSA_OP_LOAD
,
3390 .translate
= translate_l32e
,
3391 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_LOAD
,
3394 .translate
= translate_l32ex
,
3395 .op_flags
= XTENSA_OP_LOAD
,
3397 .name
= (const char * const[]) {
3398 "l32i", "l32i.n", NULL
,
3400 .translate
= translate_ldst
,
3401 .par
= (const uint32_t[]){MO_TEUL
, false, false},
3402 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_LOAD
,
3405 .translate
= translate_l32r
,
3406 .op_flags
= XTENSA_OP_LOAD
,
3409 .translate
= translate_ldst
,
3410 .par
= (const uint32_t[]){MO_UB
, false, false},
3411 .op_flags
= XTENSA_OP_LOAD
,
3414 .translate
= translate_mac16
,
3415 .par
= (const uint32_t[]){MAC16_NONE
, 0, -4},
3416 .op_flags
= XTENSA_OP_LOAD
,
3419 .translate
= translate_mac16
,
3420 .par
= (const uint32_t[]){MAC16_NONE
, 0, 4},
3421 .op_flags
= XTENSA_OP_LOAD
,
3424 .op_flags
= XTENSA_OP_ILL
,
3426 .name
= (const char * const[]) {
3427 "loop", "loop.w15", NULL
,
3429 .translate
= translate_loop
,
3430 .par
= (const uint32_t[]){TCG_COND_NEVER
},
3431 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3433 .name
= (const char * const[]) {
3434 "loopgtz", "loopgtz.w15", NULL
,
3436 .translate
= translate_loop
,
3437 .par
= (const uint32_t[]){TCG_COND_GT
},
3438 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3440 .name
= (const char * const[]) {
3441 "loopnez", "loopnez.w15", NULL
,
3443 .translate
= translate_loop
,
3444 .par
= (const uint32_t[]){TCG_COND_NE
},
3445 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3448 .translate
= translate_smax
,
3451 .translate
= translate_umax
,
3454 .translate
= translate_memw
,
3457 .translate
= translate_smin
,
3460 .translate
= translate_umin
,
3462 .name
= (const char * const[]) {
3463 "mov", "mov.n", NULL
,
3465 .translate
= translate_mov
,
3466 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3469 .translate
= translate_movcond
,
3470 .par
= (const uint32_t[]){TCG_COND_EQ
},
3473 .translate
= translate_movp
,
3474 .par
= (const uint32_t[]){TCG_COND_EQ
},
3477 .translate
= translate_movcond
,
3478 .par
= (const uint32_t[]){TCG_COND_GE
},
3481 .translate
= translate_movi
,
3484 .translate
= translate_movi
,
3487 .translate
= translate_movcond
,
3488 .par
= (const uint32_t[]){TCG_COND_LT
},
3491 .translate
= translate_movcond
,
3492 .par
= (const uint32_t[]){TCG_COND_NE
},
3495 .translate
= translate_movsp
,
3496 .op_flags
= XTENSA_OP_ALLOCA
,
3499 .translate
= translate_movp
,
3500 .par
= (const uint32_t[]){TCG_COND_NE
},
3502 .name
= "mul.aa.hh",
3503 .translate
= translate_mac16
,
3504 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3506 .name
= "mul.aa.hl",
3507 .translate
= translate_mac16
,
3508 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3510 .name
= "mul.aa.lh",
3511 .translate
= translate_mac16
,
3512 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3514 .name
= "mul.aa.ll",
3515 .translate
= translate_mac16
,
3516 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3518 .name
= "mul.ad.hh",
3519 .translate
= translate_mac16
,
3520 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3522 .name
= "mul.ad.hl",
3523 .translate
= translate_mac16
,
3524 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3526 .name
= "mul.ad.lh",
3527 .translate
= translate_mac16
,
3528 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3530 .name
= "mul.ad.ll",
3531 .translate
= translate_mac16
,
3532 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3534 .name
= "mul.da.hh",
3535 .translate
= translate_mac16
,
3536 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3538 .name
= "mul.da.hl",
3539 .translate
= translate_mac16
,
3540 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3542 .name
= "mul.da.lh",
3543 .translate
= translate_mac16
,
3544 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3546 .name
= "mul.da.ll",
3547 .translate
= translate_mac16
,
3548 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3550 .name
= "mul.dd.hh",
3551 .translate
= translate_mac16
,
3552 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HH
, 0},
3554 .name
= "mul.dd.hl",
3555 .translate
= translate_mac16
,
3556 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_HL
, 0},
3558 .name
= "mul.dd.lh",
3559 .translate
= translate_mac16
,
3560 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LH
, 0},
3562 .name
= "mul.dd.ll",
3563 .translate
= translate_mac16
,
3564 .par
= (const uint32_t[]){MAC16_MUL
, MAC16_LL
, 0},
3567 .translate
= translate_mul16
,
3568 .par
= (const uint32_t[]){true},
3571 .translate
= translate_mul16
,
3572 .par
= (const uint32_t[]){false},
3574 .name
= "mula.aa.hh",
3575 .translate
= translate_mac16
,
3576 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3578 .name
= "mula.aa.hl",
3579 .translate
= translate_mac16
,
3580 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3582 .name
= "mula.aa.lh",
3583 .translate
= translate_mac16
,
3584 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3586 .name
= "mula.aa.ll",
3587 .translate
= translate_mac16
,
3588 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3590 .name
= "mula.ad.hh",
3591 .translate
= translate_mac16
,
3592 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3594 .name
= "mula.ad.hl",
3595 .translate
= translate_mac16
,
3596 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3598 .name
= "mula.ad.lh",
3599 .translate
= translate_mac16
,
3600 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3602 .name
= "mula.ad.ll",
3603 .translate
= translate_mac16
,
3604 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3606 .name
= "mula.da.hh",
3607 .translate
= translate_mac16
,
3608 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3610 .name
= "mula.da.hh.lddec",
3611 .translate
= translate_mac16
,
3612 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3614 .name
= "mula.da.hh.ldinc",
3615 .translate
= translate_mac16
,
3616 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3618 .name
= "mula.da.hl",
3619 .translate
= translate_mac16
,
3620 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3622 .name
= "mula.da.hl.lddec",
3623 .translate
= translate_mac16
,
3624 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3626 .name
= "mula.da.hl.ldinc",
3627 .translate
= translate_mac16
,
3628 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3630 .name
= "mula.da.lh",
3631 .translate
= translate_mac16
,
3632 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3634 .name
= "mula.da.lh.lddec",
3635 .translate
= translate_mac16
,
3636 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3638 .name
= "mula.da.lh.ldinc",
3639 .translate
= translate_mac16
,
3640 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3642 .name
= "mula.da.ll",
3643 .translate
= translate_mac16
,
3644 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3646 .name
= "mula.da.ll.lddec",
3647 .translate
= translate_mac16
,
3648 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3650 .name
= "mula.da.ll.ldinc",
3651 .translate
= translate_mac16
,
3652 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3654 .name
= "mula.dd.hh",
3655 .translate
= translate_mac16
,
3656 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 0},
3658 .name
= "mula.dd.hh.lddec",
3659 .translate
= translate_mac16
,
3660 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, -4},
3662 .name
= "mula.dd.hh.ldinc",
3663 .translate
= translate_mac16
,
3664 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HH
, 4},
3666 .name
= "mula.dd.hl",
3667 .translate
= translate_mac16
,
3668 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 0},
3670 .name
= "mula.dd.hl.lddec",
3671 .translate
= translate_mac16
,
3672 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, -4},
3674 .name
= "mula.dd.hl.ldinc",
3675 .translate
= translate_mac16
,
3676 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_HL
, 4},
3678 .name
= "mula.dd.lh",
3679 .translate
= translate_mac16
,
3680 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 0},
3682 .name
= "mula.dd.lh.lddec",
3683 .translate
= translate_mac16
,
3684 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, -4},
3686 .name
= "mula.dd.lh.ldinc",
3687 .translate
= translate_mac16
,
3688 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LH
, 4},
3690 .name
= "mula.dd.ll",
3691 .translate
= translate_mac16
,
3692 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 0},
3694 .name
= "mula.dd.ll.lddec",
3695 .translate
= translate_mac16
,
3696 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, -4},
3698 .name
= "mula.dd.ll.ldinc",
3699 .translate
= translate_mac16
,
3700 .par
= (const uint32_t[]){MAC16_MULA
, MAC16_LL
, 4},
3703 .translate
= translate_mull
,
3705 .name
= "muls.aa.hh",
3706 .translate
= translate_mac16
,
3707 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3709 .name
= "muls.aa.hl",
3710 .translate
= translate_mac16
,
3711 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3713 .name
= "muls.aa.lh",
3714 .translate
= translate_mac16
,
3715 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3717 .name
= "muls.aa.ll",
3718 .translate
= translate_mac16
,
3719 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3721 .name
= "muls.ad.hh",
3722 .translate
= translate_mac16
,
3723 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3725 .name
= "muls.ad.hl",
3726 .translate
= translate_mac16
,
3727 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3729 .name
= "muls.ad.lh",
3730 .translate
= translate_mac16
,
3731 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3733 .name
= "muls.ad.ll",
3734 .translate
= translate_mac16
,
3735 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3737 .name
= "muls.da.hh",
3738 .translate
= translate_mac16
,
3739 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3741 .name
= "muls.da.hl",
3742 .translate
= translate_mac16
,
3743 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3745 .name
= "muls.da.lh",
3746 .translate
= translate_mac16
,
3747 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3749 .name
= "muls.da.ll",
3750 .translate
= translate_mac16
,
3751 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3753 .name
= "muls.dd.hh",
3754 .translate
= translate_mac16
,
3755 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HH
, 0},
3757 .name
= "muls.dd.hl",
3758 .translate
= translate_mac16
,
3759 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_HL
, 0},
3761 .name
= "muls.dd.lh",
3762 .translate
= translate_mac16
,
3763 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LH
, 0},
3765 .name
= "muls.dd.ll",
3766 .translate
= translate_mac16
,
3767 .par
= (const uint32_t[]){MAC16_MULS
, MAC16_LL
, 0},
3770 .translate
= translate_mulh
,
3771 .par
= (const uint32_t[]){true},
3774 .translate
= translate_mulh
,
3775 .par
= (const uint32_t[]){false},
3778 .translate
= translate_neg
,
3780 .name
= (const char * const[]) {
3781 "nop", "nop.n", NULL
,
3783 .translate
= translate_nop
,
3784 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3787 .translate
= translate_nsa
,
3790 .translate
= translate_nsau
,
3793 .translate
= translate_or
,
3796 .translate
= translate_boolean
,
3797 .par
= (const uint32_t[]){BOOLEAN_OR
},
3800 .translate
= translate_boolean
,
3801 .par
= (const uint32_t[]){BOOLEAN_ORC
},
3804 .translate
= translate_ptlb
,
3805 .par
= (const uint32_t[]){true},
3806 .op_flags
= XTENSA_OP_PRIVILEGED
,
3809 .translate
= translate_nop
,
3812 .translate
= translate_nop
,
3815 .translate
= translate_nop
,
3818 .translate
= translate_nop
,
3821 .translate
= translate_nop
,
3824 .translate
= translate_ptlb
,
3825 .par
= (const uint32_t[]){false},
3826 .op_flags
= XTENSA_OP_PRIVILEGED
,
3829 .translate
= translate_pptlb
,
3830 .op_flags
= XTENSA_OP_PRIVILEGED
,
3833 .translate
= translate_quos
,
3834 .par
= (const uint32_t[]){true},
3835 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3838 .translate
= translate_quou
,
3839 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3842 .translate
= translate_rtlb
,
3843 .par
= (const uint32_t[]){true, 0},
3844 .op_flags
= XTENSA_OP_PRIVILEGED
,
3847 .translate
= translate_rtlb
,
3848 .par
= (const uint32_t[]){true, 1},
3849 .op_flags
= XTENSA_OP_PRIVILEGED
,
3851 .name
= "read_impwire",
3852 .translate
= translate_read_impwire
,
3855 .translate
= translate_quos
,
3856 .par
= (const uint32_t[]){false},
3857 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3860 .translate
= translate_remu
,
3861 .op_flags
= XTENSA_OP_DIVIDE_BY_ZERO
,
3864 .translate
= translate_rer
,
3865 .op_flags
= XTENSA_OP_PRIVILEGED
,
3867 .name
= (const char * const[]) {
3868 "ret", "ret.n", NULL
,
3870 .translate
= translate_ret
,
3871 .op_flags
= XTENSA_OP_NAME_ARRAY
,
3873 .name
= (const char * const[]) {
3874 "retw", "retw.n", NULL
,
3876 .translate
= translate_retw
,
3877 .test_exceptions
= test_exceptions_retw
,
3878 .op_flags
= XTENSA_OP_UNDERFLOW
| XTENSA_OP_NAME_ARRAY
,
3881 .op_flags
= XTENSA_OP_ILL
,
3884 .translate
= translate_rfde
,
3885 .op_flags
= XTENSA_OP_PRIVILEGED
,
3888 .op_flags
= XTENSA_OP_ILL
,
3891 .translate
= translate_rfe
,
3892 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3895 .translate
= translate_rfi
,
3896 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3899 .translate
= translate_rfw
,
3900 .par
= (const uint32_t[]){true},
3901 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3904 .translate
= translate_rfw
,
3905 .par
= (const uint32_t[]){false},
3906 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_CHECK_INTERRUPTS
,
3909 .translate
= translate_rtlb
,
3910 .par
= (const uint32_t[]){false, 0},
3911 .op_flags
= XTENSA_OP_PRIVILEGED
,
3914 .translate
= translate_rtlb
,
3915 .par
= (const uint32_t[]){false, 1},
3916 .op_flags
= XTENSA_OP_PRIVILEGED
,
3919 .translate
= translate_rptlb0
,
3920 .op_flags
= XTENSA_OP_PRIVILEGED
,
3923 .translate
= translate_rptlb1
,
3924 .op_flags
= XTENSA_OP_PRIVILEGED
,
3927 .translate
= translate_rotw
,
3928 .op_flags
= XTENSA_OP_PRIVILEGED
|
3929 XTENSA_OP_EXIT_TB_M1
|
3930 XTENSA_OP_SYNC_REGISTER_WINDOW
,
3933 .translate
= translate_rsil
,
3935 XTENSA_OP_PRIVILEGED
|
3936 XTENSA_OP_EXIT_TB_0
|
3937 XTENSA_OP_CHECK_INTERRUPTS
,
3940 .translate
= translate_rsr
,
3941 .par
= (const uint32_t[]){176},
3942 .op_flags
= XTENSA_OP_PRIVILEGED
,
3945 .translate
= translate_rsr
,
3946 .par
= (const uint32_t[]){208},
3947 .op_flags
= XTENSA_OP_PRIVILEGED
,
3949 .name
= "rsr.acchi",
3950 .translate
= translate_rsr
,
3951 .test_exceptions
= test_exceptions_sr
,
3952 .par
= (const uint32_t[]){
3954 XTENSA_OPTION_MAC16
,
3957 .name
= "rsr.acclo",
3958 .translate
= translate_rsr
,
3959 .test_exceptions
= test_exceptions_sr
,
3960 .par
= (const uint32_t[]){
3962 XTENSA_OPTION_MAC16
,
3965 .name
= "rsr.atomctl",
3966 .translate
= translate_rsr
,
3967 .test_exceptions
= test_exceptions_sr
,
3968 .par
= (const uint32_t[]){
3970 XTENSA_OPTION_ATOMCTL
,
3972 .op_flags
= XTENSA_OP_PRIVILEGED
,
3975 .translate
= translate_rsr
,
3976 .test_exceptions
= test_exceptions_sr
,
3977 .par
= (const uint32_t[]){
3979 XTENSA_OPTION_BOOLEAN
,
3982 .name
= "rsr.cacheadrdis",
3983 .translate
= translate_rsr
,
3984 .test_exceptions
= test_exceptions_sr
,
3985 .par
= (const uint32_t[]){
3989 .op_flags
= XTENSA_OP_PRIVILEGED
,
3991 .name
= "rsr.cacheattr",
3992 .translate
= translate_rsr
,
3993 .test_exceptions
= test_exceptions_sr
,
3994 .par
= (const uint32_t[]){
3996 XTENSA_OPTION_CACHEATTR
,
3998 .op_flags
= XTENSA_OP_PRIVILEGED
,
4000 .name
= "rsr.ccompare0",
4001 .translate
= translate_rsr
,
4002 .test_exceptions
= test_exceptions_ccompare
,
4003 .par
= (const uint32_t[]){
4005 XTENSA_OPTION_TIMER_INTERRUPT
,
4007 .op_flags
= XTENSA_OP_PRIVILEGED
,
4009 .name
= "rsr.ccompare1",
4010 .translate
= translate_rsr
,
4011 .test_exceptions
= test_exceptions_ccompare
,
4012 .par
= (const uint32_t[]){
4014 XTENSA_OPTION_TIMER_INTERRUPT
,
4016 .op_flags
= XTENSA_OP_PRIVILEGED
,
4018 .name
= "rsr.ccompare2",
4019 .translate
= translate_rsr
,
4020 .test_exceptions
= test_exceptions_ccompare
,
4021 .par
= (const uint32_t[]){
4023 XTENSA_OPTION_TIMER_INTERRUPT
,
4025 .op_flags
= XTENSA_OP_PRIVILEGED
,
4027 .name
= "rsr.ccount",
4028 .translate
= translate_rsr_ccount
,
4029 .test_exceptions
= test_exceptions_sr
,
4030 .par
= (const uint32_t[]){
4032 XTENSA_OPTION_TIMER_INTERRUPT
,
4034 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4036 .name
= "rsr.configid0",
4037 .translate
= translate_rsr
,
4038 .par
= (const uint32_t[]){CONFIGID0
},
4039 .op_flags
= XTENSA_OP_PRIVILEGED
,
4041 .name
= "rsr.configid1",
4042 .translate
= translate_rsr
,
4043 .par
= (const uint32_t[]){CONFIGID1
},
4044 .op_flags
= XTENSA_OP_PRIVILEGED
,
4046 .name
= "rsr.cpenable",
4047 .translate
= translate_rsr
,
4048 .test_exceptions
= test_exceptions_sr
,
4049 .par
= (const uint32_t[]){
4051 XTENSA_OPTION_COPROCESSOR
,
4053 .op_flags
= XTENSA_OP_PRIVILEGED
,
4055 .name
= "rsr.dbreaka0",
4056 .translate
= translate_rsr
,
4057 .test_exceptions
= test_exceptions_dbreak
,
4058 .par
= (const uint32_t[]){
4060 XTENSA_OPTION_DEBUG
,
4062 .op_flags
= XTENSA_OP_PRIVILEGED
,
4064 .name
= "rsr.dbreaka1",
4065 .translate
= translate_rsr
,
4066 .test_exceptions
= test_exceptions_dbreak
,
4067 .par
= (const uint32_t[]){
4069 XTENSA_OPTION_DEBUG
,
4071 .op_flags
= XTENSA_OP_PRIVILEGED
,
4073 .name
= "rsr.dbreakc0",
4074 .translate
= translate_rsr
,
4075 .test_exceptions
= test_exceptions_dbreak
,
4076 .par
= (const uint32_t[]){
4078 XTENSA_OPTION_DEBUG
,
4080 .op_flags
= XTENSA_OP_PRIVILEGED
,
4082 .name
= "rsr.dbreakc1",
4083 .translate
= translate_rsr
,
4084 .test_exceptions
= test_exceptions_dbreak
,
4085 .par
= (const uint32_t[]){
4087 XTENSA_OPTION_DEBUG
,
4089 .op_flags
= XTENSA_OP_PRIVILEGED
,
4092 .translate
= translate_rsr
,
4093 .test_exceptions
= test_exceptions_sr
,
4094 .par
= (const uint32_t[]){
4096 XTENSA_OPTION_DEBUG
,
4098 .op_flags
= XTENSA_OP_PRIVILEGED
,
4100 .name
= "rsr.debugcause",
4101 .translate
= translate_rsr
,
4102 .test_exceptions
= test_exceptions_sr
,
4103 .par
= (const uint32_t[]){
4105 XTENSA_OPTION_DEBUG
,
4107 .op_flags
= XTENSA_OP_PRIVILEGED
,
4110 .translate
= translate_rsr
,
4111 .test_exceptions
= test_exceptions_sr
,
4112 .par
= (const uint32_t[]){
4114 XTENSA_OPTION_EXCEPTION
,
4116 .op_flags
= XTENSA_OP_PRIVILEGED
,
4118 .name
= "rsr.dtlbcfg",
4119 .translate
= translate_rsr
,
4120 .test_exceptions
= test_exceptions_sr
,
4121 .par
= (const uint32_t[]){
4125 .op_flags
= XTENSA_OP_PRIVILEGED
,
4128 .translate
= translate_rsr
,
4129 .test_exceptions
= test_exceptions_sr
,
4130 .par
= (const uint32_t[]){
4132 XTENSA_OPTION_EXCEPTION
,
4134 .op_flags
= XTENSA_OP_PRIVILEGED
,
4137 .translate
= translate_rsr
,
4138 .test_exceptions
= test_exceptions_hpi
,
4139 .par
= (const uint32_t[]){
4141 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4143 .op_flags
= XTENSA_OP_PRIVILEGED
,
4146 .translate
= translate_rsr
,
4147 .test_exceptions
= test_exceptions_hpi
,
4148 .par
= (const uint32_t[]){
4150 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4152 .op_flags
= XTENSA_OP_PRIVILEGED
,
4155 .translate
= translate_rsr
,
4156 .test_exceptions
= test_exceptions_hpi
,
4157 .par
= (const uint32_t[]){
4159 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4161 .op_flags
= XTENSA_OP_PRIVILEGED
,
4164 .translate
= translate_rsr
,
4165 .test_exceptions
= test_exceptions_hpi
,
4166 .par
= (const uint32_t[]){
4168 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4170 .op_flags
= XTENSA_OP_PRIVILEGED
,
4173 .translate
= translate_rsr
,
4174 .test_exceptions
= test_exceptions_hpi
,
4175 .par
= (const uint32_t[]){
4177 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4179 .op_flags
= XTENSA_OP_PRIVILEGED
,
4182 .translate
= translate_rsr
,
4183 .test_exceptions
= test_exceptions_hpi
,
4184 .par
= (const uint32_t[]){
4186 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4188 .op_flags
= XTENSA_OP_PRIVILEGED
,
4191 .translate
= translate_rsr
,
4192 .test_exceptions
= test_exceptions_hpi
,
4193 .par
= (const uint32_t[]){
4195 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4197 .op_flags
= XTENSA_OP_PRIVILEGED
,
4200 .translate
= translate_rsr
,
4201 .test_exceptions
= test_exceptions_hpi
,
4202 .par
= (const uint32_t[]){
4204 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4206 .op_flags
= XTENSA_OP_PRIVILEGED
,
4209 .translate
= translate_rsr
,
4210 .test_exceptions
= test_exceptions_hpi
,
4211 .par
= (const uint32_t[]){
4213 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4215 .op_flags
= XTENSA_OP_PRIVILEGED
,
4218 .translate
= translate_rsr
,
4219 .test_exceptions
= test_exceptions_hpi
,
4220 .par
= (const uint32_t[]){
4222 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4224 .op_flags
= XTENSA_OP_PRIVILEGED
,
4227 .translate
= translate_rsr
,
4228 .test_exceptions
= test_exceptions_hpi
,
4229 .par
= (const uint32_t[]){
4231 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4233 .op_flags
= XTENSA_OP_PRIVILEGED
,
4236 .translate
= translate_rsr
,
4237 .test_exceptions
= test_exceptions_hpi
,
4238 .par
= (const uint32_t[]){
4240 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4242 .op_flags
= XTENSA_OP_PRIVILEGED
,
4244 .name
= "rsr.eraccess",
4245 .translate
= translate_rsr
,
4246 .par
= (const uint32_t[]){ERACCESS
},
4247 .op_flags
= XTENSA_OP_PRIVILEGED
,
4249 .name
= "rsr.exccause",
4250 .translate
= translate_rsr
,
4251 .test_exceptions
= test_exceptions_sr
,
4252 .par
= (const uint32_t[]){
4254 XTENSA_OPTION_EXCEPTION
,
4256 .op_flags
= XTENSA_OP_PRIVILEGED
,
4258 .name
= "rsr.excsave1",
4259 .translate
= translate_rsr
,
4260 .test_exceptions
= test_exceptions_sr
,
4261 .par
= (const uint32_t[]){
4263 XTENSA_OPTION_EXCEPTION
,
4265 .op_flags
= XTENSA_OP_PRIVILEGED
,
4267 .name
= "rsr.excsave2",
4268 .translate
= translate_rsr
,
4269 .test_exceptions
= test_exceptions_hpi
,
4270 .par
= (const uint32_t[]){
4272 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4274 .op_flags
= XTENSA_OP_PRIVILEGED
,
4276 .name
= "rsr.excsave3",
4277 .translate
= translate_rsr
,
4278 .test_exceptions
= test_exceptions_hpi
,
4279 .par
= (const uint32_t[]){
4281 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4283 .op_flags
= XTENSA_OP_PRIVILEGED
,
4285 .name
= "rsr.excsave4",
4286 .translate
= translate_rsr
,
4287 .test_exceptions
= test_exceptions_hpi
,
4288 .par
= (const uint32_t[]){
4290 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4292 .op_flags
= XTENSA_OP_PRIVILEGED
,
4294 .name
= "rsr.excsave5",
4295 .translate
= translate_rsr
,
4296 .test_exceptions
= test_exceptions_hpi
,
4297 .par
= (const uint32_t[]){
4299 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4301 .op_flags
= XTENSA_OP_PRIVILEGED
,
4303 .name
= "rsr.excsave6",
4304 .translate
= translate_rsr
,
4305 .test_exceptions
= test_exceptions_hpi
,
4306 .par
= (const uint32_t[]){
4308 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4310 .op_flags
= XTENSA_OP_PRIVILEGED
,
4312 .name
= "rsr.excsave7",
4313 .translate
= translate_rsr
,
4314 .test_exceptions
= test_exceptions_hpi
,
4315 .par
= (const uint32_t[]){
4317 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
4319 .op_flags
= XTENSA_OP_PRIVILEGED
,
4321 .name
= "rsr.excvaddr",
4322 .translate
= translate_rsr
,
4323 .test_exceptions
= test_exceptions_sr
,
4324 .par
= (const uint32_t[]){
4326 XTENSA_OPTION_EXCEPTION
,
4328 .op_flags
= XTENSA_OP_PRIVILEGED
,
4330 .name
= "rsr.ibreaka0",
4331 .translate
= translate_rsr
,
4332 .test_exceptions
= test_exceptions_ibreak
,
4333 .par
= (const uint32_t[]){
4335 XTENSA_OPTION_DEBUG
,
4337 .op_flags
= XTENSA_OP_PRIVILEGED
,
4339 .name
= "rsr.ibreaka1",
4340 .translate
= translate_rsr
,
4341 .test_exceptions
= test_exceptions_ibreak
,
4342 .par
= (const uint32_t[]){
4344 XTENSA_OPTION_DEBUG
,
4346 .op_flags
= XTENSA_OP_PRIVILEGED
,
4348 .name
= "rsr.ibreakenable",
4349 .translate
= translate_rsr
,
4350 .test_exceptions
= test_exceptions_sr
,
4351 .par
= (const uint32_t[]){
4353 XTENSA_OPTION_DEBUG
,
4355 .op_flags
= XTENSA_OP_PRIVILEGED
,
4357 .name
= "rsr.icount",
4358 .translate
= translate_rsr
,
4359 .test_exceptions
= test_exceptions_sr
,
4360 .par
= (const uint32_t[]){
4362 XTENSA_OPTION_DEBUG
,
4364 .op_flags
= XTENSA_OP_PRIVILEGED
,
4366 .name
= "rsr.icountlevel",
4367 .translate
= translate_rsr
,
4368 .test_exceptions
= test_exceptions_sr
,
4369 .par
= (const uint32_t[]){
4371 XTENSA_OPTION_DEBUG
,
4373 .op_flags
= XTENSA_OP_PRIVILEGED
,
4375 .name
= "rsr.intclear",
4376 .translate
= translate_rsr
,
4377 .test_exceptions
= test_exceptions_sr
,
4378 .par
= (const uint32_t[]){
4380 XTENSA_OPTION_INTERRUPT
,
4382 .op_flags
= XTENSA_OP_PRIVILEGED
,
4384 .name
= "rsr.intenable",
4385 .translate
= translate_rsr
,
4386 .test_exceptions
= test_exceptions_sr
,
4387 .par
= (const uint32_t[]){
4389 XTENSA_OPTION_INTERRUPT
,
4391 .op_flags
= XTENSA_OP_PRIVILEGED
,
4393 .name
= "rsr.interrupt",
4394 .translate
= translate_rsr_ccount
,
4395 .test_exceptions
= test_exceptions_sr
,
4396 .par
= (const uint32_t[]){
4398 XTENSA_OPTION_INTERRUPT
,
4400 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4402 .name
= "rsr.intset",
4403 .translate
= translate_rsr_ccount
,
4404 .test_exceptions
= test_exceptions_sr
,
4405 .par
= (const uint32_t[]){
4407 XTENSA_OPTION_INTERRUPT
,
4409 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4411 .name
= "rsr.itlbcfg",
4412 .translate
= translate_rsr
,
4413 .test_exceptions
= test_exceptions_sr
,
4414 .par
= (const uint32_t[]){
4418 .op_flags
= XTENSA_OP_PRIVILEGED
,
4421 .translate
= translate_rsr
,
4422 .test_exceptions
= test_exceptions_sr
,
4423 .par
= (const uint32_t[]){
4428 .name
= "rsr.lcount",
4429 .translate
= translate_rsr
,
4430 .test_exceptions
= test_exceptions_sr
,
4431 .par
= (const uint32_t[]){
4437 .translate
= translate_rsr
,
4438 .test_exceptions
= test_exceptions_sr
,
4439 .par
= (const uint32_t[]){
4444 .name
= "rsr.litbase",
4445 .translate
= translate_rsr
,
4446 .test_exceptions
= test_exceptions_sr
,
4447 .par
= (const uint32_t[]){
4449 XTENSA_OPTION_EXTENDED_L32R
,
4453 .translate
= translate_rsr
,
4454 .test_exceptions
= test_exceptions_sr
,
4455 .par
= (const uint32_t[]){
4457 XTENSA_OPTION_MAC16
,
4461 .translate
= translate_rsr
,
4462 .test_exceptions
= test_exceptions_sr
,
4463 .par
= (const uint32_t[]){
4465 XTENSA_OPTION_MAC16
,
4469 .translate
= translate_rsr
,
4470 .test_exceptions
= test_exceptions_sr
,
4471 .par
= (const uint32_t[]){
4473 XTENSA_OPTION_MAC16
,
4477 .translate
= translate_rsr
,
4478 .test_exceptions
= test_exceptions_sr
,
4479 .par
= (const uint32_t[]){
4481 XTENSA_OPTION_MAC16
,
4484 .name
= "rsr.memctl",
4485 .translate
= translate_rsr
,
4486 .par
= (const uint32_t[]){MEMCTL
},
4487 .op_flags
= XTENSA_OP_PRIVILEGED
,
4490 .translate
= translate_rsr
,
4491 .test_exceptions
= test_exceptions_sr
,
4492 .par
= (const uint32_t[]){
4494 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4496 .op_flags
= XTENSA_OP_PRIVILEGED
,
4499 .translate
= translate_rsr
,
4500 .test_exceptions
= test_exceptions_sr
,
4501 .par
= (const uint32_t[]){
4503 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4505 .op_flags
= XTENSA_OP_PRIVILEGED
,
4508 .translate
= translate_rsr
,
4509 .test_exceptions
= test_exceptions_sr
,
4510 .par
= (const uint32_t[]){
4512 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4514 .op_flags
= XTENSA_OP_PRIVILEGED
,
4516 .name
= "rsr.mesave",
4517 .translate
= translate_rsr
,
4518 .test_exceptions
= test_exceptions_sr
,
4519 .par
= (const uint32_t[]){
4521 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4523 .op_flags
= XTENSA_OP_PRIVILEGED
,
4526 .translate
= translate_rsr
,
4527 .test_exceptions
= test_exceptions_sr
,
4528 .par
= (const uint32_t[]){
4530 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4532 .op_flags
= XTENSA_OP_PRIVILEGED
,
4534 .name
= "rsr.mevaddr",
4535 .translate
= translate_rsr
,
4536 .test_exceptions
= test_exceptions_sr
,
4537 .par
= (const uint32_t[]){
4539 XTENSA_OPTION_MEMORY_ECC_PARITY
,
4541 .op_flags
= XTENSA_OP_PRIVILEGED
,
4543 .name
= "rsr.misc0",
4544 .translate
= translate_rsr
,
4545 .test_exceptions
= test_exceptions_sr
,
4546 .par
= (const uint32_t[]){
4548 XTENSA_OPTION_MISC_SR
,
4550 .op_flags
= XTENSA_OP_PRIVILEGED
,
4552 .name
= "rsr.misc1",
4553 .translate
= translate_rsr
,
4554 .test_exceptions
= test_exceptions_sr
,
4555 .par
= (const uint32_t[]){
4557 XTENSA_OPTION_MISC_SR
,
4559 .op_flags
= XTENSA_OP_PRIVILEGED
,
4561 .name
= "rsr.misc2",
4562 .translate
= translate_rsr
,
4563 .test_exceptions
= test_exceptions_sr
,
4564 .par
= (const uint32_t[]){
4566 XTENSA_OPTION_MISC_SR
,
4568 .op_flags
= XTENSA_OP_PRIVILEGED
,
4570 .name
= "rsr.misc3",
4571 .translate
= translate_rsr
,
4572 .test_exceptions
= test_exceptions_sr
,
4573 .par
= (const uint32_t[]){
4575 XTENSA_OPTION_MISC_SR
,
4577 .op_flags
= XTENSA_OP_PRIVILEGED
,
4579 .name
= "rsr.mpucfg",
4580 .translate
= translate_rsr
,
4581 .test_exceptions
= test_exceptions_sr
,
4582 .par
= (const uint32_t[]){
4586 .op_flags
= XTENSA_OP_PRIVILEGED
,
4588 .name
= "rsr.mpuenb",
4589 .translate
= translate_rsr
,
4590 .test_exceptions
= test_exceptions_sr
,
4591 .par
= (const uint32_t[]){
4595 .op_flags
= XTENSA_OP_PRIVILEGED
,
4597 .name
= "rsr.prefctl",
4598 .translate
= translate_rsr
,
4599 .par
= (const uint32_t[]){PREFCTL
},
4602 .translate
= translate_rsr
,
4603 .test_exceptions
= test_exceptions_sr
,
4604 .par
= (const uint32_t[]){
4606 XTENSA_OPTION_PROCESSOR_ID
,
4608 .op_flags
= XTENSA_OP_PRIVILEGED
,
4611 .translate
= translate_rsr
,
4612 .test_exceptions
= test_exceptions_sr
,
4613 .par
= (const uint32_t[]){
4615 XTENSA_OPTION_EXCEPTION
,
4617 .op_flags
= XTENSA_OP_PRIVILEGED
,
4619 .name
= "rsr.ptevaddr",
4620 .translate
= translate_rsr_ptevaddr
,
4621 .test_exceptions
= test_exceptions_sr
,
4622 .par
= (const uint32_t[]){
4626 .op_flags
= XTENSA_OP_PRIVILEGED
,
4628 .name
= "rsr.rasid",
4629 .translate
= translate_rsr
,
4630 .test_exceptions
= test_exceptions_sr
,
4631 .par
= (const uint32_t[]){
4635 .op_flags
= XTENSA_OP_PRIVILEGED
,
4638 .translate
= translate_rsr
,
4639 .par
= (const uint32_t[]){SAR
},
4641 .name
= "rsr.scompare1",
4642 .translate
= translate_rsr
,
4643 .test_exceptions
= test_exceptions_sr
,
4644 .par
= (const uint32_t[]){
4646 XTENSA_OPTION_CONDITIONAL_STORE
,
4649 .name
= "rsr.vecbase",
4650 .translate
= translate_rsr
,
4651 .test_exceptions
= test_exceptions_sr
,
4652 .par
= (const uint32_t[]){
4654 XTENSA_OPTION_RELOCATABLE_VECTOR
,
4656 .op_flags
= XTENSA_OP_PRIVILEGED
,
4658 .name
= "rsr.windowbase",
4659 .translate
= translate_rsr
,
4660 .test_exceptions
= test_exceptions_sr
,
4661 .par
= (const uint32_t[]){
4663 XTENSA_OPTION_WINDOWED_REGISTER
,
4665 .op_flags
= XTENSA_OP_PRIVILEGED
,
4667 .name
= "rsr.windowstart",
4668 .translate
= translate_rsr
,
4669 .test_exceptions
= test_exceptions_sr
,
4670 .par
= (const uint32_t[]){
4672 XTENSA_OPTION_WINDOWED_REGISTER
,
4674 .op_flags
= XTENSA_OP_PRIVILEGED
,
4677 .translate
= translate_nop
,
4679 .name
= "rur.expstate",
4680 .translate
= translate_rur
,
4681 .par
= (const uint32_t[]){EXPSTATE
},
4683 .name
= "rur.threadptr",
4684 .translate
= translate_rur
,
4685 .par
= (const uint32_t[]){THREADPTR
},
4688 .translate
= translate_ldst
,
4689 .par
= (const uint32_t[]){MO_TEUW
, false, true},
4690 .op_flags
= XTENSA_OP_STORE
,
4693 .translate
= translate_s32c1i
,
4694 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4697 .translate
= translate_s32e
,
4698 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_STORE
,
4701 .translate
= translate_s32ex
,
4702 .op_flags
= XTENSA_OP_LOAD
| XTENSA_OP_STORE
,
4704 .name
= (const char * const[]) {
4705 "s32i", "s32i.n", "s32nb", NULL
,
4707 .translate
= translate_ldst
,
4708 .par
= (const uint32_t[]){MO_TEUL
, false, true},
4709 .op_flags
= XTENSA_OP_NAME_ARRAY
| XTENSA_OP_STORE
,
4712 .translate
= translate_ldst
,
4713 .par
= (const uint32_t[]){MO_TEUL
, true, true},
4714 .op_flags
= XTENSA_OP_STORE
,
4717 .translate
= translate_ldst
,
4718 .par
= (const uint32_t[]){MO_UB
, false, true},
4719 .op_flags
= XTENSA_OP_STORE
,
4722 .translate
= translate_salt
,
4723 .par
= (const uint32_t[]){TCG_COND_LT
},
4726 .translate
= translate_salt
,
4727 .par
= (const uint32_t[]){TCG_COND_LTU
},
4729 .name
= "setb_expstate",
4730 .translate
= translate_setb_expstate
,
4733 .translate
= translate_sext
,
4736 .translate
= translate_simcall
,
4737 .test_exceptions
= test_exceptions_simcall
,
4738 .op_flags
= XTENSA_OP_PRIVILEGED
,
4741 .translate
= translate_sll
,
4744 .translate
= translate_slli
,
4747 .translate
= translate_sra
,
4750 .translate
= translate_srai
,
4753 .translate
= translate_src
,
4756 .translate
= translate_srl
,
4759 .translate
= translate_srli
,
4762 .translate
= translate_ssa8b
,
4765 .translate
= translate_ssa8l
,
4768 .translate
= translate_ssai
,
4771 .translate
= translate_ssl
,
4774 .translate
= translate_ssr
,
4777 .translate
= translate_sub
,
4780 .translate
= translate_subx
,
4781 .par
= (const uint32_t[]){1},
4784 .translate
= translate_subx
,
4785 .par
= (const uint32_t[]){2},
4788 .translate
= translate_subx
,
4789 .par
= (const uint32_t[]){3},
4792 .op_flags
= XTENSA_OP_SYSCALL
,
4794 .name
= "umul.aa.hh",
4795 .translate
= translate_mac16
,
4796 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HH
, 0},
4798 .name
= "umul.aa.hl",
4799 .translate
= translate_mac16
,
4800 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_HL
, 0},
4802 .name
= "umul.aa.lh",
4803 .translate
= translate_mac16
,
4804 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LH
, 0},
4806 .name
= "umul.aa.ll",
4807 .translate
= translate_mac16
,
4808 .par
= (const uint32_t[]){MAC16_UMUL
, MAC16_LL
, 0},
4811 .translate
= translate_waiti
,
4812 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4815 .translate
= translate_wtlb
,
4816 .par
= (const uint32_t[]){true},
4817 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4820 .translate
= translate_wer
,
4821 .op_flags
= XTENSA_OP_PRIVILEGED
,
4824 .translate
= translate_wtlb
,
4825 .par
= (const uint32_t[]){false},
4826 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4829 .translate
= translate_wptlb
,
4830 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4832 .name
= "wrmsk_expstate",
4833 .translate
= translate_wrmsk_expstate
,
4836 .op_flags
= XTENSA_OP_ILL
,
4839 .op_flags
= XTENSA_OP_ILL
,
4841 .name
= "wsr.acchi",
4842 .translate
= translate_wsr_acchi
,
4843 .test_exceptions
= test_exceptions_sr
,
4844 .par
= (const uint32_t[]){
4846 XTENSA_OPTION_MAC16
,
4849 .name
= "wsr.acclo",
4850 .translate
= translate_wsr
,
4851 .test_exceptions
= test_exceptions_sr
,
4852 .par
= (const uint32_t[]){
4854 XTENSA_OPTION_MAC16
,
4857 .name
= "wsr.atomctl",
4858 .translate
= translate_wsr_mask
,
4859 .test_exceptions
= test_exceptions_sr
,
4860 .par
= (const uint32_t[]){
4862 XTENSA_OPTION_ATOMCTL
,
4865 .op_flags
= XTENSA_OP_PRIVILEGED
,
4868 .translate
= translate_wsr_mask
,
4869 .test_exceptions
= test_exceptions_sr
,
4870 .par
= (const uint32_t[]){
4872 XTENSA_OPTION_BOOLEAN
,
4876 .name
= "wsr.cacheadrdis",
4877 .translate
= translate_wsr_mask
,
4878 .test_exceptions
= test_exceptions_sr
,
4879 .par
= (const uint32_t[]){
4884 .op_flags
= XTENSA_OP_PRIVILEGED
,
4886 .name
= "wsr.cacheattr",
4887 .translate
= translate_wsr
,
4888 .test_exceptions
= test_exceptions_sr
,
4889 .par
= (const uint32_t[]){
4891 XTENSA_OPTION_CACHEATTR
,
4893 .op_flags
= XTENSA_OP_PRIVILEGED
,
4895 .name
= "wsr.ccompare0",
4896 .translate
= translate_wsr_ccompare
,
4897 .test_exceptions
= test_exceptions_ccompare
,
4898 .par
= (const uint32_t[]){
4900 XTENSA_OPTION_TIMER_INTERRUPT
,
4902 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4904 .name
= "wsr.ccompare1",
4905 .translate
= translate_wsr_ccompare
,
4906 .test_exceptions
= test_exceptions_ccompare
,
4907 .par
= (const uint32_t[]){
4909 XTENSA_OPTION_TIMER_INTERRUPT
,
4911 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4913 .name
= "wsr.ccompare2",
4914 .translate
= translate_wsr_ccompare
,
4915 .test_exceptions
= test_exceptions_ccompare
,
4916 .par
= (const uint32_t[]){
4918 XTENSA_OPTION_TIMER_INTERRUPT
,
4920 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4922 .name
= "wsr.ccount",
4923 .translate
= translate_wsr_ccount
,
4924 .test_exceptions
= test_exceptions_sr
,
4925 .par
= (const uint32_t[]){
4927 XTENSA_OPTION_TIMER_INTERRUPT
,
4929 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
4931 .name
= "wsr.configid0",
4932 .op_flags
= XTENSA_OP_ILL
,
4934 .name
= "wsr.configid1",
4935 .op_flags
= XTENSA_OP_ILL
,
4937 .name
= "wsr.cpenable",
4938 .translate
= translate_wsr_mask
,
4939 .test_exceptions
= test_exceptions_sr
,
4940 .par
= (const uint32_t[]){
4942 XTENSA_OPTION_COPROCESSOR
,
4945 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
4947 .name
= "wsr.dbreaka0",
4948 .translate
= translate_wsr_dbreaka
,
4949 .test_exceptions
= test_exceptions_dbreak
,
4950 .par
= (const uint32_t[]){
4952 XTENSA_OPTION_DEBUG
,
4954 .op_flags
= XTENSA_OP_PRIVILEGED
,
4956 .name
= "wsr.dbreaka1",
4957 .translate
= translate_wsr_dbreaka
,
4958 .test_exceptions
= test_exceptions_dbreak
,
4959 .par
= (const uint32_t[]){
4961 XTENSA_OPTION_DEBUG
,
4963 .op_flags
= XTENSA_OP_PRIVILEGED
,
4965 .name
= "wsr.dbreakc0",
4966 .translate
= translate_wsr_dbreakc
,
4967 .test_exceptions
= test_exceptions_dbreak
,
4968 .par
= (const uint32_t[]){
4970 XTENSA_OPTION_DEBUG
,
4972 .op_flags
= XTENSA_OP_PRIVILEGED
,
4974 .name
= "wsr.dbreakc1",
4975 .translate
= translate_wsr_dbreakc
,
4976 .test_exceptions
= test_exceptions_dbreak
,
4977 .par
= (const uint32_t[]){
4979 XTENSA_OPTION_DEBUG
,
4981 .op_flags
= XTENSA_OP_PRIVILEGED
,
4984 .translate
= translate_wsr
,
4985 .test_exceptions
= test_exceptions_sr
,
4986 .par
= (const uint32_t[]){
4988 XTENSA_OPTION_DEBUG
,
4990 .op_flags
= XTENSA_OP_PRIVILEGED
,
4992 .name
= "wsr.debugcause",
4993 .op_flags
= XTENSA_OP_ILL
,
4996 .translate
= translate_wsr
,
4997 .test_exceptions
= test_exceptions_sr
,
4998 .par
= (const uint32_t[]){
5000 XTENSA_OPTION_EXCEPTION
,
5002 .op_flags
= XTENSA_OP_PRIVILEGED
,
5004 .name
= "wsr.dtlbcfg",
5005 .translate
= translate_wsr_mask
,
5006 .test_exceptions
= test_exceptions_sr
,
5007 .par
= (const uint32_t[]){
5012 .op_flags
= XTENSA_OP_PRIVILEGED
,
5015 .translate
= translate_wsr
,
5016 .test_exceptions
= test_exceptions_sr
,
5017 .par
= (const uint32_t[]){
5019 XTENSA_OPTION_EXCEPTION
,
5021 .op_flags
= XTENSA_OP_PRIVILEGED
,
5024 .translate
= translate_wsr
,
5025 .test_exceptions
= test_exceptions_hpi
,
5026 .par
= (const uint32_t[]){
5028 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5030 .op_flags
= XTENSA_OP_PRIVILEGED
,
5033 .translate
= translate_wsr
,
5034 .test_exceptions
= test_exceptions_hpi
,
5035 .par
= (const uint32_t[]){
5037 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5039 .op_flags
= XTENSA_OP_PRIVILEGED
,
5042 .translate
= translate_wsr
,
5043 .test_exceptions
= test_exceptions_hpi
,
5044 .par
= (const uint32_t[]){
5046 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5048 .op_flags
= XTENSA_OP_PRIVILEGED
,
5051 .translate
= translate_wsr
,
5052 .test_exceptions
= test_exceptions_hpi
,
5053 .par
= (const uint32_t[]){
5055 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5057 .op_flags
= XTENSA_OP_PRIVILEGED
,
5060 .translate
= translate_wsr
,
5061 .test_exceptions
= test_exceptions_hpi
,
5062 .par
= (const uint32_t[]){
5064 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5066 .op_flags
= XTENSA_OP_PRIVILEGED
,
5069 .translate
= translate_wsr
,
5070 .test_exceptions
= test_exceptions_hpi
,
5071 .par
= (const uint32_t[]){
5073 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5075 .op_flags
= XTENSA_OP_PRIVILEGED
,
5078 .translate
= translate_wsr
,
5079 .test_exceptions
= test_exceptions_hpi
,
5080 .par
= (const uint32_t[]){
5082 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5084 .op_flags
= XTENSA_OP_PRIVILEGED
,
5087 .translate
= translate_wsr
,
5088 .test_exceptions
= test_exceptions_hpi
,
5089 .par
= (const uint32_t[]){
5091 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5093 .op_flags
= XTENSA_OP_PRIVILEGED
,
5096 .translate
= translate_wsr
,
5097 .test_exceptions
= test_exceptions_hpi
,
5098 .par
= (const uint32_t[]){
5100 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5102 .op_flags
= XTENSA_OP_PRIVILEGED
,
5105 .translate
= translate_wsr
,
5106 .test_exceptions
= test_exceptions_hpi
,
5107 .par
= (const uint32_t[]){
5109 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5111 .op_flags
= XTENSA_OP_PRIVILEGED
,
5114 .translate
= translate_wsr
,
5115 .test_exceptions
= test_exceptions_hpi
,
5116 .par
= (const uint32_t[]){
5118 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5120 .op_flags
= XTENSA_OP_PRIVILEGED
,
5123 .translate
= translate_wsr
,
5124 .test_exceptions
= test_exceptions_hpi
,
5125 .par
= (const uint32_t[]){
5127 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5129 .op_flags
= XTENSA_OP_PRIVILEGED
,
5131 .name
= "wsr.eraccess",
5132 .translate
= translate_wsr_mask
,
5133 .par
= (const uint32_t[]){
5138 .op_flags
= XTENSA_OP_PRIVILEGED
,
5140 .name
= "wsr.exccause",
5141 .translate
= translate_wsr
,
5142 .test_exceptions
= test_exceptions_sr
,
5143 .par
= (const uint32_t[]){
5145 XTENSA_OPTION_EXCEPTION
,
5147 .op_flags
= XTENSA_OP_PRIVILEGED
,
5149 .name
= "wsr.excsave1",
5150 .translate
= translate_wsr
,
5151 .test_exceptions
= test_exceptions_sr
,
5152 .par
= (const uint32_t[]){
5154 XTENSA_OPTION_EXCEPTION
,
5156 .op_flags
= XTENSA_OP_PRIVILEGED
,
5158 .name
= "wsr.excsave2",
5159 .translate
= translate_wsr
,
5160 .test_exceptions
= test_exceptions_hpi
,
5161 .par
= (const uint32_t[]){
5163 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5165 .op_flags
= XTENSA_OP_PRIVILEGED
,
5167 .name
= "wsr.excsave3",
5168 .translate
= translate_wsr
,
5169 .test_exceptions
= test_exceptions_hpi
,
5170 .par
= (const uint32_t[]){
5172 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5174 .op_flags
= XTENSA_OP_PRIVILEGED
,
5176 .name
= "wsr.excsave4",
5177 .translate
= translate_wsr
,
5178 .test_exceptions
= test_exceptions_hpi
,
5179 .par
= (const uint32_t[]){
5181 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5183 .op_flags
= XTENSA_OP_PRIVILEGED
,
5185 .name
= "wsr.excsave5",
5186 .translate
= translate_wsr
,
5187 .test_exceptions
= test_exceptions_hpi
,
5188 .par
= (const uint32_t[]){
5190 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5192 .op_flags
= XTENSA_OP_PRIVILEGED
,
5194 .name
= "wsr.excsave6",
5195 .translate
= translate_wsr
,
5196 .test_exceptions
= test_exceptions_hpi
,
5197 .par
= (const uint32_t[]){
5199 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5201 .op_flags
= XTENSA_OP_PRIVILEGED
,
5203 .name
= "wsr.excsave7",
5204 .translate
= translate_wsr
,
5205 .test_exceptions
= test_exceptions_hpi
,
5206 .par
= (const uint32_t[]){
5208 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5210 .op_flags
= XTENSA_OP_PRIVILEGED
,
5212 .name
= "wsr.excvaddr",
5213 .translate
= translate_wsr
,
5214 .test_exceptions
= test_exceptions_sr
,
5215 .par
= (const uint32_t[]){
5217 XTENSA_OPTION_EXCEPTION
,
5219 .op_flags
= XTENSA_OP_PRIVILEGED
,
5221 .name
= "wsr.ibreaka0",
5222 .translate
= translate_wsr_ibreaka
,
5223 .test_exceptions
= test_exceptions_ibreak
,
5224 .par
= (const uint32_t[]){
5226 XTENSA_OPTION_DEBUG
,
5228 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5230 .name
= "wsr.ibreaka1",
5231 .translate
= translate_wsr_ibreaka
,
5232 .test_exceptions
= test_exceptions_ibreak
,
5233 .par
= (const uint32_t[]){
5235 XTENSA_OPTION_DEBUG
,
5237 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5239 .name
= "wsr.ibreakenable",
5240 .translate
= translate_wsr_ibreakenable
,
5241 .test_exceptions
= test_exceptions_sr
,
5242 .par
= (const uint32_t[]){
5244 XTENSA_OPTION_DEBUG
,
5246 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5248 .name
= "wsr.icount",
5249 .translate
= translate_wsr_icount
,
5250 .test_exceptions
= test_exceptions_sr
,
5251 .par
= (const uint32_t[]){
5253 XTENSA_OPTION_DEBUG
,
5255 .op_flags
= XTENSA_OP_PRIVILEGED
,
5257 .name
= "wsr.icountlevel",
5258 .translate
= translate_wsr_mask
,
5259 .test_exceptions
= test_exceptions_sr
,
5260 .par
= (const uint32_t[]){
5262 XTENSA_OPTION_DEBUG
,
5265 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5267 .name
= "wsr.intclear",
5268 .translate
= translate_wsr_intclear
,
5269 .test_exceptions
= test_exceptions_sr
,
5270 .par
= (const uint32_t[]){
5272 XTENSA_OPTION_INTERRUPT
,
5275 XTENSA_OP_PRIVILEGED
|
5276 XTENSA_OP_EXIT_TB_0
|
5277 XTENSA_OP_CHECK_INTERRUPTS
,
5279 .name
= "wsr.intenable",
5280 .translate
= translate_wsr
,
5281 .test_exceptions
= test_exceptions_sr
,
5282 .par
= (const uint32_t[]){
5284 XTENSA_OPTION_INTERRUPT
,
5287 XTENSA_OP_PRIVILEGED
|
5288 XTENSA_OP_EXIT_TB_0
|
5289 XTENSA_OP_CHECK_INTERRUPTS
,
5291 .name
= "wsr.interrupt",
5292 .translate
= translate_wsr
,
5293 .test_exceptions
= test_exceptions_sr
,
5294 .par
= (const uint32_t[]){
5296 XTENSA_OPTION_INTERRUPT
,
5299 XTENSA_OP_PRIVILEGED
|
5300 XTENSA_OP_EXIT_TB_0
|
5301 XTENSA_OP_CHECK_INTERRUPTS
,
5303 .name
= "wsr.intset",
5304 .translate
= translate_wsr_intset
,
5305 .test_exceptions
= test_exceptions_sr
,
5306 .par
= (const uint32_t[]){
5308 XTENSA_OPTION_INTERRUPT
,
5311 XTENSA_OP_PRIVILEGED
|
5312 XTENSA_OP_EXIT_TB_0
|
5313 XTENSA_OP_CHECK_INTERRUPTS
,
5315 .name
= "wsr.itlbcfg",
5316 .translate
= translate_wsr_mask
,
5317 .test_exceptions
= test_exceptions_sr
,
5318 .par
= (const uint32_t[]){
5323 .op_flags
= XTENSA_OP_PRIVILEGED
,
5326 .translate
= translate_wsr
,
5327 .test_exceptions
= test_exceptions_sr
,
5328 .par
= (const uint32_t[]){
5332 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5334 .name
= "wsr.lcount",
5335 .translate
= translate_wsr
,
5336 .test_exceptions
= test_exceptions_sr
,
5337 .par
= (const uint32_t[]){
5343 .translate
= translate_wsr
,
5344 .test_exceptions
= test_exceptions_sr
,
5345 .par
= (const uint32_t[]){
5349 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5351 .name
= "wsr.litbase",
5352 .translate
= translate_wsr_mask
,
5353 .test_exceptions
= test_exceptions_sr
,
5354 .par
= (const uint32_t[]){
5356 XTENSA_OPTION_EXTENDED_L32R
,
5359 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
5362 .translate
= translate_wsr
,
5363 .test_exceptions
= test_exceptions_sr
,
5364 .par
= (const uint32_t[]){
5366 XTENSA_OPTION_MAC16
,
5370 .translate
= translate_wsr
,
5371 .test_exceptions
= test_exceptions_sr
,
5372 .par
= (const uint32_t[]){
5374 XTENSA_OPTION_MAC16
,
5378 .translate
= translate_wsr
,
5379 .test_exceptions
= test_exceptions_sr
,
5380 .par
= (const uint32_t[]){
5382 XTENSA_OPTION_MAC16
,
5386 .translate
= translate_wsr
,
5387 .test_exceptions
= test_exceptions_sr
,
5388 .par
= (const uint32_t[]){
5390 XTENSA_OPTION_MAC16
,
5393 .name
= "wsr.memctl",
5394 .translate
= translate_wsr_memctl
,
5395 .par
= (const uint32_t[]){MEMCTL
},
5396 .op_flags
= XTENSA_OP_PRIVILEGED
,
5399 .translate
= translate_wsr
,
5400 .test_exceptions
= test_exceptions_sr
,
5401 .par
= (const uint32_t[]){
5403 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5405 .op_flags
= XTENSA_OP_PRIVILEGED
,
5408 .translate
= translate_wsr
,
5409 .test_exceptions
= test_exceptions_sr
,
5410 .par
= (const uint32_t[]){
5412 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5414 .op_flags
= XTENSA_OP_PRIVILEGED
,
5417 .translate
= translate_wsr
,
5418 .test_exceptions
= test_exceptions_sr
,
5419 .par
= (const uint32_t[]){
5421 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5423 .op_flags
= XTENSA_OP_PRIVILEGED
,
5425 .name
= "wsr.mesave",
5426 .translate
= translate_wsr
,
5427 .test_exceptions
= test_exceptions_sr
,
5428 .par
= (const uint32_t[]){
5430 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5432 .op_flags
= XTENSA_OP_PRIVILEGED
,
5435 .translate
= translate_wsr
,
5436 .test_exceptions
= test_exceptions_sr
,
5437 .par
= (const uint32_t[]){
5439 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5441 .op_flags
= XTENSA_OP_PRIVILEGED
,
5443 .name
= "wsr.mevaddr",
5444 .translate
= translate_wsr
,
5445 .test_exceptions
= test_exceptions_sr
,
5446 .par
= (const uint32_t[]){
5448 XTENSA_OPTION_MEMORY_ECC_PARITY
,
5450 .op_flags
= XTENSA_OP_PRIVILEGED
,
5452 .name
= "wsr.misc0",
5453 .translate
= translate_wsr
,
5454 .test_exceptions
= test_exceptions_sr
,
5455 .par
= (const uint32_t[]){
5457 XTENSA_OPTION_MISC_SR
,
5459 .op_flags
= XTENSA_OP_PRIVILEGED
,
5461 .name
= "wsr.misc1",
5462 .translate
= translate_wsr
,
5463 .test_exceptions
= test_exceptions_sr
,
5464 .par
= (const uint32_t[]){
5466 XTENSA_OPTION_MISC_SR
,
5468 .op_flags
= XTENSA_OP_PRIVILEGED
,
5470 .name
= "wsr.misc2",
5471 .translate
= translate_wsr
,
5472 .test_exceptions
= test_exceptions_sr
,
5473 .par
= (const uint32_t[]){
5475 XTENSA_OPTION_MISC_SR
,
5477 .op_flags
= XTENSA_OP_PRIVILEGED
,
5479 .name
= "wsr.misc3",
5480 .translate
= translate_wsr
,
5481 .test_exceptions
= test_exceptions_sr
,
5482 .par
= (const uint32_t[]){
5484 XTENSA_OPTION_MISC_SR
,
5486 .op_flags
= XTENSA_OP_PRIVILEGED
,
5489 .translate
= translate_wsr
,
5490 .test_exceptions
= test_exceptions_sr
,
5491 .par
= (const uint32_t[]){
5493 XTENSA_OPTION_TRACE_PORT
,
5495 .op_flags
= XTENSA_OP_PRIVILEGED
,
5497 .name
= "wsr.mpuenb",
5498 .translate
= translate_wsr_mpuenb
,
5499 .test_exceptions
= test_exceptions_sr
,
5500 .par
= (const uint32_t[]){
5504 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5506 .name
= "wsr.prefctl",
5507 .translate
= translate_wsr
,
5508 .par
= (const uint32_t[]){PREFCTL
},
5511 .op_flags
= XTENSA_OP_ILL
,
5514 .translate
= translate_wsr_ps
,
5515 .test_exceptions
= test_exceptions_sr
,
5516 .par
= (const uint32_t[]){
5518 XTENSA_OPTION_EXCEPTION
,
5521 XTENSA_OP_PRIVILEGED
|
5522 XTENSA_OP_EXIT_TB_M1
|
5523 XTENSA_OP_CHECK_INTERRUPTS
,
5525 .name
= "wsr.ptevaddr",
5526 .translate
= translate_wsr_mask
,
5527 .test_exceptions
= test_exceptions_sr
,
5528 .par
= (const uint32_t[]){
5533 .op_flags
= XTENSA_OP_PRIVILEGED
,
5535 .name
= "wsr.rasid",
5536 .translate
= translate_wsr_rasid
,
5537 .test_exceptions
= test_exceptions_sr
,
5538 .par
= (const uint32_t[]){
5542 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5545 .translate
= translate_wsr_sar
,
5546 .par
= (const uint32_t[]){SAR
},
5548 .name
= "wsr.scompare1",
5549 .translate
= translate_wsr
,
5550 .test_exceptions
= test_exceptions_sr
,
5551 .par
= (const uint32_t[]){
5553 XTENSA_OPTION_CONDITIONAL_STORE
,
5556 .name
= "wsr.vecbase",
5557 .translate
= translate_wsr
,
5558 .test_exceptions
= test_exceptions_sr
,
5559 .par
= (const uint32_t[]){
5561 XTENSA_OPTION_RELOCATABLE_VECTOR
,
5563 .op_flags
= XTENSA_OP_PRIVILEGED
,
5565 .name
= "wsr.windowbase",
5566 .translate
= translate_wsr_windowbase
,
5567 .test_exceptions
= test_exceptions_sr
,
5568 .par
= (const uint32_t[]){
5570 XTENSA_OPTION_WINDOWED_REGISTER
,
5572 .op_flags
= XTENSA_OP_PRIVILEGED
|
5573 XTENSA_OP_EXIT_TB_M1
|
5574 XTENSA_OP_SYNC_REGISTER_WINDOW
,
5576 .name
= "wsr.windowstart",
5577 .translate
= translate_wsr_windowstart
,
5578 .test_exceptions
= test_exceptions_sr
,
5579 .par
= (const uint32_t[]){
5581 XTENSA_OPTION_WINDOWED_REGISTER
,
5583 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5585 .name
= "wur.expstate",
5586 .translate
= translate_wur
,
5587 .par
= (const uint32_t[]){EXPSTATE
},
5589 .name
= "wur.threadptr",
5590 .translate
= translate_wur
,
5591 .par
= (const uint32_t[]){THREADPTR
},
5594 .translate
= translate_xor
,
5597 .translate
= translate_boolean
,
5598 .par
= (const uint32_t[]){BOOLEAN_XOR
},
5601 .op_flags
= XTENSA_OP_ILL
,
5604 .op_flags
= XTENSA_OP_ILL
,
5606 .name
= "xsr.acchi",
5607 .translate
= translate_xsr_acchi
,
5608 .test_exceptions
= test_exceptions_sr
,
5609 .par
= (const uint32_t[]){
5611 XTENSA_OPTION_MAC16
,
5614 .name
= "xsr.acclo",
5615 .translate
= translate_xsr
,
5616 .test_exceptions
= test_exceptions_sr
,
5617 .par
= (const uint32_t[]){
5619 XTENSA_OPTION_MAC16
,
5622 .name
= "xsr.atomctl",
5623 .translate
= translate_xsr_mask
,
5624 .test_exceptions
= test_exceptions_sr
,
5625 .par
= (const uint32_t[]){
5627 XTENSA_OPTION_ATOMCTL
,
5630 .op_flags
= XTENSA_OP_PRIVILEGED
,
5633 .translate
= translate_xsr_mask
,
5634 .test_exceptions
= test_exceptions_sr
,
5635 .par
= (const uint32_t[]){
5637 XTENSA_OPTION_BOOLEAN
,
5641 .name
= "xsr.cacheadrdis",
5642 .translate
= translate_xsr_mask
,
5643 .test_exceptions
= test_exceptions_sr
,
5644 .par
= (const uint32_t[]){
5649 .op_flags
= XTENSA_OP_PRIVILEGED
,
5651 .name
= "xsr.cacheattr",
5652 .translate
= translate_xsr
,
5653 .test_exceptions
= test_exceptions_sr
,
5654 .par
= (const uint32_t[]){
5656 XTENSA_OPTION_CACHEATTR
,
5658 .op_flags
= XTENSA_OP_PRIVILEGED
,
5660 .name
= "xsr.ccompare0",
5661 .translate
= translate_xsr_ccompare
,
5662 .test_exceptions
= test_exceptions_ccompare
,
5663 .par
= (const uint32_t[]){
5665 XTENSA_OPTION_TIMER_INTERRUPT
,
5667 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5669 .name
= "xsr.ccompare1",
5670 .translate
= translate_xsr_ccompare
,
5671 .test_exceptions
= test_exceptions_ccompare
,
5672 .par
= (const uint32_t[]){
5674 XTENSA_OPTION_TIMER_INTERRUPT
,
5676 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5678 .name
= "xsr.ccompare2",
5679 .translate
= translate_xsr_ccompare
,
5680 .test_exceptions
= test_exceptions_ccompare
,
5681 .par
= (const uint32_t[]){
5683 XTENSA_OPTION_TIMER_INTERRUPT
,
5685 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5687 .name
= "xsr.ccount",
5688 .translate
= translate_xsr_ccount
,
5689 .test_exceptions
= test_exceptions_sr
,
5690 .par
= (const uint32_t[]){
5692 XTENSA_OPTION_TIMER_INTERRUPT
,
5694 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5696 .name
= "xsr.configid0",
5697 .op_flags
= XTENSA_OP_ILL
,
5699 .name
= "xsr.configid1",
5700 .op_flags
= XTENSA_OP_ILL
,
5702 .name
= "xsr.cpenable",
5703 .translate
= translate_xsr_mask
,
5704 .test_exceptions
= test_exceptions_sr
,
5705 .par
= (const uint32_t[]){
5707 XTENSA_OPTION_COPROCESSOR
,
5710 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
5712 .name
= "xsr.dbreaka0",
5713 .translate
= translate_xsr_dbreaka
,
5714 .test_exceptions
= test_exceptions_dbreak
,
5715 .par
= (const uint32_t[]){
5717 XTENSA_OPTION_DEBUG
,
5719 .op_flags
= XTENSA_OP_PRIVILEGED
,
5721 .name
= "xsr.dbreaka1",
5722 .translate
= translate_xsr_dbreaka
,
5723 .test_exceptions
= test_exceptions_dbreak
,
5724 .par
= (const uint32_t[]){
5726 XTENSA_OPTION_DEBUG
,
5728 .op_flags
= XTENSA_OP_PRIVILEGED
,
5730 .name
= "xsr.dbreakc0",
5731 .translate
= translate_xsr_dbreakc
,
5732 .test_exceptions
= test_exceptions_dbreak
,
5733 .par
= (const uint32_t[]){
5735 XTENSA_OPTION_DEBUG
,
5737 .op_flags
= XTENSA_OP_PRIVILEGED
,
5739 .name
= "xsr.dbreakc1",
5740 .translate
= translate_xsr_dbreakc
,
5741 .test_exceptions
= test_exceptions_dbreak
,
5742 .par
= (const uint32_t[]){
5744 XTENSA_OPTION_DEBUG
,
5746 .op_flags
= XTENSA_OP_PRIVILEGED
,
5749 .translate
= translate_xsr
,
5750 .test_exceptions
= test_exceptions_sr
,
5751 .par
= (const uint32_t[]){
5753 XTENSA_OPTION_DEBUG
,
5755 .op_flags
= XTENSA_OP_PRIVILEGED
,
5757 .name
= "xsr.debugcause",
5758 .op_flags
= XTENSA_OP_ILL
,
5761 .translate
= translate_xsr
,
5762 .test_exceptions
= test_exceptions_sr
,
5763 .par
= (const uint32_t[]){
5765 XTENSA_OPTION_EXCEPTION
,
5767 .op_flags
= XTENSA_OP_PRIVILEGED
,
5769 .name
= "xsr.dtlbcfg",
5770 .translate
= translate_xsr_mask
,
5771 .test_exceptions
= test_exceptions_sr
,
5772 .par
= (const uint32_t[]){
5777 .op_flags
= XTENSA_OP_PRIVILEGED
,
5780 .translate
= translate_xsr
,
5781 .test_exceptions
= test_exceptions_sr
,
5782 .par
= (const uint32_t[]){
5784 XTENSA_OPTION_EXCEPTION
,
5786 .op_flags
= XTENSA_OP_PRIVILEGED
,
5789 .translate
= translate_xsr
,
5790 .test_exceptions
= test_exceptions_hpi
,
5791 .par
= (const uint32_t[]){
5793 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5795 .op_flags
= XTENSA_OP_PRIVILEGED
,
5798 .translate
= translate_xsr
,
5799 .test_exceptions
= test_exceptions_hpi
,
5800 .par
= (const uint32_t[]){
5802 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5804 .op_flags
= XTENSA_OP_PRIVILEGED
,
5807 .translate
= translate_xsr
,
5808 .test_exceptions
= test_exceptions_hpi
,
5809 .par
= (const uint32_t[]){
5811 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5813 .op_flags
= XTENSA_OP_PRIVILEGED
,
5816 .translate
= translate_xsr
,
5817 .test_exceptions
= test_exceptions_hpi
,
5818 .par
= (const uint32_t[]){
5820 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5822 .op_flags
= XTENSA_OP_PRIVILEGED
,
5825 .translate
= translate_xsr
,
5826 .test_exceptions
= test_exceptions_hpi
,
5827 .par
= (const uint32_t[]){
5829 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5831 .op_flags
= XTENSA_OP_PRIVILEGED
,
5834 .translate
= translate_xsr
,
5835 .test_exceptions
= test_exceptions_hpi
,
5836 .par
= (const uint32_t[]){
5838 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5840 .op_flags
= XTENSA_OP_PRIVILEGED
,
5843 .translate
= translate_xsr
,
5844 .test_exceptions
= test_exceptions_hpi
,
5845 .par
= (const uint32_t[]){
5847 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5849 .op_flags
= XTENSA_OP_PRIVILEGED
,
5852 .translate
= translate_xsr
,
5853 .test_exceptions
= test_exceptions_hpi
,
5854 .par
= (const uint32_t[]){
5856 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5858 .op_flags
= XTENSA_OP_PRIVILEGED
,
5861 .translate
= translate_xsr
,
5862 .test_exceptions
= test_exceptions_hpi
,
5863 .par
= (const uint32_t[]){
5865 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5867 .op_flags
= XTENSA_OP_PRIVILEGED
,
5870 .translate
= translate_xsr
,
5871 .test_exceptions
= test_exceptions_hpi
,
5872 .par
= (const uint32_t[]){
5874 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5876 .op_flags
= XTENSA_OP_PRIVILEGED
,
5879 .translate
= translate_xsr
,
5880 .test_exceptions
= test_exceptions_hpi
,
5881 .par
= (const uint32_t[]){
5883 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5885 .op_flags
= XTENSA_OP_PRIVILEGED
,
5888 .translate
= translate_xsr
,
5889 .test_exceptions
= test_exceptions_hpi
,
5890 .par
= (const uint32_t[]){
5892 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5894 .op_flags
= XTENSA_OP_PRIVILEGED
,
5896 .name
= "xsr.eraccess",
5897 .translate
= translate_xsr_mask
,
5898 .par
= (const uint32_t[]){
5903 .op_flags
= XTENSA_OP_PRIVILEGED
,
5905 .name
= "xsr.exccause",
5906 .translate
= translate_xsr
,
5907 .test_exceptions
= test_exceptions_sr
,
5908 .par
= (const uint32_t[]){
5910 XTENSA_OPTION_EXCEPTION
,
5912 .op_flags
= XTENSA_OP_PRIVILEGED
,
5914 .name
= "xsr.excsave1",
5915 .translate
= translate_xsr
,
5916 .test_exceptions
= test_exceptions_sr
,
5917 .par
= (const uint32_t[]){
5919 XTENSA_OPTION_EXCEPTION
,
5921 .op_flags
= XTENSA_OP_PRIVILEGED
,
5923 .name
= "xsr.excsave2",
5924 .translate
= translate_xsr
,
5925 .test_exceptions
= test_exceptions_hpi
,
5926 .par
= (const uint32_t[]){
5928 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5930 .op_flags
= XTENSA_OP_PRIVILEGED
,
5932 .name
= "xsr.excsave3",
5933 .translate
= translate_xsr
,
5934 .test_exceptions
= test_exceptions_hpi
,
5935 .par
= (const uint32_t[]){
5937 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5939 .op_flags
= XTENSA_OP_PRIVILEGED
,
5941 .name
= "xsr.excsave4",
5942 .translate
= translate_xsr
,
5943 .test_exceptions
= test_exceptions_hpi
,
5944 .par
= (const uint32_t[]){
5946 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5948 .op_flags
= XTENSA_OP_PRIVILEGED
,
5950 .name
= "xsr.excsave5",
5951 .translate
= translate_xsr
,
5952 .test_exceptions
= test_exceptions_hpi
,
5953 .par
= (const uint32_t[]){
5955 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5957 .op_flags
= XTENSA_OP_PRIVILEGED
,
5959 .name
= "xsr.excsave6",
5960 .translate
= translate_xsr
,
5961 .test_exceptions
= test_exceptions_hpi
,
5962 .par
= (const uint32_t[]){
5964 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5966 .op_flags
= XTENSA_OP_PRIVILEGED
,
5968 .name
= "xsr.excsave7",
5969 .translate
= translate_xsr
,
5970 .test_exceptions
= test_exceptions_hpi
,
5971 .par
= (const uint32_t[]){
5973 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT
,
5975 .op_flags
= XTENSA_OP_PRIVILEGED
,
5977 .name
= "xsr.excvaddr",
5978 .translate
= translate_xsr
,
5979 .test_exceptions
= test_exceptions_sr
,
5980 .par
= (const uint32_t[]){
5982 XTENSA_OPTION_EXCEPTION
,
5984 .op_flags
= XTENSA_OP_PRIVILEGED
,
5986 .name
= "xsr.ibreaka0",
5987 .translate
= translate_xsr_ibreaka
,
5988 .test_exceptions
= test_exceptions_ibreak
,
5989 .par
= (const uint32_t[]){
5991 XTENSA_OPTION_DEBUG
,
5993 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
5995 .name
= "xsr.ibreaka1",
5996 .translate
= translate_xsr_ibreaka
,
5997 .test_exceptions
= test_exceptions_ibreak
,
5998 .par
= (const uint32_t[]){
6000 XTENSA_OPTION_DEBUG
,
6002 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
6004 .name
= "xsr.ibreakenable",
6005 .translate
= translate_xsr_ibreakenable
,
6006 .test_exceptions
= test_exceptions_sr
,
6007 .par
= (const uint32_t[]){
6009 XTENSA_OPTION_DEBUG
,
6011 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_0
,
6013 .name
= "xsr.icount",
6014 .translate
= translate_xsr_icount
,
6015 .test_exceptions
= test_exceptions_sr
,
6016 .par
= (const uint32_t[]){
6018 XTENSA_OPTION_DEBUG
,
6020 .op_flags
= XTENSA_OP_PRIVILEGED
,
6022 .name
= "xsr.icountlevel",
6023 .translate
= translate_xsr_mask
,
6024 .test_exceptions
= test_exceptions_sr
,
6025 .par
= (const uint32_t[]){
6027 XTENSA_OPTION_DEBUG
,
6030 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6032 .name
= "xsr.intclear",
6033 .op_flags
= XTENSA_OP_ILL
,
6035 .name
= "xsr.intenable",
6036 .translate
= translate_xsr
,
6037 .test_exceptions
= test_exceptions_sr
,
6038 .par
= (const uint32_t[]){
6040 XTENSA_OPTION_INTERRUPT
,
6043 XTENSA_OP_PRIVILEGED
|
6044 XTENSA_OP_EXIT_TB_0
|
6045 XTENSA_OP_CHECK_INTERRUPTS
,
6047 .name
= "xsr.interrupt",
6048 .op_flags
= XTENSA_OP_ILL
,
6050 .name
= "xsr.intset",
6051 .op_flags
= XTENSA_OP_ILL
,
6053 .name
= "xsr.itlbcfg",
6054 .translate
= translate_xsr_mask
,
6055 .test_exceptions
= test_exceptions_sr
,
6056 .par
= (const uint32_t[]){
6061 .op_flags
= XTENSA_OP_PRIVILEGED
,
6064 .translate
= translate_xsr
,
6065 .test_exceptions
= test_exceptions_sr
,
6066 .par
= (const uint32_t[]){
6070 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6072 .name
= "xsr.lcount",
6073 .translate
= translate_xsr
,
6074 .test_exceptions
= test_exceptions_sr
,
6075 .par
= (const uint32_t[]){
6081 .translate
= translate_xsr
,
6082 .test_exceptions
= test_exceptions_sr
,
6083 .par
= (const uint32_t[]){
6087 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6089 .name
= "xsr.litbase",
6090 .translate
= translate_xsr_mask
,
6091 .test_exceptions
= test_exceptions_sr
,
6092 .par
= (const uint32_t[]){
6094 XTENSA_OPTION_EXTENDED_L32R
,
6097 .op_flags
= XTENSA_OP_EXIT_TB_M1
,
6100 .translate
= translate_xsr
,
6101 .test_exceptions
= test_exceptions_sr
,
6102 .par
= (const uint32_t[]){
6104 XTENSA_OPTION_MAC16
,
6108 .translate
= translate_xsr
,
6109 .test_exceptions
= test_exceptions_sr
,
6110 .par
= (const uint32_t[]){
6112 XTENSA_OPTION_MAC16
,
6116 .translate
= translate_xsr
,
6117 .test_exceptions
= test_exceptions_sr
,
6118 .par
= (const uint32_t[]){
6120 XTENSA_OPTION_MAC16
,
6124 .translate
= translate_xsr
,
6125 .test_exceptions
= test_exceptions_sr
,
6126 .par
= (const uint32_t[]){
6128 XTENSA_OPTION_MAC16
,
6131 .name
= "xsr.memctl",
6132 .translate
= translate_xsr_memctl
,
6133 .par
= (const uint32_t[]){MEMCTL
},
6134 .op_flags
= XTENSA_OP_PRIVILEGED
,
6137 .translate
= translate_xsr
,
6138 .test_exceptions
= test_exceptions_sr
,
6139 .par
= (const uint32_t[]){
6141 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6143 .op_flags
= XTENSA_OP_PRIVILEGED
,
6146 .translate
= translate_xsr
,
6147 .test_exceptions
= test_exceptions_sr
,
6148 .par
= (const uint32_t[]){
6150 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6152 .op_flags
= XTENSA_OP_PRIVILEGED
,
6155 .translate
= translate_xsr
,
6156 .test_exceptions
= test_exceptions_sr
,
6157 .par
= (const uint32_t[]){
6159 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6161 .op_flags
= XTENSA_OP_PRIVILEGED
,
6163 .name
= "xsr.mesave",
6164 .translate
= translate_xsr
,
6165 .test_exceptions
= test_exceptions_sr
,
6166 .par
= (const uint32_t[]){
6168 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6170 .op_flags
= XTENSA_OP_PRIVILEGED
,
6173 .translate
= translate_xsr
,
6174 .test_exceptions
= test_exceptions_sr
,
6175 .par
= (const uint32_t[]){
6177 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6179 .op_flags
= XTENSA_OP_PRIVILEGED
,
6181 .name
= "xsr.mevaddr",
6182 .translate
= translate_xsr
,
6183 .test_exceptions
= test_exceptions_sr
,
6184 .par
= (const uint32_t[]){
6186 XTENSA_OPTION_MEMORY_ECC_PARITY
,
6188 .op_flags
= XTENSA_OP_PRIVILEGED
,
6190 .name
= "xsr.misc0",
6191 .translate
= translate_xsr
,
6192 .test_exceptions
= test_exceptions_sr
,
6193 .par
= (const uint32_t[]){
6195 XTENSA_OPTION_MISC_SR
,
6197 .op_flags
= XTENSA_OP_PRIVILEGED
,
6199 .name
= "xsr.misc1",
6200 .translate
= translate_xsr
,
6201 .test_exceptions
= test_exceptions_sr
,
6202 .par
= (const uint32_t[]){
6204 XTENSA_OPTION_MISC_SR
,
6206 .op_flags
= XTENSA_OP_PRIVILEGED
,
6208 .name
= "xsr.misc2",
6209 .translate
= translate_xsr
,
6210 .test_exceptions
= test_exceptions_sr
,
6211 .par
= (const uint32_t[]){
6213 XTENSA_OPTION_MISC_SR
,
6215 .op_flags
= XTENSA_OP_PRIVILEGED
,
6217 .name
= "xsr.misc3",
6218 .translate
= translate_xsr
,
6219 .test_exceptions
= test_exceptions_sr
,
6220 .par
= (const uint32_t[]){
6222 XTENSA_OPTION_MISC_SR
,
6224 .op_flags
= XTENSA_OP_PRIVILEGED
,
6226 .name
= "xsr.mpuenb",
6227 .translate
= translate_xsr_mpuenb
,
6228 .test_exceptions
= test_exceptions_sr
,
6229 .par
= (const uint32_t[]){
6233 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6235 .name
= "xsr.prefctl",
6236 .translate
= translate_xsr
,
6237 .par
= (const uint32_t[]){PREFCTL
},
6240 .op_flags
= XTENSA_OP_ILL
,
6243 .translate
= translate_xsr_ps
,
6244 .test_exceptions
= test_exceptions_sr
,
6245 .par
= (const uint32_t[]){
6247 XTENSA_OPTION_EXCEPTION
,
6250 XTENSA_OP_PRIVILEGED
|
6251 XTENSA_OP_EXIT_TB_M1
|
6252 XTENSA_OP_CHECK_INTERRUPTS
,
6254 .name
= "xsr.ptevaddr",
6255 .translate
= translate_xsr_mask
,
6256 .test_exceptions
= test_exceptions_sr
,
6257 .par
= (const uint32_t[]){
6262 .op_flags
= XTENSA_OP_PRIVILEGED
,
6264 .name
= "xsr.rasid",
6265 .translate
= translate_xsr_rasid
,
6266 .test_exceptions
= test_exceptions_sr
,
6267 .par
= (const uint32_t[]){
6271 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6274 .translate
= translate_xsr_sar
,
6275 .par
= (const uint32_t[]){SAR
},
6277 .name
= "xsr.scompare1",
6278 .translate
= translate_xsr
,
6279 .test_exceptions
= test_exceptions_sr
,
6280 .par
= (const uint32_t[]){
6282 XTENSA_OPTION_CONDITIONAL_STORE
,
6285 .name
= "xsr.vecbase",
6286 .translate
= translate_xsr
,
6287 .test_exceptions
= test_exceptions_sr
,
6288 .par
= (const uint32_t[]){
6290 XTENSA_OPTION_RELOCATABLE_VECTOR
,
6292 .op_flags
= XTENSA_OP_PRIVILEGED
,
6294 .name
= "xsr.windowbase",
6295 .translate
= translate_xsr_windowbase
,
6296 .test_exceptions
= test_exceptions_sr
,
6297 .par
= (const uint32_t[]){
6299 XTENSA_OPTION_WINDOWED_REGISTER
,
6301 .op_flags
= XTENSA_OP_PRIVILEGED
|
6302 XTENSA_OP_EXIT_TB_M1
|
6303 XTENSA_OP_SYNC_REGISTER_WINDOW
,
6305 .name
= "xsr.windowstart",
6306 .translate
= translate_xsr_windowstart
,
6307 .test_exceptions
= test_exceptions_sr
,
6308 .par
= (const uint32_t[]){
6310 XTENSA_OPTION_WINDOWED_REGISTER
,
6312 .op_flags
= XTENSA_OP_PRIVILEGED
| XTENSA_OP_EXIT_TB_M1
,
6316 const XtensaOpcodeTranslators xtensa_core_opcodes
= {
6317 .num_opcodes
= ARRAY_SIZE(core_ops
),
6322 static inline void get_f32_o1_i3(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6323 int o0
, int i0
, int i1
, int i2
)
6325 if ((i0
>= 0 && arg
[i0
].num_bits
== 64) ||
6326 (o0
>= 0 && arg
[o0
].num_bits
== 64)) {
6328 arg32
[o0
].out
= tcg_temp_new_i32();
6331 arg32
[i0
].in
= tcg_temp_new_i32();
6332 tcg_gen_extrl_i64_i32(arg32
[i0
].in
, arg
[i0
].in
);
6335 arg32
[i1
].in
= tcg_temp_new_i32();
6336 tcg_gen_extrl_i64_i32(arg32
[i1
].in
, arg
[i1
].in
);
6339 arg32
[i2
].in
= tcg_temp_new_i32();
6340 tcg_gen_extrl_i64_i32(arg32
[i2
].in
, arg
[i2
].in
);
6344 arg32
[o0
].out
= arg
[o0
].out
;
6347 arg32
[i0
].in
= arg
[i0
].in
;
6350 arg32
[i1
].in
= arg
[i1
].in
;
6353 arg32
[i2
].in
= arg
[i2
].in
;
6358 static inline void put_f32_o1_i3(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6359 int o0
, int i0
, int i1
, int i2
)
6361 if ((i0
>= 0 && arg
[i0
].num_bits
== 64) ||
6362 (o0
>= 0 && arg
[o0
].num_bits
== 64)) {
6364 tcg_gen_extu_i32_i64(arg
[o0
].out
, arg32
[o0
].out
);
6365 tcg_temp_free_i32(arg32
[o0
].out
);
6368 tcg_temp_free_i32(arg32
[i0
].in
);
6371 tcg_temp_free_i32(arg32
[i1
].in
);
6374 tcg_temp_free_i32(arg32
[i2
].in
);
6379 static inline void get_f32_o1_i2(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6380 int o0
, int i0
, int i1
)
6382 get_f32_o1_i3(arg
, arg32
, o0
, i0
, i1
, -1);
6385 static inline void put_f32_o1_i2(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6386 int o0
, int i0
, int i1
)
6388 put_f32_o1_i3(arg
, arg32
, o0
, i0
, i1
, -1);
6391 static inline void get_f32_o1_i1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6394 get_f32_o1_i2(arg
, arg32
, o0
, i0
, -1);
6397 static inline void put_f32_o1_i1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6400 put_f32_o1_i2(arg
, arg32
, o0
, i0
, -1);
6403 static inline void get_f32_o1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6406 get_f32_o1_i1(arg
, arg32
, o0
, -1);
6409 static inline void put_f32_o1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6412 put_f32_o1_i1(arg
, arg32
, o0
, -1);
6415 static inline void get_f32_i2(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6418 get_f32_o1_i2(arg
, arg32
, -1, i0
, i1
);
6421 static inline void put_f32_i2(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6424 put_f32_o1_i2(arg
, arg32
, -1, i0
, i1
);
6427 static inline void get_f32_i1(const OpcodeArg
*arg
, OpcodeArg
*arg32
,
6430 get_f32_i2(arg
, arg32
, i0
, -1);
6433 static inline void put_f32_i1(const OpcodeArg
*arg
, const OpcodeArg
*arg32
,
6436 put_f32_i2(arg
, arg32
, i0
, -1);
6440 static void translate_abs_d(DisasContext
*dc
, const OpcodeArg arg
[],
6441 const uint32_t par
[])
6443 gen_helper_abs_d(arg
[0].out
, arg
[1].in
);
6446 static void translate_abs_s(DisasContext
*dc
, const OpcodeArg arg
[],
6447 const uint32_t par
[])
6451 get_f32_o1_i1(arg
, arg32
, 0, 1);
6452 gen_helper_abs_s(arg32
[0].out
, arg32
[1].in
);
6453 put_f32_o1_i1(arg
, arg32
, 0, 1);
6456 static void translate_fpu2k_add_s(DisasContext
*dc
, const OpcodeArg arg
[],
6457 const uint32_t par
[])
6459 gen_helper_fpu2k_add_s(arg
[0].out
, cpu_env
,
6460 arg
[1].in
, arg
[2].in
);
6473 static void translate_compare_d(DisasContext
*dc
, const OpcodeArg arg
[],
6474 const uint32_t par
[])
6476 static void (* const helper
[])(TCGv_i32 res
, TCGv_env env
,
6477 TCGv_i64 s
, TCGv_i64 t
) = {
6478 [COMPARE_UN
] = gen_helper_un_d
,
6479 [COMPARE_OEQ
] = gen_helper_oeq_d
,
6480 [COMPARE_UEQ
] = gen_helper_ueq_d
,
6481 [COMPARE_OLT
] = gen_helper_olt_d
,
6482 [COMPARE_ULT
] = gen_helper_ult_d
,
6483 [COMPARE_OLE
] = gen_helper_ole_d
,
6484 [COMPARE_ULE
] = gen_helper_ule_d
,
6486 TCGv_i32 zero
= tcg_const_i32(0);
6487 TCGv_i32 res
= tcg_temp_new_i32();
6488 TCGv_i32 set_br
= tcg_temp_new_i32();
6489 TCGv_i32 clr_br
= tcg_temp_new_i32();
6491 tcg_gen_ori_i32(set_br
, arg
[0].in
, 1 << arg
[0].imm
);
6492 tcg_gen_andi_i32(clr_br
, arg
[0].in
, ~(1 << arg
[0].imm
));
6494 helper
[par
[0]](res
, cpu_env
, arg
[1].in
, arg
[2].in
);
6495 tcg_gen_movcond_i32(TCG_COND_NE
,
6496 arg
[0].out
, res
, zero
,
6498 tcg_temp_free(zero
);
6500 tcg_temp_free(set_br
);
6501 tcg_temp_free(clr_br
);
6504 static void translate_compare_s(DisasContext
*dc
, const OpcodeArg arg
[],
6505 const uint32_t par
[])
6507 static void (* const helper
[])(TCGv_i32 res
, TCGv_env env
,
6508 TCGv_i32 s
, TCGv_i32 t
) = {
6509 [COMPARE_UN
] = gen_helper_un_s
,
6510 [COMPARE_OEQ
] = gen_helper_oeq_s
,
6511 [COMPARE_UEQ
] = gen_helper_ueq_s
,
6512 [COMPARE_OLT
] = gen_helper_olt_s
,
6513 [COMPARE_ULT
] = gen_helper_ult_s
,
6514 [COMPARE_OLE
] = gen_helper_ole_s
,
6515 [COMPARE_ULE
] = gen_helper_ule_s
,
6518 TCGv_i32 zero
= tcg_const_i32(0);
6519 TCGv_i32 res
= tcg_temp_new_i32();
6520 TCGv_i32 set_br
= tcg_temp_new_i32();
6521 TCGv_i32 clr_br
= tcg_temp_new_i32();
6523 tcg_gen_ori_i32(set_br
, arg
[0].in
, 1 << arg
[0].imm
);
6524 tcg_gen_andi_i32(clr_br
, arg
[0].in
, ~(1 << arg
[0].imm
));
6526 get_f32_i2(arg
, arg32
, 1, 2);
6527 helper
[par
[0]](res
, cpu_env
, arg32
[1].in
, arg32
[2].in
);
6528 tcg_gen_movcond_i32(TCG_COND_NE
,
6529 arg
[0].out
, res
, zero
,
6531 put_f32_i2(arg
, arg32
, 1, 2);
6532 tcg_temp_free(zero
);
6534 tcg_temp_free(set_br
);
6535 tcg_temp_free(clr_br
);
6538 static void translate_const_d(DisasContext
*dc
, const OpcodeArg arg
[],
6539 const uint32_t par
[])
6541 static const uint64_t v
[] = {
6542 UINT64_C(0x0000000000000000),
6543 UINT64_C(0x3ff0000000000000),
6544 UINT64_C(0x4000000000000000),
6545 UINT64_C(0x3fe0000000000000),
6548 tcg_gen_movi_i64(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6549 if (arg
[1].imm
>= ARRAY_SIZE(v
)) {
6550 qemu_log_mask(LOG_GUEST_ERROR
,
6551 "const.d f%d, #%d, immediate value is reserved\n",
6552 arg
[0].imm
, arg
[1].imm
);
6556 static void translate_const_s(DisasContext
*dc
, const OpcodeArg arg
[],
6557 const uint32_t par
[])
6559 static const uint32_t v
[] = {
6566 if (arg
[0].num_bits
== 32) {
6567 tcg_gen_movi_i32(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6569 tcg_gen_movi_i64(arg
[0].out
, v
[arg
[1].imm
% ARRAY_SIZE(v
)]);
6571 if (arg
[1].imm
>= ARRAY_SIZE(v
)) {
6572 qemu_log_mask(LOG_GUEST_ERROR
,
6573 "const.s f%d, #%d, immediate value is reserved\n",
6574 arg
[0].imm
, arg
[1].imm
);
6578 static void translate_float_d(DisasContext
*dc
, const OpcodeArg arg
[],
6579 const uint32_t par
[])
6581 TCGv_i32 scale
= tcg_const_i32(-arg
[2].imm
);
6584 gen_helper_uitof_d(arg
[0].out
, cpu_env
, arg
[1].in
, scale
);
6586 gen_helper_itof_d(arg
[0].out
, cpu_env
, arg
[1].in
, scale
);
6588 tcg_temp_free(scale
);
6591 static void translate_float_s(DisasContext
*dc
, const OpcodeArg arg
[],
6592 const uint32_t par
[])
6594 TCGv_i32 scale
= tcg_const_i32(-arg
[2].imm
);
6597 get_f32_o1(arg
, arg32
, 0);
6599 gen_helper_uitof_s(arg32
[0].out
, cpu_env
, arg
[1].in
, scale
);
6601 gen_helper_itof_s(arg32
[0].out
, cpu_env
, arg
[1].in
, scale
);
6603 put_f32_o1(arg
, arg32
, 0);
6604 tcg_temp_free(scale
);
6607 static void translate_ftoi_d(DisasContext
*dc
, const OpcodeArg arg
[],
6608 const uint32_t par
[])
6610 TCGv_i32 rounding_mode
= tcg_const_i32(par
[0]);
6611 TCGv_i32 scale
= tcg_const_i32(arg
[2].imm
);
6614 gen_helper_ftoui_d(arg
[0].out
, cpu_env
, arg
[1].in
,
6615 rounding_mode
, scale
);
6617 gen_helper_ftoi_d(arg
[0].out
, cpu_env
, arg
[1].in
,
6618 rounding_mode
, scale
);
6620 tcg_temp_free(rounding_mode
);
6621 tcg_temp_free(scale
);
6624 static void translate_ftoi_s(DisasContext
*dc
, const OpcodeArg arg
[],
6625 const uint32_t par
[])
6627 TCGv_i32 rounding_mode
= tcg_const_i32(par
[0]);
6628 TCGv_i32 scale
= tcg_const_i32(arg
[2].imm
);
6631 get_f32_i1(arg
, arg32
, 1);
6633 gen_helper_ftoui_s(arg
[0].out
, cpu_env
, arg32
[1].in
,
6634 rounding_mode
, scale
);
6636 gen_helper_ftoi_s(arg
[0].out
, cpu_env
, arg32
[1].in
,
6637 rounding_mode
, scale
);
6639 put_f32_i1(arg
, arg32
, 1);
6640 tcg_temp_free(rounding_mode
);
6641 tcg_temp_free(scale
);
6644 static void translate_ldsti(DisasContext
*dc
, const OpcodeArg arg
[],
6645 const uint32_t par
[])
6647 TCGv_i32 addr
= tcg_temp_new_i32();
6649 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
6650 gen_load_store_alignment(dc
, 2, addr
, false);
6652 tcg_gen_qemu_st32(arg
[0].in
, addr
, dc
->cring
);
6654 tcg_gen_qemu_ld32u(arg
[0].out
, addr
, dc
->cring
);
6657 tcg_gen_mov_i32(arg
[1].out
, addr
);
6659 tcg_temp_free(addr
);
6662 static void translate_ldstx(DisasContext
*dc
, const OpcodeArg arg
[],
6663 const uint32_t par
[])
6665 TCGv_i32 addr
= tcg_temp_new_i32();
6667 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
6668 gen_load_store_alignment(dc
, 2, addr
, false);
6670 tcg_gen_qemu_st32(arg
[0].in
, addr
, dc
->cring
);
6672 tcg_gen_qemu_ld32u(arg
[0].out
, addr
, dc
->cring
);
6675 tcg_gen_mov_i32(arg
[1].out
, addr
);
6677 tcg_temp_free(addr
);
6680 static void translate_fpu2k_madd_s(DisasContext
*dc
, const OpcodeArg arg
[],
6681 const uint32_t par
[])
6683 gen_helper_fpu2k_madd_s(arg
[0].out
, cpu_env
,
6684 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6687 static void translate_mov_d(DisasContext
*dc
, const OpcodeArg arg
[],
6688 const uint32_t par
[])
6690 tcg_gen_mov_i64(arg
[0].out
, arg
[1].in
);
6693 static void translate_mov_s(DisasContext
*dc
, const OpcodeArg arg
[],
6694 const uint32_t par
[])
6696 if (arg
[0].num_bits
== 32) {
6697 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6699 tcg_gen_mov_i64(arg
[0].out
, arg
[1].in
);
6703 static void translate_movcond_d(DisasContext
*dc
, const OpcodeArg arg
[],
6704 const uint32_t par
[])
6706 TCGv_i64 zero
= tcg_const_i64(0);
6707 TCGv_i64 arg2
= tcg_temp_new_i64();
6709 tcg_gen_ext_i32_i64(arg2
, arg
[2].in
);
6710 tcg_gen_movcond_i64(par
[0], arg
[0].out
,
6712 arg
[1].in
, arg
[0].in
);
6713 tcg_temp_free_i64(zero
);
6714 tcg_temp_free_i64(arg2
);
6717 static void translate_movcond_s(DisasContext
*dc
, const OpcodeArg arg
[],
6718 const uint32_t par
[])
6720 if (arg
[0].num_bits
== 32) {
6721 TCGv_i32 zero
= tcg_const_i32(0);
6723 tcg_gen_movcond_i32(par
[0], arg
[0].out
,
6725 arg
[1].in
, arg
[0].in
);
6726 tcg_temp_free(zero
);
6728 translate_movcond_d(dc
, arg
, par
);
6732 static void translate_movp_d(DisasContext
*dc
, const OpcodeArg arg
[],
6733 const uint32_t par
[])
6735 TCGv_i64 zero
= tcg_const_i64(0);
6736 TCGv_i32 tmp1
= tcg_temp_new_i32();
6737 TCGv_i64 tmp2
= tcg_temp_new_i64();
6739 tcg_gen_andi_i32(tmp1
, arg
[2].in
, 1 << arg
[2].imm
);
6740 tcg_gen_extu_i32_i64(tmp2
, tmp1
);
6741 tcg_gen_movcond_i64(par
[0],
6742 arg
[0].out
, tmp2
, zero
,
6743 arg
[1].in
, arg
[0].in
);
6744 tcg_temp_free_i64(zero
);
6745 tcg_temp_free_i32(tmp1
);
6746 tcg_temp_free_i64(tmp2
);
6749 static void translate_movp_s(DisasContext
*dc
, const OpcodeArg arg
[],
6750 const uint32_t par
[])
6752 if (arg
[0].num_bits
== 32) {
6753 TCGv_i32 zero
= tcg_const_i32(0);
6754 TCGv_i32 tmp
= tcg_temp_new_i32();
6756 tcg_gen_andi_i32(tmp
, arg
[2].in
, 1 << arg
[2].imm
);
6757 tcg_gen_movcond_i32(par
[0],
6758 arg
[0].out
, tmp
, zero
,
6759 arg
[1].in
, arg
[0].in
);
6761 tcg_temp_free(zero
);
6763 translate_movp_d(dc
, arg
, par
);
6767 static void translate_fpu2k_mul_s(DisasContext
*dc
, const OpcodeArg arg
[],
6768 const uint32_t par
[])
6770 gen_helper_fpu2k_mul_s(arg
[0].out
, cpu_env
,
6771 arg
[1].in
, arg
[2].in
);
6774 static void translate_fpu2k_msub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6775 const uint32_t par
[])
6777 gen_helper_fpu2k_msub_s(arg
[0].out
, cpu_env
,
6778 arg
[0].in
, arg
[1].in
, arg
[2].in
);
6781 static void translate_neg_d(DisasContext
*dc
, const OpcodeArg arg
[],
6782 const uint32_t par
[])
6784 gen_helper_neg_d(arg
[0].out
, arg
[1].in
);
6787 static void translate_neg_s(DisasContext
*dc
, const OpcodeArg arg
[],
6788 const uint32_t par
[])
6792 get_f32_o1_i1(arg
, arg32
, 0, 1);
6793 gen_helper_neg_s(arg32
[0].out
, arg32
[1].in
);
6794 put_f32_o1_i1(arg
, arg32
, 0, 1);
6797 static void translate_rfr_d(DisasContext
*dc
, const OpcodeArg arg
[],
6798 const uint32_t par
[])
6800 tcg_gen_extrh_i64_i32(arg
[0].out
, arg
[1].in
);
6803 static void translate_rfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6804 const uint32_t par
[])
6806 if (arg
[1].num_bits
== 32) {
6807 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6809 tcg_gen_extrl_i64_i32(arg
[0].out
, arg
[1].in
);
6813 static void translate_fpu2k_sub_s(DisasContext
*dc
, const OpcodeArg arg
[],
6814 const uint32_t par
[])
6816 gen_helper_fpu2k_sub_s(arg
[0].out
, cpu_env
,
6817 arg
[1].in
, arg
[2].in
);
6820 static void translate_wfr_d(DisasContext
*dc
, const OpcodeArg arg
[],
6821 const uint32_t par
[])
6823 tcg_gen_concat_i32_i64(arg
[0].out
, arg
[2].in
, arg
[1].in
);
6826 static void translate_wfr_s(DisasContext
*dc
, const OpcodeArg arg
[],
6827 const uint32_t par
[])
6829 if (arg
[0].num_bits
== 32) {
6830 tcg_gen_mov_i32(arg
[0].out
, arg
[1].in
);
6832 tcg_gen_ext_i32_i64(arg
[0].out
, arg
[1].in
);
6836 static void translate_wur_fpu2k_fcr(DisasContext
*dc
, const OpcodeArg arg
[],
6837 const uint32_t par
[])
6839 gen_helper_wur_fpu2k_fcr(cpu_env
, arg
[0].in
);
6842 static void translate_wur_fpu2k_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
6843 const uint32_t par
[])
6845 tcg_gen_andi_i32(cpu_UR
[par
[0]], arg
[0].in
, 0xffffff80);
6848 static const XtensaOpcodeOps fpu2000_ops
[] = {
6851 .translate
= translate_abs_s
,
6855 .translate
= translate_fpu2k_add_s
,
6859 .translate
= translate_ftoi_s
,
6860 .par
= (const uint32_t[]){float_round_up
, false},
6864 .translate
= translate_float_s
,
6865 .par
= (const uint32_t[]){false},
6869 .translate
= translate_ftoi_s
,
6870 .par
= (const uint32_t[]){float_round_down
, false},
6874 .translate
= translate_ldsti
,
6875 .par
= (const uint32_t[]){false, false},
6876 .op_flags
= XTENSA_OP_LOAD
,
6880 .translate
= translate_ldsti
,
6881 .par
= (const uint32_t[]){false, true},
6882 .op_flags
= XTENSA_OP_LOAD
,
6886 .translate
= translate_ldstx
,
6887 .par
= (const uint32_t[]){false, false},
6888 .op_flags
= XTENSA_OP_LOAD
,
6892 .translate
= translate_ldstx
,
6893 .par
= (const uint32_t[]){false, true},
6894 .op_flags
= XTENSA_OP_LOAD
,
6898 .translate
= translate_fpu2k_madd_s
,
6902 .translate
= translate_mov_s
,
6906 .translate
= translate_movcond_s
,
6907 .par
= (const uint32_t[]){TCG_COND_EQ
},
6911 .translate
= translate_movp_s
,
6912 .par
= (const uint32_t[]){TCG_COND_EQ
},
6916 .translate
= translate_movcond_s
,
6917 .par
= (const uint32_t[]){TCG_COND_GE
},
6921 .translate
= translate_movcond_s
,
6922 .par
= (const uint32_t[]){TCG_COND_LT
},
6926 .translate
= translate_movcond_s
,
6927 .par
= (const uint32_t[]){TCG_COND_NE
},
6931 .translate
= translate_movp_s
,
6932 .par
= (const uint32_t[]){TCG_COND_NE
},
6936 .translate
= translate_fpu2k_msub_s
,
6940 .translate
= translate_fpu2k_mul_s
,
6944 .translate
= translate_neg_s
,
6948 .translate
= translate_compare_s
,
6949 .par
= (const uint32_t[]){COMPARE_OEQ
},
6953 .translate
= translate_compare_s
,
6954 .par
= (const uint32_t[]){COMPARE_OLE
},
6958 .translate
= translate_compare_s
,
6959 .par
= (const uint32_t[]){COMPARE_OLT
},
6963 .translate
= translate_rfr_s
,
6967 .translate
= translate_ftoi_s
,
6968 .par
= (const uint32_t[]){float_round_nearest_even
, false},
6972 .translate
= translate_rur
,
6973 .par
= (const uint32_t[]){FCR
},
6977 .translate
= translate_rur
,
6978 .par
= (const uint32_t[]){FSR
},
6982 .translate
= translate_ldsti
,
6983 .par
= (const uint32_t[]){true, false},
6984 .op_flags
= XTENSA_OP_STORE
,
6988 .translate
= translate_ldsti
,
6989 .par
= (const uint32_t[]){true, true},
6990 .op_flags
= XTENSA_OP_STORE
,
6994 .translate
= translate_ldstx
,
6995 .par
= (const uint32_t[]){true, false},
6996 .op_flags
= XTENSA_OP_STORE
,
7000 .translate
= translate_ldstx
,
7001 .par
= (const uint32_t[]){true, true},
7002 .op_flags
= XTENSA_OP_STORE
,
7006 .translate
= translate_fpu2k_sub_s
,
7010 .translate
= translate_ftoi_s
,
7011 .par
= (const uint32_t[]){float_round_to_zero
, false},
7015 .translate
= translate_compare_s
,
7016 .par
= (const uint32_t[]){COMPARE_UEQ
},
7020 .translate
= translate_float_s
,
7021 .par
= (const uint32_t[]){true},
7025 .translate
= translate_compare_s
,
7026 .par
= (const uint32_t[]){COMPARE_ULE
},
7030 .translate
= translate_compare_s
,
7031 .par
= (const uint32_t[]){COMPARE_ULT
},
7035 .translate
= translate_compare_s
,
7036 .par
= (const uint32_t[]){COMPARE_UN
},
7040 .translate
= translate_ftoi_s
,
7041 .par
= (const uint32_t[]){float_round_to_zero
, true},
7045 .translate
= translate_wfr_s
,
7049 .translate
= translate_wur_fpu2k_fcr
,
7050 .par
= (const uint32_t[]){FCR
},
7054 .translate
= translate_wur_fpu2k_fsr
,
7055 .par
= (const uint32_t[]){FSR
},
7060 const XtensaOpcodeTranslators xtensa_fpu2000_opcodes
= {
7061 .num_opcodes
= ARRAY_SIZE(fpu2000_ops
),
7062 .opcode
= fpu2000_ops
,
7065 static void translate_add_d(DisasContext
*dc
, const OpcodeArg arg
[],
7066 const uint32_t par
[])
7068 gen_helper_add_d(arg
[0].out
, cpu_env
, arg
[1].in
, arg
[2].in
);
7071 static void translate_add_s(DisasContext
*dc
, const OpcodeArg arg
[],
7072 const uint32_t par
[])
7074 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7075 gen_helper_fpu2k_add_s(arg
[0].out
, cpu_env
,
7076 arg
[1].in
, arg
[2].in
);
7080 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7081 gen_helper_add_s(arg32
[0].out
, cpu_env
, arg32
[1].in
, arg32
[2].in
);
7082 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7086 static void translate_cvtd_s(DisasContext
*dc
, const OpcodeArg arg
[],
7087 const uint32_t par
[])
7089 TCGv_i32 v
= tcg_temp_new_i32();
7091 tcg_gen_extrl_i64_i32(v
, arg
[1].in
);
7092 gen_helper_cvtd_s(arg
[0].out
, cpu_env
, v
);
7093 tcg_temp_free_i32(v
);
7096 static void translate_cvts_d(DisasContext
*dc
, const OpcodeArg arg
[],
7097 const uint32_t par
[])
7099 TCGv_i32 v
= tcg_temp_new_i32();
7101 gen_helper_cvts_d(v
, cpu_env
, arg
[1].in
);
7102 tcg_gen_extu_i32_i64(arg
[0].out
, v
);
7103 tcg_temp_free_i32(v
);
7106 static void translate_ldsti_d(DisasContext
*dc
, const OpcodeArg arg
[],
7107 const uint32_t par
[])
7112 addr
= tcg_temp_new_i32();
7113 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
7117 gen_load_store_alignment(dc
, 3, addr
, false);
7119 tcg_gen_qemu_st64(arg
[0].in
, addr
, dc
->cring
);
7121 tcg_gen_qemu_ld64(arg
[0].out
, addr
, dc
->cring
);
7125 tcg_gen_mov_i32(arg
[1].out
, addr
);
7127 tcg_gen_addi_i32(arg
[1].out
, arg
[1].in
, arg
[2].imm
);
7131 tcg_temp_free(addr
);
7135 static void translate_ldsti_s(DisasContext
*dc
, const OpcodeArg arg
[],
7136 const uint32_t par
[])
7142 addr
= tcg_temp_new_i32();
7143 tcg_gen_addi_i32(addr
, arg
[1].in
, arg
[2].imm
);
7147 gen_load_store_alignment(dc
, 2, addr
, false);
7149 get_f32_i1(arg
, arg32
, 0);
7150 tcg_gen_qemu_st32(arg32
[0].in
, addr
, dc
->cring
);
7151 put_f32_i1(arg
, arg32
, 0);
7153 get_f32_o1(arg
, arg32
, 0);
7154 tcg_gen_qemu_ld32u(arg32
[0].out
, addr
, dc
->cring
);
7155 put_f32_o1(arg
, arg32
, 0);
7159 tcg_gen_mov_i32(arg
[1].out
, addr
);
7161 tcg_gen_addi_i32(arg
[1].out
, arg
[1].in
, arg
[2].imm
);
7165 tcg_temp_free(addr
);
7169 static void translate_ldstx_d(DisasContext
*dc
, const OpcodeArg arg
[],
7170 const uint32_t par
[])
7175 addr
= tcg_temp_new_i32();
7176 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
7180 gen_load_store_alignment(dc
, 3, addr
, false);
7182 tcg_gen_qemu_st64(arg
[0].in
, addr
, dc
->cring
);
7184 tcg_gen_qemu_ld64(arg
[0].out
, addr
, dc
->cring
);
7188 tcg_gen_mov_i32(arg
[1].out
, addr
);
7190 tcg_gen_add_i32(arg
[1].out
, arg
[1].in
, arg
[2].in
);
7194 tcg_temp_free(addr
);
7198 static void translate_ldstx_s(DisasContext
*dc
, const OpcodeArg arg
[],
7199 const uint32_t par
[])
7205 addr
= tcg_temp_new_i32();
7206 tcg_gen_add_i32(addr
, arg
[1].in
, arg
[2].in
);
7210 gen_load_store_alignment(dc
, 2, addr
, false);
7212 get_f32_i1(arg
, arg32
, 0);
7213 tcg_gen_qemu_st32(arg32
[0].in
, addr
, dc
->cring
);
7214 put_f32_i1(arg
, arg32
, 0);
7216 get_f32_o1(arg
, arg32
, 0);
7217 tcg_gen_qemu_ld32u(arg32
[0].out
, addr
, dc
->cring
);
7218 put_f32_o1(arg
, arg32
, 0);
7222 tcg_gen_mov_i32(arg
[1].out
, addr
);
7224 tcg_gen_add_i32(arg
[1].out
, arg
[1].in
, arg
[2].in
);
7228 tcg_temp_free(addr
);
7232 static void translate_madd_d(DisasContext
*dc
, const OpcodeArg arg
[],
7233 const uint32_t par
[])
7235 gen_helper_madd_d(arg
[0].out
, cpu_env
,
7236 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7239 static void translate_madd_s(DisasContext
*dc
, const OpcodeArg arg
[],
7240 const uint32_t par
[])
7242 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7243 gen_helper_fpu2k_madd_s(arg
[0].out
, cpu_env
,
7244 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7248 get_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7249 gen_helper_madd_s(arg32
[0].out
, cpu_env
,
7250 arg32
[0].in
, arg32
[1].in
, arg32
[2].in
);
7251 put_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7255 static void translate_mul_d(DisasContext
*dc
, const OpcodeArg arg
[],
7256 const uint32_t par
[])
7258 gen_helper_mul_d(arg
[0].out
, cpu_env
, arg
[1].in
, arg
[2].in
);
7261 static void translate_mul_s(DisasContext
*dc
, const OpcodeArg arg
[],
7262 const uint32_t par
[])
7264 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7265 gen_helper_fpu2k_mul_s(arg
[0].out
, cpu_env
,
7266 arg
[1].in
, arg
[2].in
);
7270 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7271 gen_helper_mul_s(arg32
[0].out
, cpu_env
, arg32
[1].in
, arg32
[2].in
);
7272 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7276 static void translate_msub_d(DisasContext
*dc
, const OpcodeArg arg
[],
7277 const uint32_t par
[])
7279 gen_helper_msub_d(arg
[0].out
, cpu_env
,
7280 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7283 static void translate_msub_s(DisasContext
*dc
, const OpcodeArg arg
[],
7284 const uint32_t par
[])
7286 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7287 gen_helper_fpu2k_msub_s(arg
[0].out
, cpu_env
,
7288 arg
[0].in
, arg
[1].in
, arg
[2].in
);
7292 get_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7293 gen_helper_msub_s(arg32
[0].out
, cpu_env
,
7294 arg32
[0].in
, arg32
[1].in
, arg32
[2].in
);
7295 put_f32_o1_i3(arg
, arg32
, 0, 0, 1, 2);
7299 static void translate_sub_d(DisasContext
*dc
, const OpcodeArg arg
[],
7300 const uint32_t par
[])
7302 gen_helper_sub_d(arg
[0].out
, cpu_env
, arg
[1].in
, arg
[2].in
);
7305 static void translate_sub_s(DisasContext
*dc
, const OpcodeArg arg
[],
7306 const uint32_t par
[])
7308 if (option_enabled(dc
, XTENSA_OPTION_DFPU_SINGLE_ONLY
)) {
7309 gen_helper_fpu2k_sub_s(arg
[0].out
, cpu_env
,
7310 arg
[1].in
, arg
[2].in
);
7314 get_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7315 gen_helper_sub_s(arg32
[0].out
, cpu_env
, arg32
[1].in
, arg32
[2].in
);
7316 put_f32_o1_i2(arg
, arg32
, 0, 1, 2);
7320 static void translate_mkdadj_d(DisasContext
*dc
, const OpcodeArg arg
[],
7321 const uint32_t par
[])
7323 gen_helper_mkdadj_d(arg
[0].out
, cpu_env
, arg
[0].in
, arg
[1].in
);
7326 static void translate_mkdadj_s(DisasContext
*dc
, const OpcodeArg arg
[],
7327 const uint32_t par
[])
7331 get_f32_o1_i2(arg
, arg32
, 0, 0, 1);
7332 gen_helper_mkdadj_s(arg32
[0].out
, cpu_env
, arg32
[0].in
, arg32
[1].in
);
7333 put_f32_o1_i2(arg
, arg32
, 0, 0, 1);
7336 static void translate_mksadj_d(DisasContext
*dc
, const OpcodeArg arg
[],
7337 const uint32_t par
[])
7339 gen_helper_mksadj_d(arg
[0].out
, cpu_env
, arg
[1].in
);
7342 static void translate_mksadj_s(DisasContext
*dc
, const OpcodeArg arg
[],
7343 const uint32_t par
[])
7347 get_f32_o1_i1(arg
, arg32
, 0, 1);
7348 gen_helper_mksadj_s(arg32
[0].out
, cpu_env
, arg32
[1].in
);
7349 put_f32_o1_i1(arg
, arg32
, 0, 1);
7352 static void translate_wur_fpu_fcr(DisasContext
*dc
, const OpcodeArg arg
[],
7353 const uint32_t par
[])
7355 gen_helper_wur_fpu_fcr(cpu_env
, arg
[0].in
);
7358 static void translate_rur_fpu_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
7359 const uint32_t par
[])
7361 gen_helper_rur_fpu_fsr(arg
[0].out
, cpu_env
);
7364 static void translate_wur_fpu_fsr(DisasContext
*dc
, const OpcodeArg arg
[],
7365 const uint32_t par
[])
7367 gen_helper_wur_fpu_fsr(cpu_env
, arg
[0].in
);
7370 static const XtensaOpcodeOps fpu_ops
[] = {
7373 .translate
= translate_abs_d
,
7377 .translate
= translate_abs_s
,
7381 .translate
= translate_add_d
,
7385 .translate
= translate_add_s
,
7389 .translate
= translate_nop
,
7393 .translate
= translate_nop
,
7396 .name
= "addexpm.d",
7397 .translate
= translate_mov_s
,
7400 .name
= "addexpm.s",
7401 .translate
= translate_mov_s
,
7405 .translate
= translate_ftoi_d
,
7406 .par
= (const uint32_t[]){float_round_up
, false},
7410 .translate
= translate_ftoi_s
,
7411 .par
= (const uint32_t[]){float_round_up
, false},
7415 .translate
= translate_const_d
,
7419 .translate
= translate_const_s
,
7423 .translate
= translate_cvtd_s
,
7427 .translate
= translate_cvts_d
,
7431 .translate
= translate_nop
,
7435 .translate
= translate_nop
,
7439 .translate
= translate_nop
,
7443 .translate
= translate_nop
,
7447 .translate
= translate_float_d
,
7448 .par
= (const uint32_t[]){false},
7452 .translate
= translate_float_s
,
7453 .par
= (const uint32_t[]){false},
7457 .translate
= translate_ftoi_d
,
7458 .par
= (const uint32_t[]){float_round_down
, false},
7462 .translate
= translate_ftoi_s
,
7463 .par
= (const uint32_t[]){float_round_down
, false},
7467 .translate
= translate_ldsti_d
,
7468 .par
= (const uint32_t[]){false, true, false},
7469 .op_flags
= XTENSA_OP_LOAD
,
7473 .translate
= translate_ldsti_d
,
7474 .par
= (const uint32_t[]){false, false, true},
7475 .op_flags
= XTENSA_OP_LOAD
,
7479 .translate
= translate_ldsti_d
,
7480 .par
= (const uint32_t[]){false, true, true},
7481 .op_flags
= XTENSA_OP_LOAD
,
7485 .translate
= translate_ldstx_d
,
7486 .par
= (const uint32_t[]){false, true, false},
7487 .op_flags
= XTENSA_OP_LOAD
,
7491 .translate
= translate_ldstx_d
,
7492 .par
= (const uint32_t[]){false, false, true},
7493 .op_flags
= XTENSA_OP_LOAD
,
7497 .translate
= translate_ldstx_d
,
7498 .par
= (const uint32_t[]){false, true, true},
7499 .op_flags
= XTENSA_OP_LOAD
,
7503 .translate
= translate_ldsti_s
,
7504 .par
= (const uint32_t[]){false, true, false},
7505 .op_flags
= XTENSA_OP_LOAD
,
7509 .translate
= translate_ldsti_s
,
7510 .par
= (const uint32_t[]){false, false, true},
7511 .op_flags
= XTENSA_OP_LOAD
,
7515 .translate
= translate_ldsti_s
,
7516 .par
= (const uint32_t[]){false, true, true},
7517 .op_flags
= XTENSA_OP_LOAD
,
7521 .translate
= translate_ldstx_s
,
7522 .par
= (const uint32_t[]){false, true, false},
7523 .op_flags
= XTENSA_OP_LOAD
,
7527 .translate
= translate_ldstx_s
,
7528 .par
= (const uint32_t[]){false, false, true},
7529 .op_flags
= XTENSA_OP_LOAD
,
7533 .translate
= translate_ldstx_s
,
7534 .par
= (const uint32_t[]){false, true, true},
7535 .op_flags
= XTENSA_OP_LOAD
,
7539 .translate
= translate_madd_d
,
7543 .translate
= translate_madd_s
,
7547 .translate
= translate_nop
,
7551 .translate
= translate_nop
,
7555 .translate
= translate_mkdadj_d
,
7559 .translate
= translate_mkdadj_s
,
7563 .translate
= translate_mksadj_d
,
7567 .translate
= translate_mksadj_s
,
7571 .translate
= translate_mov_d
,
7575 .translate
= translate_mov_s
,
7579 .translate
= translate_movcond_d
,
7580 .par
= (const uint32_t[]){TCG_COND_EQ
},
7584 .translate
= translate_movcond_s
,
7585 .par
= (const uint32_t[]){TCG_COND_EQ
},
7589 .translate
= translate_movp_d
,
7590 .par
= (const uint32_t[]){TCG_COND_EQ
},
7594 .translate
= translate_movp_s
,
7595 .par
= (const uint32_t[]){TCG_COND_EQ
},
7599 .translate
= translate_movcond_d
,
7600 .par
= (const uint32_t[]){TCG_COND_GE
},
7604 .translate
= translate_movcond_s
,
7605 .par
= (const uint32_t[]){TCG_COND_GE
},
7609 .translate
= translate_movcond_d
,
7610 .par
= (const uint32_t[]){TCG_COND_LT
},
7614 .translate
= translate_movcond_s
,
7615 .par
= (const uint32_t[]){TCG_COND_LT
},
7619 .translate
= translate_movcond_d
,
7620 .par
= (const uint32_t[]){TCG_COND_NE
},
7624 .translate
= translate_movcond_s
,
7625 .par
= (const uint32_t[]){TCG_COND_NE
},
7629 .translate
= translate_movp_d
,
7630 .par
= (const uint32_t[]){TCG_COND_NE
},
7634 .translate
= translate_movp_s
,
7635 .par
= (const uint32_t[]){TCG_COND_NE
},
7639 .translate
= translate_msub_d
,
7643 .translate
= translate_msub_s
,
7647 .translate
= translate_mul_d
,
7651 .translate
= translate_mul_s
,
7655 .translate
= translate_neg_d
,
7659 .translate
= translate_neg_s
,
7663 .translate
= translate_nop
,
7667 .translate
= translate_nop
,
7671 .translate
= translate_compare_d
,
7672 .par
= (const uint32_t[]){COMPARE_OEQ
},
7676 .translate
= translate_compare_s
,
7677 .par
= (const uint32_t[]){COMPARE_OEQ
},
7681 .translate
= translate_compare_d
,
7682 .par
= (const uint32_t[]){COMPARE_OLE
},
7686 .translate
= translate_compare_s
,
7687 .par
= (const uint32_t[]){COMPARE_OLE
},
7691 .translate
= translate_compare_d
,
7692 .par
= (const uint32_t[]){COMPARE_OLT
},
7696 .translate
= translate_compare_s
,
7697 .par
= (const uint32_t[]){COMPARE_OLT
},
7701 .translate
= translate_rfr_s
,
7705 .translate
= translate_rfr_d
,
7709 .translate
= translate_ftoi_d
,
7710 .par
= (const uint32_t[]){float_round_nearest_even
, false},
7714 .translate
= translate_ftoi_s
,
7715 .par
= (const uint32_t[]){float_round_nearest_even
, false},
7719 .translate
= translate_rur
,
7720 .par
= (const uint32_t[]){FCR
},
7724 .translate
= translate_rur_fpu_fsr
,
7728 .translate
= translate_ldsti_d
,
7729 .par
= (const uint32_t[]){true, true, false},
7730 .op_flags
= XTENSA_OP_STORE
,
7734 .translate
= translate_ldsti_d
,
7735 .par
= (const uint32_t[]){true, false, true},
7736 .op_flags
= XTENSA_OP_STORE
,
7740 .translate
= translate_ldsti_d
,
7741 .par
= (const uint32_t[]){true, true, true},
7742 .op_flags
= XTENSA_OP_STORE
,
7746 .translate
= translate_ldstx_d
,
7747 .par
= (const uint32_t[]){true, true, false},
7748 .op_flags
= XTENSA_OP_STORE
,
7752 .translate
= translate_ldstx_d
,
7753 .par
= (const uint32_t[]){true, false, true},
7754 .op_flags
= XTENSA_OP_STORE
,
7758 .translate
= translate_ldstx_d
,
7759 .par
= (const uint32_t[]){true, true, true},
7760 .op_flags
= XTENSA_OP_STORE
,
7764 .translate
= translate_nop
,
7768 .translate
= translate_nop
,
7772 .translate
= translate_ldsti_s
,
7773 .par
= (const uint32_t[]){true, true, false},
7774 .op_flags
= XTENSA_OP_STORE
,
7778 .translate
= translate_ldsti_s
,
7779 .par
= (const uint32_t[]){true, false, true},
7780 .op_flags
= XTENSA_OP_STORE
,
7784 .translate
= translate_ldsti_s
,
7785 .par
= (const uint32_t[]){true, true, true},
7786 .op_flags
= XTENSA_OP_STORE
,
7790 .translate
= translate_ldstx_s
,
7791 .par
= (const uint32_t[]){true, true, false},
7792 .op_flags
= XTENSA_OP_STORE
,
7796 .translate
= translate_ldstx_s
,
7797 .par
= (const uint32_t[]){true, false, true},
7798 .op_flags
= XTENSA_OP_STORE
,
7802 .translate
= translate_ldstx_s
,
7803 .par
= (const uint32_t[]){true, true, true},
7804 .op_flags
= XTENSA_OP_STORE
,
7808 .translate
= translate_sub_d
,
7812 .translate
= translate_sub_s
,
7816 .translate
= translate_ftoi_d
,
7817 .par
= (const uint32_t[]){float_round_to_zero
, false},
7821 .translate
= translate_ftoi_s
,
7822 .par
= (const uint32_t[]){float_round_to_zero
, false},
7826 .translate
= translate_compare_d
,
7827 .par
= (const uint32_t[]){COMPARE_UEQ
},
7831 .translate
= translate_compare_s
,
7832 .par
= (const uint32_t[]){COMPARE_UEQ
},
7836 .translate
= translate_float_d
,
7837 .par
= (const uint32_t[]){true},
7841 .translate
= translate_float_s
,
7842 .par
= (const uint32_t[]){true},
7846 .translate
= translate_compare_d
,
7847 .par
= (const uint32_t[]){COMPARE_ULE
},
7851 .translate
= translate_compare_s
,
7852 .par
= (const uint32_t[]){COMPARE_ULE
},
7856 .translate
= translate_compare_d
,
7857 .par
= (const uint32_t[]){COMPARE_ULT
},
7861 .translate
= translate_compare_s
,
7862 .par
= (const uint32_t[]){COMPARE_ULT
},
7866 .translate
= translate_compare_d
,
7867 .par
= (const uint32_t[]){COMPARE_UN
},
7871 .translate
= translate_compare_s
,
7872 .par
= (const uint32_t[]){COMPARE_UN
},
7876 .translate
= translate_ftoi_d
,
7877 .par
= (const uint32_t[]){float_round_to_zero
, true},
7881 .translate
= translate_ftoi_s
,
7882 .par
= (const uint32_t[]){float_round_to_zero
, true},
7886 .translate
= translate_wfr_s
,
7890 .translate
= translate_wfr_d
,
7894 .translate
= translate_wur_fpu_fcr
,
7895 .par
= (const uint32_t[]){FCR
},
7899 .translate
= translate_wur_fpu_fsr
,
7904 const XtensaOpcodeTranslators xtensa_fpu_opcodes
= {
7905 .num_opcodes
= ARRAY_SIZE(fpu_ops
),