1 /* 2 * Xtensa ISA: 3 * http://www.tensilica.com/products/literature-docs/documentation/xtensa-isa-databook.htm 4 * 5 * Copyright (c) 2011, Max Filippov, Open Source and Linux Lab. 6 * All rights reserved. 7 * 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. 18 * 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. 29 */ 30 31 #include "qemu/osdep.h" 32 33 #include "cpu.h" 34 #include "exec/exec-all.h" 35 #include "tcg/tcg-op.h" 36 #include "qemu/log.h" 37 #include "qemu/qemu-print.h" 38 #include "exec/cpu_ldst.h" 39 #include "semihosting/semihost.h" 40 #include "exec/translator.h" 41 42 #include "exec/helper-proto.h" 43 #include "exec/helper-gen.h" 44 45 #include "exec/log.h" 46 47 #define HELPER_H "helper.h" 48 #include "exec/helper-info.c.inc" 49 #undef HELPER_H 50 51 52 struct DisasContext { 53 DisasContextBase base; 54 const XtensaConfig *config; 55 uint32_t pc; 56 int cring; 57 int ring; 58 uint32_t lbeg_off; 59 uint32_t lend; 60 61 bool sar_5bit; 62 bool sar_m32_5bit; 63 TCGv_i32 sar_m32; 64 65 unsigned window; 66 unsigned callinc; 67 bool cwoe; 68 69 bool debug; 70 bool icount; 71 TCGv_i32 next_icount; 72 73 unsigned cpenable; 74 75 uint32_t op_flags; 76 xtensa_insnbuf_word insnbuf[MAX_INSNBUF_LENGTH]; 77 xtensa_insnbuf_word slotbuf[MAX_INSNBUF_LENGTH]; 78 }; 79 80 static TCGv_i32 cpu_pc; 81 static TCGv_i32 cpu_R[16]; 82 static TCGv_i32 cpu_FR[16]; 83 static TCGv_i64 cpu_FRD[16]; 84 static TCGv_i32 cpu_MR[4]; 85 static TCGv_i32 cpu_BR[16]; 86 static TCGv_i32 cpu_BR4[4]; 87 static TCGv_i32 cpu_BR8[2]; 88 static TCGv_i32 cpu_SR[256]; 89 static TCGv_i32 cpu_UR[256]; 90 static TCGv_i32 cpu_windowbase_next; 91 static TCGv_i32 cpu_exclusive_addr; 92 static TCGv_i32 cpu_exclusive_val; 93 94 static GHashTable *xtensa_regfile_table; 95 96 static char *sr_name[256]; 97 static char *ur_name[256]; 98 99 void xtensa_collect_sr_names(const XtensaConfig *config) 100 { 101 xtensa_isa isa = config->isa; 102 int n = xtensa_isa_num_sysregs(isa); 103 int i; 104 105 for (i = 0; i < n; ++i) { 106 int sr = xtensa_sysreg_number(isa, i); 107 108 if (sr >= 0 && sr < 256) { 109 const char *name = xtensa_sysreg_name(isa, i); 110 char **pname = 111 (xtensa_sysreg_is_user(isa, i) ? ur_name : sr_name) + sr; 112 113 if (*pname) { 114 if (strstr(*pname, name) == NULL) { 115 char *new_name = 116 malloc(strlen(*pname) + strlen(name) + 2); 117 118 strcpy(new_name, *pname); 119 strcat(new_name, "/"); 120 strcat(new_name, name); 121 free(*pname); 122 *pname = new_name; 123 } 124 } else { 125 *pname = strdup(name); 126 } 127 } 128 } 129 } 130 131 void xtensa_translate_init(void) 132 { 133 static const char * const regnames[] = { 134 "ar0", "ar1", "ar2", "ar3", 135 "ar4", "ar5", "ar6", "ar7", 136 "ar8", "ar9", "ar10", "ar11", 137 "ar12", "ar13", "ar14", "ar15", 138 }; 139 static const char * const fregnames[] = { 140 "f0", "f1", "f2", "f3", 141 "f4", "f5", "f6", "f7", 142 "f8", "f9", "f10", "f11", 143 "f12", "f13", "f14", "f15", 144 }; 145 static const char * const mregnames[] = { 146 "m0", "m1", "m2", "m3", 147 }; 148 static const char * const bregnames[] = { 149 "b0", "b1", "b2", "b3", 150 "b4", "b5", "b6", "b7", 151 "b8", "b9", "b10", "b11", 152 "b12", "b13", "b14", "b15", 153 }; 154 int i; 155 156 cpu_pc = tcg_global_mem_new_i32(tcg_env, 157 offsetof(CPUXtensaState, pc), "pc"); 158 159 for (i = 0; i < 16; i++) { 160 cpu_R[i] = tcg_global_mem_new_i32(tcg_env, 161 offsetof(CPUXtensaState, regs[i]), 162 regnames[i]); 163 } 164 165 for (i = 0; i < 16; i++) { 166 cpu_FR[i] = tcg_global_mem_new_i32(tcg_env, 167 offsetof(CPUXtensaState, 168 fregs[i].f32[FP_F32_LOW]), 169 fregnames[i]); 170 } 171 172 for (i = 0; i < 16; i++) { 173 cpu_FRD[i] = tcg_global_mem_new_i64(tcg_env, 174 offsetof(CPUXtensaState, 175 fregs[i].f64), 176 fregnames[i]); 177 } 178 179 for (i = 0; i < 4; i++) { 180 cpu_MR[i] = tcg_global_mem_new_i32(tcg_env, 181 offsetof(CPUXtensaState, 182 sregs[MR + i]), 183 mregnames[i]); 184 } 185 186 for (i = 0; i < 16; i++) { 187 cpu_BR[i] = tcg_global_mem_new_i32(tcg_env, 188 offsetof(CPUXtensaState, 189 sregs[BR]), 190 bregnames[i]); 191 if (i % 4 == 0) { 192 cpu_BR4[i / 4] = tcg_global_mem_new_i32(tcg_env, 193 offsetof(CPUXtensaState, 194 sregs[BR]), 195 bregnames[i]); 196 } 197 if (i % 8 == 0) { 198 cpu_BR8[i / 8] = tcg_global_mem_new_i32(tcg_env, 199 offsetof(CPUXtensaState, 200 sregs[BR]), 201 bregnames[i]); 202 } 203 } 204 205 for (i = 0; i < 256; ++i) { 206 if (sr_name[i]) { 207 cpu_SR[i] = tcg_global_mem_new_i32(tcg_env, 208 offsetof(CPUXtensaState, 209 sregs[i]), 210 sr_name[i]); 211 } 212 } 213 214 for (i = 0; i < 256; ++i) { 215 if (ur_name[i]) { 216 cpu_UR[i] = tcg_global_mem_new_i32(tcg_env, 217 offsetof(CPUXtensaState, 218 uregs[i]), 219 ur_name[i]); 220 } 221 } 222 223 cpu_windowbase_next = 224 tcg_global_mem_new_i32(tcg_env, 225 offsetof(CPUXtensaState, windowbase_next), 226 "windowbase_next"); 227 cpu_exclusive_addr = 228 tcg_global_mem_new_i32(tcg_env, 229 offsetof(CPUXtensaState, exclusive_addr), 230 "exclusive_addr"); 231 cpu_exclusive_val = 232 tcg_global_mem_new_i32(tcg_env, 233 offsetof(CPUXtensaState, exclusive_val), 234 "exclusive_val"); 235 } 236 237 void **xtensa_get_regfile_by_name(const char *name, int entries, int bits) 238 { 239 char *geometry_name; 240 void **res; 241 242 if (xtensa_regfile_table == NULL) { 243 xtensa_regfile_table = g_hash_table_new(g_str_hash, g_str_equal); 244 /* 245 * AR is special. Xtensa translator uses it as a current register 246 * window, but configuration overlays represent it as a complete 247 * physical register file. 248 */ 249 g_hash_table_insert(xtensa_regfile_table, 250 (void *)"AR 16x32", (void *)cpu_R); 251 g_hash_table_insert(xtensa_regfile_table, 252 (void *)"AR 32x32", (void *)cpu_R); 253 g_hash_table_insert(xtensa_regfile_table, 254 (void *)"AR 64x32", (void *)cpu_R); 255 256 g_hash_table_insert(xtensa_regfile_table, 257 (void *)"MR 4x32", (void *)cpu_MR); 258 259 g_hash_table_insert(xtensa_regfile_table, 260 (void *)"FR 16x32", (void *)cpu_FR); 261 g_hash_table_insert(xtensa_regfile_table, 262 (void *)"FR 16x64", (void *)cpu_FRD); 263 264 g_hash_table_insert(xtensa_regfile_table, 265 (void *)"BR 16x1", (void *)cpu_BR); 266 g_hash_table_insert(xtensa_regfile_table, 267 (void *)"BR4 4x4", (void *)cpu_BR4); 268 g_hash_table_insert(xtensa_regfile_table, 269 (void *)"BR8 2x8", (void *)cpu_BR8); 270 } 271 272 geometry_name = g_strdup_printf("%s %dx%d", name, entries, bits); 273 res = (void **)g_hash_table_lookup(xtensa_regfile_table, geometry_name); 274 g_free(geometry_name); 275 return res; 276 } 277 278 static inline bool option_enabled(DisasContext *dc, int opt) 279 { 280 return xtensa_option_enabled(dc->config, opt); 281 } 282 283 static void init_sar_tracker(DisasContext *dc) 284 { 285 dc->sar_5bit = false; 286 dc->sar_m32_5bit = false; 287 dc->sar_m32 = NULL; 288 } 289 290 static void gen_right_shift_sar(DisasContext *dc, TCGv_i32 sa) 291 { 292 tcg_gen_andi_i32(cpu_SR[SAR], sa, 0x1f); 293 if (dc->sar_m32_5bit) { 294 tcg_gen_discard_i32(dc->sar_m32); 295 } 296 dc->sar_5bit = true; 297 dc->sar_m32_5bit = false; 298 } 299 300 static void gen_left_shift_sar(DisasContext *dc, TCGv_i32 sa) 301 { 302 if (!dc->sar_m32) { 303 dc->sar_m32 = tcg_temp_new_i32(); 304 } 305 tcg_gen_andi_i32(dc->sar_m32, sa, 0x1f); 306 tcg_gen_sub_i32(cpu_SR[SAR], tcg_constant_i32(32), dc->sar_m32); 307 dc->sar_5bit = false; 308 dc->sar_m32_5bit = true; 309 } 310 311 static void gen_exception(DisasContext *dc, int excp) 312 { 313 gen_helper_exception(tcg_env, tcg_constant_i32(excp)); 314 } 315 316 static void gen_exception_cause(DisasContext *dc, uint32_t cause) 317 { 318 TCGv_i32 pc = tcg_constant_i32(dc->pc); 319 gen_helper_exception_cause(tcg_env, pc, tcg_constant_i32(cause)); 320 if (cause == ILLEGAL_INSTRUCTION_CAUSE || 321 cause == SYSCALL_CAUSE) { 322 dc->base.is_jmp = DISAS_NORETURN; 323 } 324 } 325 326 static void gen_debug_exception(DisasContext *dc, uint32_t cause) 327 { 328 TCGv_i32 pc = tcg_constant_i32(dc->pc); 329 gen_helper_debug_exception(tcg_env, pc, tcg_constant_i32(cause)); 330 if (cause & (DEBUGCAUSE_IB | DEBUGCAUSE_BI | DEBUGCAUSE_BN)) { 331 dc->base.is_jmp = DISAS_NORETURN; 332 } 333 } 334 335 static bool gen_check_privilege(DisasContext *dc) 336 { 337 #ifndef CONFIG_USER_ONLY 338 if (!dc->cring) { 339 return true; 340 } 341 #endif 342 gen_exception_cause(dc, PRIVILEGED_CAUSE); 343 dc->base.is_jmp = DISAS_NORETURN; 344 return false; 345 } 346 347 static bool gen_check_cpenable(DisasContext *dc, uint32_t cp_mask) 348 { 349 cp_mask &= ~dc->cpenable; 350 351 if (option_enabled(dc, XTENSA_OPTION_COPROCESSOR) && cp_mask) { 352 gen_exception_cause(dc, COPROCESSOR0_DISABLED + ctz32(cp_mask)); 353 dc->base.is_jmp = DISAS_NORETURN; 354 return false; 355 } 356 return true; 357 } 358 359 static int gen_postprocess(DisasContext *dc, int slot); 360 361 static void gen_jump_slot(DisasContext *dc, TCGv dest, int slot) 362 { 363 tcg_gen_mov_i32(cpu_pc, dest); 364 if (dc->icount) { 365 tcg_gen_mov_i32(cpu_SR[ICOUNT], dc->next_icount); 366 } 367 if (dc->op_flags & XTENSA_OP_POSTPROCESS) { 368 slot = gen_postprocess(dc, slot); 369 } 370 if (slot >= 0) { 371 tcg_gen_goto_tb(slot); 372 tcg_gen_exit_tb(dc->base.tb, slot); 373 } else { 374 tcg_gen_exit_tb(NULL, 0); 375 } 376 dc->base.is_jmp = DISAS_NORETURN; 377 } 378 379 static void gen_jump(DisasContext *dc, TCGv dest) 380 { 381 gen_jump_slot(dc, dest, -1); 382 } 383 384 static int adjust_jump_slot(DisasContext *dc, uint32_t dest, int slot) 385 { 386 return translator_use_goto_tb(&dc->base, dest) ? slot : -1; 387 } 388 389 static void gen_jumpi(DisasContext *dc, uint32_t dest, int slot) 390 { 391 gen_jump_slot(dc, tcg_constant_i32(dest), 392 adjust_jump_slot(dc, dest, slot)); 393 } 394 395 static void gen_callw_slot(DisasContext *dc, int callinc, TCGv_i32 dest, 396 int slot) 397 { 398 tcg_gen_deposit_i32(cpu_SR[PS], cpu_SR[PS], 399 tcg_constant_i32(callinc), PS_CALLINC_SHIFT, PS_CALLINC_LEN); 400 tcg_gen_movi_i32(cpu_R[callinc << 2], 401 (callinc << 30) | (dc->base.pc_next & 0x3fffffff)); 402 gen_jump_slot(dc, dest, slot); 403 } 404 405 static bool gen_check_loop_end(DisasContext *dc, int slot) 406 { 407 if (dc->base.pc_next == dc->lend) { 408 TCGLabel *label = gen_new_label(); 409 410 tcg_gen_brcondi_i32(TCG_COND_EQ, cpu_SR[LCOUNT], 0, label); 411 tcg_gen_subi_i32(cpu_SR[LCOUNT], cpu_SR[LCOUNT], 1); 412 if (dc->lbeg_off) { 413 gen_jumpi(dc, dc->base.pc_next - dc->lbeg_off, slot); 414 } else { 415 gen_jump(dc, cpu_SR[LBEG]); 416 } 417 gen_set_label(label); 418 gen_jumpi(dc, dc->base.pc_next, -1); 419 return true; 420 } 421 return false; 422 } 423 424 static void gen_jumpi_check_loop_end(DisasContext *dc, int slot) 425 { 426 if (!gen_check_loop_end(dc, slot)) { 427 gen_jumpi(dc, dc->base.pc_next, slot); 428 } 429 } 430 431 static void gen_brcond(DisasContext *dc, TCGCond cond, 432 TCGv_i32 t0, TCGv_i32 t1, uint32_t addr) 433 { 434 TCGLabel *label = gen_new_label(); 435 436 tcg_gen_brcond_i32(cond, t0, t1, label); 437 gen_jumpi_check_loop_end(dc, 0); 438 gen_set_label(label); 439 gen_jumpi(dc, addr, 1); 440 } 441 442 static void gen_brcondi(DisasContext *dc, TCGCond cond, 443 TCGv_i32 t0, uint32_t t1, uint32_t addr) 444 { 445 gen_brcond(dc, cond, t0, tcg_constant_i32(t1), addr); 446 } 447 448 static uint32_t test_exceptions_sr(DisasContext *dc, const OpcodeArg arg[], 449 const uint32_t par[]) 450 { 451 return xtensa_option_enabled(dc->config, par[1]) ? 0 : XTENSA_OP_ILL; 452 } 453 454 static uint32_t test_exceptions_ccompare(DisasContext *dc, 455 const OpcodeArg arg[], 456 const uint32_t par[]) 457 { 458 unsigned n = par[0] - CCOMPARE; 459 460 if (n >= dc->config->nccompare) { 461 return XTENSA_OP_ILL; 462 } 463 return test_exceptions_sr(dc, arg, par); 464 } 465 466 static uint32_t test_exceptions_dbreak(DisasContext *dc, const OpcodeArg arg[], 467 const uint32_t par[]) 468 { 469 unsigned n = MAX_NDBREAK; 470 471 if (par[0] >= DBREAKA && par[0] < DBREAKA + MAX_NDBREAK) { 472 n = par[0] - DBREAKA; 473 } 474 if (par[0] >= DBREAKC && par[0] < DBREAKC + MAX_NDBREAK) { 475 n = par[0] - DBREAKC; 476 } 477 if (n >= dc->config->ndbreak) { 478 return XTENSA_OP_ILL; 479 } 480 return test_exceptions_sr(dc, arg, par); 481 } 482 483 static uint32_t test_exceptions_ibreak(DisasContext *dc, const OpcodeArg arg[], 484 const uint32_t par[]) 485 { 486 unsigned n = par[0] - IBREAKA; 487 488 if (n >= dc->config->nibreak) { 489 return XTENSA_OP_ILL; 490 } 491 return test_exceptions_sr(dc, arg, par); 492 } 493 494 static uint32_t test_exceptions_hpi(DisasContext *dc, const OpcodeArg arg[], 495 const uint32_t par[]) 496 { 497 unsigned n = MAX_NLEVEL + 1; 498 499 if (par[0] >= EXCSAVE1 && par[0] < EXCSAVE1 + MAX_NLEVEL) { 500 n = par[0] - EXCSAVE1 + 1; 501 } 502 if (par[0] >= EPC1 && par[0] < EPC1 + MAX_NLEVEL) { 503 n = par[0] - EPC1 + 1; 504 } 505 if (par[0] >= EPS2 && par[0] < EPS2 + MAX_NLEVEL - 1) { 506 n = par[0] - EPS2 + 2; 507 } 508 if (n > dc->config->nlevel) { 509 return XTENSA_OP_ILL; 510 } 511 return test_exceptions_sr(dc, arg, par); 512 } 513 514 static MemOp gen_load_store_alignment(DisasContext *dc, MemOp mop, 515 TCGv_i32 addr) 516 { 517 if ((mop & MO_SIZE) == MO_8) { 518 return mop; 519 } 520 if ((mop & MO_AMASK) == MO_UNALN && 521 !option_enabled(dc, XTENSA_OPTION_HW_ALIGNMENT)) { 522 mop |= MO_ALIGN; 523 } 524 if (!option_enabled(dc, XTENSA_OPTION_UNALIGNED_EXCEPTION)) { 525 tcg_gen_andi_i32(addr, addr, ~0 << get_alignment_bits(mop)); 526 } 527 return mop; 528 } 529 530 static bool gen_window_check(DisasContext *dc, uint32_t mask) 531 { 532 unsigned r = 31 - clz32(mask); 533 534 if (r / 4 > dc->window) { 535 TCGv_i32 pc = tcg_constant_i32(dc->pc); 536 TCGv_i32 w = tcg_constant_i32(r / 4); 537 538 gen_helper_window_check(tcg_env, pc, w); 539 dc->base.is_jmp = DISAS_NORETURN; 540 return false; 541 } 542 return true; 543 } 544 545 static TCGv_i32 gen_mac16_m(TCGv_i32 v, bool hi, bool is_unsigned) 546 { 547 TCGv_i32 m = tcg_temp_new_i32(); 548 549 if (hi) { 550 (is_unsigned ? tcg_gen_shri_i32 : tcg_gen_sari_i32)(m, v, 16); 551 } else { 552 (is_unsigned ? tcg_gen_ext16u_i32 : tcg_gen_ext16s_i32)(m, v); 553 } 554 return m; 555 } 556 557 static void gen_zero_check(DisasContext *dc, const OpcodeArg arg[]) 558 { 559 TCGLabel *label = gen_new_label(); 560 561 tcg_gen_brcondi_i32(TCG_COND_NE, arg[2].in, 0, label); 562 gen_exception_cause(dc, INTEGER_DIVIDE_BY_ZERO_CAUSE); 563 gen_set_label(label); 564 } 565 566 static inline unsigned xtensa_op0_insn_len(DisasContext *dc, uint8_t op0) 567 { 568 return xtensa_isa_length_from_chars(dc->config->isa, &op0); 569 } 570 571 static int gen_postprocess(DisasContext *dc, int slot) 572 { 573 uint32_t op_flags = dc->op_flags; 574 575 #ifndef CONFIG_USER_ONLY 576 if (op_flags & XTENSA_OP_CHECK_INTERRUPTS) { 577 translator_io_start(&dc->base); 578 gen_helper_check_interrupts(tcg_env); 579 } 580 #endif 581 if (op_flags & XTENSA_OP_SYNC_REGISTER_WINDOW) { 582 gen_helper_sync_windowbase(tcg_env); 583 } 584 if (op_flags & XTENSA_OP_EXIT_TB_M1) { 585 slot = -1; 586 } 587 return slot; 588 } 589 590 struct opcode_arg_copy { 591 uint32_t resource; 592 void *temp; 593 OpcodeArg *arg; 594 }; 595 596 struct opcode_arg_info { 597 uint32_t resource; 598 int index; 599 }; 600 601 struct slot_prop { 602 XtensaOpcodeOps *ops; 603 OpcodeArg arg[MAX_OPCODE_ARGS]; 604 struct opcode_arg_info in[MAX_OPCODE_ARGS]; 605 struct opcode_arg_info out[MAX_OPCODE_ARGS]; 606 unsigned n_in; 607 unsigned n_out; 608 uint32_t op_flags; 609 }; 610 611 enum resource_type { 612 RES_REGFILE, 613 RES_STATE, 614 RES_MAX, 615 }; 616 617 static uint32_t encode_resource(enum resource_type r, unsigned g, unsigned n) 618 { 619 assert(r < RES_MAX && g < 256 && n < 65536); 620 return (r << 24) | (g << 16) | n; 621 } 622 623 static enum resource_type get_resource_type(uint32_t resource) 624 { 625 return resource >> 24; 626 } 627 628 /* 629 * a depends on b if b must be executed before a, 630 * because a's side effects will destroy b's inputs. 631 */ 632 static bool op_depends_on(const struct slot_prop *a, 633 const struct slot_prop *b) 634 { 635 unsigned i = 0; 636 unsigned j = 0; 637 638 if (a->op_flags & XTENSA_OP_CONTROL_FLOW) { 639 return true; 640 } 641 if ((a->op_flags & XTENSA_OP_LOAD_STORE) < 642 (b->op_flags & XTENSA_OP_LOAD_STORE)) { 643 return true; 644 } 645 while (i < a->n_out && j < b->n_in) { 646 if (a->out[i].resource < b->in[j].resource) { 647 ++i; 648 } else if (a->out[i].resource > b->in[j].resource) { 649 ++j; 650 } else { 651 return true; 652 } 653 } 654 return false; 655 } 656 657 /* 658 * Try to break a dependency on b, append temporary register copy records 659 * to the end of copy and update n_copy in case of success. 660 * This is not always possible: e.g. control flow must always be the last, 661 * load/store must be first and state dependencies are not supported yet. 662 */ 663 static bool break_dependency(struct slot_prop *a, 664 struct slot_prop *b, 665 struct opcode_arg_copy *copy, 666 unsigned *n_copy) 667 { 668 unsigned i = 0; 669 unsigned j = 0; 670 unsigned n = *n_copy; 671 bool rv = false; 672 673 if (a->op_flags & XTENSA_OP_CONTROL_FLOW) { 674 return false; 675 } 676 if ((a->op_flags & XTENSA_OP_LOAD_STORE) < 677 (b->op_flags & XTENSA_OP_LOAD_STORE)) { 678 return false; 679 } 680 while (i < a->n_out && j < b->n_in) { 681 if (a->out[i].resource < b->in[j].resource) { 682 ++i; 683 } else if (a->out[i].resource > b->in[j].resource) { 684 ++j; 685 } else { 686 int index = b->in[j].index; 687 688 if (get_resource_type(a->out[i].resource) != RES_REGFILE || 689 index < 0) { 690 return false; 691 } 692 copy[n].resource = b->in[j].resource; 693 copy[n].arg = b->arg + index; 694 ++n; 695 ++j; 696 rv = true; 697 } 698 } 699 *n_copy = n; 700 return rv; 701 } 702 703 /* 704 * Calculate evaluation order for slot opcodes. 705 * Build opcode order graph and output its nodes in topological sort order. 706 * An edge a -> b in the graph means that opcode a must be followed by 707 * opcode b. 708 */ 709 static bool tsort(struct slot_prop *slot, 710 struct slot_prop *sorted[], 711 unsigned n, 712 struct opcode_arg_copy *copy, 713 unsigned *n_copy) 714 { 715 struct tsnode { 716 unsigned n_in_edge; 717 unsigned n_out_edge; 718 unsigned out_edge[MAX_INSN_SLOTS]; 719 } node[MAX_INSN_SLOTS]; 720 721 unsigned in[MAX_INSN_SLOTS]; 722 unsigned i, j; 723 unsigned n_in = 0; 724 unsigned n_out = 0; 725 unsigned n_edge = 0; 726 unsigned in_idx = 0; 727 unsigned node_idx = 0; 728 729 for (i = 0; i < n; ++i) { 730 node[i].n_in_edge = 0; 731 node[i].n_out_edge = 0; 732 } 733 734 for (i = 0; i < n; ++i) { 735 unsigned n_out_edge = 0; 736 737 for (j = 0; j < n; ++j) { 738 if (i != j && op_depends_on(slot + j, slot + i)) { 739 node[i].out_edge[n_out_edge] = j; 740 ++node[j].n_in_edge; 741 ++n_out_edge; 742 ++n_edge; 743 } 744 } 745 node[i].n_out_edge = n_out_edge; 746 } 747 748 for (i = 0; i < n; ++i) { 749 if (!node[i].n_in_edge) { 750 in[n_in] = i; 751 ++n_in; 752 } 753 } 754 755 again: 756 for (; in_idx < n_in; ++in_idx) { 757 i = in[in_idx]; 758 sorted[n_out] = slot + i; 759 ++n_out; 760 for (j = 0; j < node[i].n_out_edge; ++j) { 761 --n_edge; 762 if (--node[node[i].out_edge[j]].n_in_edge == 0) { 763 in[n_in] = node[i].out_edge[j]; 764 ++n_in; 765 } 766 } 767 } 768 if (n_edge) { 769 for (; node_idx < n; ++node_idx) { 770 struct tsnode *cnode = node + node_idx; 771 772 if (cnode->n_in_edge) { 773 for (j = 0; j < cnode->n_out_edge; ++j) { 774 unsigned k = cnode->out_edge[j]; 775 776 if (break_dependency(slot + k, slot + node_idx, 777 copy, n_copy) && 778 --node[k].n_in_edge == 0) { 779 in[n_in] = k; 780 ++n_in; 781 --n_edge; 782 cnode->out_edge[j] = 783 cnode->out_edge[cnode->n_out_edge - 1]; 784 --cnode->n_out_edge; 785 goto again; 786 } 787 } 788 } 789 } 790 } 791 return n_edge == 0; 792 } 793 794 static void opcode_add_resource(struct slot_prop *op, 795 uint32_t resource, char direction, 796 int index) 797 { 798 switch (direction) { 799 case 'm': 800 case 'i': 801 assert(op->n_in < ARRAY_SIZE(op->in)); 802 op->in[op->n_in].resource = resource; 803 op->in[op->n_in].index = index; 804 ++op->n_in; 805 /* fall through */ 806 case 'o': 807 if (direction == 'm' || direction == 'o') { 808 assert(op->n_out < ARRAY_SIZE(op->out)); 809 op->out[op->n_out].resource = resource; 810 op->out[op->n_out].index = index; 811 ++op->n_out; 812 } 813 break; 814 default: 815 g_assert_not_reached(); 816 } 817 } 818 819 static int resource_compare(const void *a, const void *b) 820 { 821 const struct opcode_arg_info *pa = a; 822 const struct opcode_arg_info *pb = b; 823 824 return pa->resource < pb->resource ? 825 -1 : (pa->resource > pb->resource ? 1 : 0); 826 } 827 828 static int arg_copy_compare(const void *a, const void *b) 829 { 830 const struct opcode_arg_copy *pa = a; 831 const struct opcode_arg_copy *pb = b; 832 833 return pa->resource < pb->resource ? 834 -1 : (pa->resource > pb->resource ? 1 : 0); 835 } 836 837 static void disas_xtensa_insn(CPUXtensaState *env, DisasContext *dc) 838 { 839 xtensa_isa isa = dc->config->isa; 840 unsigned char b[MAX_INSN_LENGTH] = {translator_ldub(env, &dc->base, 841 dc->pc)}; 842 unsigned len = xtensa_op0_insn_len(dc, b[0]); 843 xtensa_format fmt; 844 int slot, slots; 845 unsigned i; 846 uint32_t op_flags = 0; 847 struct slot_prop slot_prop[MAX_INSN_SLOTS]; 848 struct slot_prop *ordered[MAX_INSN_SLOTS]; 849 struct opcode_arg_copy arg_copy[MAX_INSN_SLOTS * MAX_OPCODE_ARGS]; 850 unsigned n_arg_copy = 0; 851 uint32_t debug_cause = 0; 852 uint32_t windowed_register = 0; 853 uint32_t coprocessor = 0; 854 855 if (len == XTENSA_UNDEFINED) { 856 qemu_log_mask(LOG_GUEST_ERROR, 857 "unknown instruction length (pc = %08x)\n", 858 dc->pc); 859 gen_exception_cause(dc, ILLEGAL_INSTRUCTION_CAUSE); 860 dc->base.pc_next = dc->pc + 1; 861 return; 862 } 863 864 dc->base.pc_next = dc->pc + len; 865 for (i = 1; i < len; ++i) { 866 b[i] = translator_ldub(env, &dc->base, dc->pc + i); 867 } 868 xtensa_insnbuf_from_chars(isa, dc->insnbuf, b, len); 869 fmt = xtensa_format_decode(isa, dc->insnbuf); 870 if (fmt == XTENSA_UNDEFINED) { 871 qemu_log_mask(LOG_GUEST_ERROR, 872 "unrecognized instruction format (pc = %08x)\n", 873 dc->pc); 874 gen_exception_cause(dc, ILLEGAL_INSTRUCTION_CAUSE); 875 return; 876 } 877 slots = xtensa_format_num_slots(isa, fmt); 878 for (slot = 0; slot < slots; ++slot) { 879 xtensa_opcode opc; 880 int opnd, vopnd, opnds; 881 OpcodeArg *arg = slot_prop[slot].arg; 882 XtensaOpcodeOps *ops; 883 884 xtensa_format_get_slot(isa, fmt, slot, dc->insnbuf, dc->slotbuf); 885 opc = xtensa_opcode_decode(isa, fmt, slot, dc->slotbuf); 886 if (opc == XTENSA_UNDEFINED) { 887 qemu_log_mask(LOG_GUEST_ERROR, 888 "unrecognized opcode in slot %d (pc = %08x)\n", 889 slot, dc->pc); 890 gen_exception_cause(dc, ILLEGAL_INSTRUCTION_CAUSE); 891 return; 892 } 893 opnds = xtensa_opcode_num_operands(isa, opc); 894 895 for (opnd = vopnd = 0; opnd < opnds; ++opnd) { 896 void **register_file = NULL; 897 xtensa_regfile rf; 898 899 if (xtensa_operand_is_register(isa, opc, opnd)) { 900 rf = xtensa_operand_regfile(isa, opc, opnd); 901 register_file = dc->config->regfile[rf]; 902 903 if (rf == dc->config->a_regfile) { 904 uint32_t v; 905 906 xtensa_operand_get_field(isa, opc, opnd, fmt, slot, 907 dc->slotbuf, &v); 908 xtensa_operand_decode(isa, opc, opnd, &v); 909 windowed_register |= 1u << v; 910 } 911 } 912 if (xtensa_operand_is_visible(isa, opc, opnd)) { 913 uint32_t v; 914 915 xtensa_operand_get_field(isa, opc, opnd, fmt, slot, 916 dc->slotbuf, &v); 917 xtensa_operand_decode(isa, opc, opnd, &v); 918 arg[vopnd].raw_imm = v; 919 if (xtensa_operand_is_PCrelative(isa, opc, opnd)) { 920 xtensa_operand_undo_reloc(isa, opc, opnd, &v, dc->pc); 921 } 922 arg[vopnd].imm = v; 923 if (register_file) { 924 arg[vopnd].in = register_file[v]; 925 arg[vopnd].out = register_file[v]; 926 arg[vopnd].num_bits = xtensa_regfile_num_bits(isa, rf); 927 } else { 928 arg[vopnd].num_bits = 32; 929 } 930 ++vopnd; 931 } 932 } 933 ops = dc->config->opcode_ops[opc]; 934 slot_prop[slot].ops = ops; 935 936 if (ops) { 937 op_flags |= ops->op_flags; 938 if (ops->test_exceptions) { 939 op_flags |= ops->test_exceptions(dc, arg, ops->par); 940 } 941 } else { 942 qemu_log_mask(LOG_UNIMP, 943 "unimplemented opcode '%s' in slot %d (pc = %08x)\n", 944 xtensa_opcode_name(isa, opc), slot, dc->pc); 945 op_flags |= XTENSA_OP_ILL; 946 } 947 if (op_flags & XTENSA_OP_ILL) { 948 gen_exception_cause(dc, ILLEGAL_INSTRUCTION_CAUSE); 949 return; 950 } 951 if (op_flags & XTENSA_OP_DEBUG_BREAK) { 952 debug_cause |= ops->par[0]; 953 } 954 if (ops->test_overflow) { 955 windowed_register |= ops->test_overflow(dc, arg, ops->par); 956 } 957 coprocessor |= ops->coprocessor; 958 959 if (slots > 1) { 960 slot_prop[slot].n_in = 0; 961 slot_prop[slot].n_out = 0; 962 slot_prop[slot].op_flags = ops->op_flags & XTENSA_OP_LOAD_STORE; 963 964 opnds = xtensa_opcode_num_operands(isa, opc); 965 966 for (opnd = vopnd = 0; opnd < opnds; ++opnd) { 967 bool visible = xtensa_operand_is_visible(isa, opc, opnd); 968 969 if (xtensa_operand_is_register(isa, opc, opnd)) { 970 xtensa_regfile rf = xtensa_operand_regfile(isa, opc, opnd); 971 uint32_t v = 0; 972 973 xtensa_operand_get_field(isa, opc, opnd, fmt, slot, 974 dc->slotbuf, &v); 975 xtensa_operand_decode(isa, opc, opnd, &v); 976 opcode_add_resource(slot_prop + slot, 977 encode_resource(RES_REGFILE, rf, v), 978 xtensa_operand_inout(isa, opc, opnd), 979 visible ? vopnd : -1); 980 } 981 if (visible) { 982 ++vopnd; 983 } 984 } 985 986 opnds = xtensa_opcode_num_stateOperands(isa, opc); 987 988 for (opnd = 0; opnd < opnds; ++opnd) { 989 xtensa_state state = xtensa_stateOperand_state(isa, opc, opnd); 990 991 opcode_add_resource(slot_prop + slot, 992 encode_resource(RES_STATE, 0, state), 993 xtensa_stateOperand_inout(isa, opc, opnd), 994 -1); 995 } 996 if (xtensa_opcode_is_branch(isa, opc) || 997 xtensa_opcode_is_jump(isa, opc) || 998 xtensa_opcode_is_loop(isa, opc) || 999 xtensa_opcode_is_call(isa, opc)) { 1000 slot_prop[slot].op_flags |= XTENSA_OP_CONTROL_FLOW; 1001 } 1002 1003 qsort(slot_prop[slot].in, slot_prop[slot].n_in, 1004 sizeof(slot_prop[slot].in[0]), resource_compare); 1005 qsort(slot_prop[slot].out, slot_prop[slot].n_out, 1006 sizeof(slot_prop[slot].out[0]), resource_compare); 1007 } 1008 } 1009 1010 if (slots > 1) { 1011 if (!tsort(slot_prop, ordered, slots, arg_copy, &n_arg_copy)) { 1012 qemu_log_mask(LOG_UNIMP, 1013 "Circular resource dependencies (pc = %08x)\n", 1014 dc->pc); 1015 gen_exception_cause(dc, ILLEGAL_INSTRUCTION_CAUSE); 1016 return; 1017 } 1018 } else { 1019 ordered[0] = slot_prop + 0; 1020 } 1021 1022 if ((op_flags & XTENSA_OP_PRIVILEGED) && 1023 !gen_check_privilege(dc)) { 1024 return; 1025 } 1026 1027 if (op_flags & XTENSA_OP_SYSCALL) { 1028 gen_exception_cause(dc, SYSCALL_CAUSE); 1029 return; 1030 } 1031 1032 if ((op_flags & XTENSA_OP_DEBUG_BREAK) && dc->debug) { 1033 gen_debug_exception(dc, debug_cause); 1034 return; 1035 } 1036 1037 if (windowed_register && !gen_window_check(dc, windowed_register)) { 1038 return; 1039 } 1040 1041 if (op_flags & XTENSA_OP_UNDERFLOW) { 1042 TCGv_i32 pc = tcg_constant_i32(dc->pc); 1043 1044 gen_helper_test_underflow_retw(tcg_env, pc); 1045 } 1046 1047 if (op_flags & XTENSA_OP_ALLOCA) { 1048 TCGv_i32 pc = tcg_constant_i32(dc->pc); 1049 1050 gen_helper_movsp(tcg_env, pc); 1051 } 1052 1053 if (coprocessor && !gen_check_cpenable(dc, coprocessor)) { 1054 return; 1055 } 1056 1057 if (n_arg_copy) { 1058 uint32_t resource; 1059 void *temp; 1060 unsigned j; 1061 1062 qsort(arg_copy, n_arg_copy, sizeof(*arg_copy), arg_copy_compare); 1063 for (i = j = 0; i < n_arg_copy; ++i) { 1064 if (i == 0 || arg_copy[i].resource != resource) { 1065 resource = arg_copy[i].resource; 1066 if (arg_copy[i].arg->num_bits <= 32) { 1067 temp = tcg_temp_new_i32(); 1068 tcg_gen_mov_i32(temp, arg_copy[i].arg->in); 1069 } else if (arg_copy[i].arg->num_bits <= 64) { 1070 temp = tcg_temp_new_i64(); 1071 tcg_gen_mov_i64(temp, arg_copy[i].arg->in); 1072 } else { 1073 g_assert_not_reached(); 1074 } 1075 arg_copy[i].temp = temp; 1076 1077 if (i != j) { 1078 arg_copy[j] = arg_copy[i]; 1079 } 1080 ++j; 1081 } 1082 arg_copy[i].arg->in = temp; 1083 } 1084 n_arg_copy = j; 1085 } 1086 1087 if (op_flags & XTENSA_OP_DIVIDE_BY_ZERO) { 1088 for (slot = 0; slot < slots; ++slot) { 1089 if (slot_prop[slot].ops->op_flags & XTENSA_OP_DIVIDE_BY_ZERO) { 1090 gen_zero_check(dc, slot_prop[slot].arg); 1091 } 1092 } 1093 } 1094 1095 dc->op_flags = op_flags; 1096 1097 for (slot = 0; slot < slots; ++slot) { 1098 struct slot_prop *pslot = ordered[slot]; 1099 XtensaOpcodeOps *ops = pslot->ops; 1100 1101 ops->translate(dc, pslot->arg, ops->par); 1102 } 1103 1104 if (dc->base.is_jmp == DISAS_NEXT) { 1105 gen_postprocess(dc, 0); 1106 dc->op_flags = 0; 1107 if (op_flags & XTENSA_OP_EXIT_TB_M1) { 1108 /* Change in mmu index, memory mapping or tb->flags; exit tb */ 1109 gen_jumpi_check_loop_end(dc, -1); 1110 } else if (op_flags & XTENSA_OP_EXIT_TB_0) { 1111 gen_jumpi_check_loop_end(dc, 0); 1112 } else { 1113 gen_check_loop_end(dc, 0); 1114 } 1115 } 1116 dc->pc = dc->base.pc_next; 1117 } 1118 1119 static inline unsigned xtensa_insn_len(CPUXtensaState *env, DisasContext *dc) 1120 { 1121 uint8_t b0 = cpu_ldub_code(env, dc->pc); 1122 return xtensa_op0_insn_len(dc, b0); 1123 } 1124 1125 static void xtensa_tr_init_disas_context(DisasContextBase *dcbase, 1126 CPUState *cpu) 1127 { 1128 DisasContext *dc = container_of(dcbase, DisasContext, base); 1129 uint32_t tb_flags = dc->base.tb->flags; 1130 1131 dc->config = cpu_env(cpu)->config; 1132 dc->pc = dc->base.pc_first; 1133 dc->ring = tb_flags & XTENSA_TBFLAG_RING_MASK; 1134 dc->cring = (tb_flags & XTENSA_TBFLAG_EXCM) ? 0 : dc->ring; 1135 dc->lbeg_off = (dc->base.tb->cs_base & XTENSA_CSBASE_LBEG_OFF_MASK) >> 1136 XTENSA_CSBASE_LBEG_OFF_SHIFT; 1137 dc->lend = (dc->base.tb->cs_base & XTENSA_CSBASE_LEND_MASK) + 1138 (dc->base.pc_first & TARGET_PAGE_MASK); 1139 dc->debug = tb_flags & XTENSA_TBFLAG_DEBUG; 1140 dc->icount = tb_flags & XTENSA_TBFLAG_ICOUNT; 1141 dc->cpenable = (tb_flags & XTENSA_TBFLAG_CPENABLE_MASK) >> 1142 XTENSA_TBFLAG_CPENABLE_SHIFT; 1143 dc->window = ((tb_flags & XTENSA_TBFLAG_WINDOW_MASK) >> 1144 XTENSA_TBFLAG_WINDOW_SHIFT); 1145 dc->cwoe = tb_flags & XTENSA_TBFLAG_CWOE; 1146 dc->callinc = ((tb_flags & XTENSA_TBFLAG_CALLINC_MASK) >> 1147 XTENSA_TBFLAG_CALLINC_SHIFT); 1148 init_sar_tracker(dc); 1149 } 1150 1151 static void xtensa_tr_tb_start(DisasContextBase *dcbase, CPUState *cpu) 1152 { 1153 DisasContext *dc = container_of(dcbase, DisasContext, base); 1154 1155 if (dc->icount) { 1156 dc->next_icount = tcg_temp_new_i32(); 1157 } 1158 } 1159 1160 static void xtensa_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) 1161 { 1162 tcg_gen_insn_start(dcbase->pc_next); 1163 } 1164 1165 static void xtensa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) 1166 { 1167 DisasContext *dc = container_of(dcbase, DisasContext, base); 1168 CPUXtensaState *env = cpu_env(cpu); 1169 target_ulong page_start; 1170 1171 /* These two conditions only apply to the first insn in the TB, 1172 but this is the first TranslateOps hook that allows exiting. */ 1173 if ((tb_cflags(dc->base.tb) & CF_USE_ICOUNT) 1174 && (dc->base.tb->flags & XTENSA_TBFLAG_YIELD)) { 1175 gen_exception(dc, EXCP_YIELD); 1176 dc->base.pc_next = dc->pc + 1; 1177 dc->base.is_jmp = DISAS_NORETURN; 1178 return; 1179 } 1180 1181 if (dc->icount) { 1182 TCGLabel *label = gen_new_label(); 1183 1184 tcg_gen_addi_i32(dc->next_icount, cpu_SR[ICOUNT], 1); 1185 tcg_gen_brcondi_i32(TCG_COND_NE, dc->next_icount, 0, label); 1186 tcg_gen_mov_i32(dc->next_icount, cpu_SR[ICOUNT]); 1187 if (dc->debug) { 1188 gen_debug_exception(dc, DEBUGCAUSE_IC); 1189 } 1190 gen_set_label(label); 1191 } 1192 1193 disas_xtensa_insn(env, dc); 1194 1195 if (dc->icount) { 1196 tcg_gen_mov_i32(cpu_SR[ICOUNT], dc->next_icount); 1197 } 1198 1199 /* End the TB if the next insn will cross into the next page. */ 1200 page_start = dc->base.pc_first & TARGET_PAGE_MASK; 1201 if (dc->base.is_jmp == DISAS_NEXT && 1202 (dc->pc - page_start >= TARGET_PAGE_SIZE || 1203 dc->pc - page_start + xtensa_insn_len(env, dc) > TARGET_PAGE_SIZE)) { 1204 dc->base.is_jmp = DISAS_TOO_MANY; 1205 } 1206 } 1207 1208 static void xtensa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) 1209 { 1210 DisasContext *dc = container_of(dcbase, DisasContext, base); 1211 1212 switch (dc->base.is_jmp) { 1213 case DISAS_NORETURN: 1214 break; 1215 case DISAS_TOO_MANY: 1216 gen_jumpi(dc, dc->pc, 0); 1217 break; 1218 default: 1219 g_assert_not_reached(); 1220 } 1221 } 1222 1223 static const TranslatorOps xtensa_translator_ops = { 1224 .init_disas_context = xtensa_tr_init_disas_context, 1225 .tb_start = xtensa_tr_tb_start, 1226 .insn_start = xtensa_tr_insn_start, 1227 .translate_insn = xtensa_tr_translate_insn, 1228 .tb_stop = xtensa_tr_tb_stop, 1229 }; 1230 1231 void gen_intermediate_code(CPUState *cpu, TranslationBlock *tb, int *max_insns, 1232 vaddr pc, void *host_pc) 1233 { 1234 DisasContext dc = {}; 1235 translator_loop(cpu, tb, max_insns, pc, host_pc, 1236 &xtensa_translator_ops, &dc.base); 1237 } 1238 1239 void xtensa_cpu_dump_state(CPUState *cs, FILE *f, int flags) 1240 { 1241 CPUXtensaState *env = cpu_env(cs); 1242 xtensa_isa isa = env->config->isa; 1243 int i, j; 1244 1245 qemu_fprintf(f, "PC=%08x\n\n", env->pc); 1246 1247 for (i = j = 0; i < xtensa_isa_num_sysregs(isa); ++i) { 1248 const uint32_t *reg = 1249 xtensa_sysreg_is_user(isa, i) ? env->uregs : env->sregs; 1250 int regno = xtensa_sysreg_number(isa, i); 1251 1252 if (regno >= 0) { 1253 qemu_fprintf(f, "%12s=%08x%c", 1254 xtensa_sysreg_name(isa, i), 1255 reg[regno], 1256 (j++ % 4) == 3 ? '\n' : ' '); 1257 } 1258 } 1259 1260 qemu_fprintf(f, (j % 4) == 0 ? "\n" : "\n\n"); 1261 1262 for (i = 0; i < 16; ++i) { 1263 qemu_fprintf(f, " A%02d=%08x%c", 1264 i, env->regs[i], (i % 4) == 3 ? '\n' : ' '); 1265 } 1266 1267 xtensa_sync_phys_from_window(env); 1268 qemu_fprintf(f, "\n"); 1269 1270 for (i = 0; i < env->config->nareg; ++i) { 1271 qemu_fprintf(f, "AR%02d=%08x ", i, env->phys_regs[i]); 1272 if (i % 4 == 3) { 1273 bool ws = (env->sregs[WINDOW_START] & (1 << (i / 4))) != 0; 1274 bool cw = env->sregs[WINDOW_BASE] == i / 4; 1275 1276 qemu_fprintf(f, "%c%c\n", ws ? '<' : ' ', cw ? '=' : ' '); 1277 } 1278 } 1279 1280 if ((flags & CPU_DUMP_FPU) && 1281 xtensa_option_enabled(env->config, XTENSA_OPTION_FP_COPROCESSOR)) { 1282 qemu_fprintf(f, "\n"); 1283 1284 for (i = 0; i < 16; ++i) { 1285 qemu_fprintf(f, "F%02d=%08x (%-+15.8e)%c", i, 1286 float32_val(env->fregs[i].f32[FP_F32_LOW]), 1287 *(float *)(env->fregs[i].f32 + FP_F32_LOW), 1288 (i % 2) == 1 ? '\n' : ' '); 1289 } 1290 } 1291 1292 if ((flags & CPU_DUMP_FPU) && 1293 xtensa_option_enabled(env->config, XTENSA_OPTION_DFP_COPROCESSOR) && 1294 !xtensa_option_enabled(env->config, XTENSA_OPTION_DFPU_SINGLE_ONLY)) { 1295 qemu_fprintf(f, "\n"); 1296 1297 for (i = 0; i < 16; ++i) { 1298 qemu_fprintf(f, "F%02d=%016"PRIx64" (%-+24.16le)%c", i, 1299 float64_val(env->fregs[i].f64), 1300 *(double *)(&env->fregs[i].f64), 1301 (i % 2) == 1 ? '\n' : ' '); 1302 } 1303 } 1304 } 1305 1306 static void translate_abs(DisasContext *dc, const OpcodeArg arg[], 1307 const uint32_t par[]) 1308 { 1309 tcg_gen_abs_i32(arg[0].out, arg[1].in); 1310 } 1311 1312 static void translate_add(DisasContext *dc, const OpcodeArg arg[], 1313 const uint32_t par[]) 1314 { 1315 tcg_gen_add_i32(arg[0].out, arg[1].in, arg[2].in); 1316 } 1317 1318 static void translate_addi(DisasContext *dc, const OpcodeArg arg[], 1319 const uint32_t par[]) 1320 { 1321 tcg_gen_addi_i32(arg[0].out, arg[1].in, arg[2].imm); 1322 } 1323 1324 static void translate_addx(DisasContext *dc, const OpcodeArg arg[], 1325 const uint32_t par[]) 1326 { 1327 TCGv_i32 tmp = tcg_temp_new_i32(); 1328 tcg_gen_shli_i32(tmp, arg[1].in, par[0]); 1329 tcg_gen_add_i32(arg[0].out, tmp, arg[2].in); 1330 } 1331 1332 static void translate_all(DisasContext *dc, const OpcodeArg arg[], 1333 const uint32_t par[]) 1334 { 1335 uint32_t shift = par[1]; 1336 TCGv_i32 mask = tcg_constant_i32(((1 << shift) - 1) << arg[1].imm); 1337 TCGv_i32 tmp = tcg_temp_new_i32(); 1338 1339 tcg_gen_and_i32(tmp, arg[1].in, mask); 1340 if (par[0]) { 1341 tcg_gen_addi_i32(tmp, tmp, 1 << arg[1].imm); 1342 } else { 1343 tcg_gen_add_i32(tmp, tmp, mask); 1344 } 1345 tcg_gen_shri_i32(tmp, tmp, arg[1].imm + shift); 1346 tcg_gen_deposit_i32(arg[0].out, arg[0].out, 1347 tmp, arg[0].imm, 1); 1348 } 1349 1350 static void translate_and(DisasContext *dc, const OpcodeArg arg[], 1351 const uint32_t par[]) 1352 { 1353 tcg_gen_and_i32(arg[0].out, arg[1].in, arg[2].in); 1354 } 1355 1356 static void translate_ball(DisasContext *dc, const OpcodeArg arg[], 1357 const uint32_t par[]) 1358 { 1359 TCGv_i32 tmp = tcg_temp_new_i32(); 1360 tcg_gen_and_i32(tmp, arg[0].in, arg[1].in); 1361 gen_brcond(dc, par[0], tmp, arg[1].in, arg[2].imm); 1362 } 1363 1364 static void translate_bany(DisasContext *dc, const OpcodeArg arg[], 1365 const uint32_t par[]) 1366 { 1367 TCGv_i32 tmp = tcg_temp_new_i32(); 1368 tcg_gen_and_i32(tmp, arg[0].in, arg[1].in); 1369 gen_brcondi(dc, par[0], tmp, 0, arg[2].imm); 1370 } 1371 1372 static void translate_b(DisasContext *dc, const OpcodeArg arg[], 1373 const uint32_t par[]) 1374 { 1375 gen_brcond(dc, par[0], arg[0].in, arg[1].in, arg[2].imm); 1376 } 1377 1378 static void translate_bb(DisasContext *dc, const OpcodeArg arg[], 1379 const uint32_t par[]) 1380 { 1381 TCGv_i32 tmp = tcg_temp_new_i32(); 1382 1383 tcg_gen_andi_i32(tmp, arg[1].in, 0x1f); 1384 if (TARGET_BIG_ENDIAN) { 1385 tcg_gen_shr_i32(tmp, tcg_constant_i32(0x80000000u), tmp); 1386 } else { 1387 tcg_gen_shl_i32(tmp, tcg_constant_i32(0x00000001u), tmp); 1388 } 1389 tcg_gen_and_i32(tmp, arg[0].in, tmp); 1390 gen_brcondi(dc, par[0], tmp, 0, arg[2].imm); 1391 } 1392 1393 static void translate_bbi(DisasContext *dc, const OpcodeArg arg[], 1394 const uint32_t par[]) 1395 { 1396 TCGv_i32 tmp = tcg_temp_new_i32(); 1397 #if TARGET_BIG_ENDIAN 1398 tcg_gen_andi_i32(tmp, arg[0].in, 0x80000000u >> arg[1].imm); 1399 #else 1400 tcg_gen_andi_i32(tmp, arg[0].in, 0x00000001u << arg[1].imm); 1401 #endif 1402 gen_brcondi(dc, par[0], tmp, 0, arg[2].imm); 1403 } 1404 1405 static void translate_bi(DisasContext *dc, const OpcodeArg arg[], 1406 const uint32_t par[]) 1407 { 1408 gen_brcondi(dc, par[0], arg[0].in, arg[1].imm, arg[2].imm); 1409 } 1410 1411 static void translate_bz(DisasContext *dc, const OpcodeArg arg[], 1412 const uint32_t par[]) 1413 { 1414 gen_brcondi(dc, par[0], arg[0].in, 0, arg[1].imm); 1415 } 1416 1417 enum { 1418 BOOLEAN_AND, 1419 BOOLEAN_ANDC, 1420 BOOLEAN_OR, 1421 BOOLEAN_ORC, 1422 BOOLEAN_XOR, 1423 }; 1424 1425 static void translate_boolean(DisasContext *dc, const OpcodeArg arg[], 1426 const uint32_t par[]) 1427 { 1428 static void (* const op[])(TCGv_i32, TCGv_i32, TCGv_i32) = { 1429 [BOOLEAN_AND] = tcg_gen_and_i32, 1430 [BOOLEAN_ANDC] = tcg_gen_andc_i32, 1431 [BOOLEAN_OR] = tcg_gen_or_i32, 1432 [BOOLEAN_ORC] = tcg_gen_orc_i32, 1433 [BOOLEAN_XOR] = tcg_gen_xor_i32, 1434 }; 1435 1436 TCGv_i32 tmp1 = tcg_temp_new_i32(); 1437 TCGv_i32 tmp2 = tcg_temp_new_i32(); 1438 1439 tcg_gen_shri_i32(tmp1, arg[1].in, arg[1].imm); 1440 tcg_gen_shri_i32(tmp2, arg[2].in, arg[2].imm); 1441 op[par[0]](tmp1, tmp1, tmp2); 1442 tcg_gen_deposit_i32(arg[0].out, arg[0].out, tmp1, arg[0].imm, 1); 1443 } 1444 1445 static void translate_bp(DisasContext *dc, const OpcodeArg arg[], 1446 const uint32_t par[]) 1447 { 1448 TCGv_i32 tmp = tcg_temp_new_i32(); 1449 1450 tcg_gen_andi_i32(tmp, arg[0].in, 1 << arg[0].imm); 1451 gen_brcondi(dc, par[0], tmp, 0, arg[1].imm); 1452 } 1453 1454 static void translate_call0(DisasContext *dc, const OpcodeArg arg[], 1455 const uint32_t par[]) 1456 { 1457 tcg_gen_movi_i32(cpu_R[0], dc->base.pc_next); 1458 gen_jumpi(dc, arg[0].imm, 0); 1459 } 1460 1461 static void translate_callw(DisasContext *dc, const OpcodeArg arg[], 1462 const uint32_t par[]) 1463 { 1464 TCGv_i32 tmp = tcg_constant_i32(arg[0].imm); 1465 gen_callw_slot(dc, par[0], tmp, adjust_jump_slot(dc, arg[0].imm, 0)); 1466 } 1467 1468 static void translate_callx0(DisasContext *dc, const OpcodeArg arg[], 1469 const uint32_t par[]) 1470 { 1471 TCGv_i32 tmp = tcg_temp_new_i32(); 1472 tcg_gen_mov_i32(tmp, arg[0].in); 1473 tcg_gen_movi_i32(cpu_R[0], dc->base.pc_next); 1474 gen_jump(dc, tmp); 1475 } 1476 1477 static void translate_callxw(DisasContext *dc, const OpcodeArg arg[], 1478 const uint32_t par[]) 1479 { 1480 TCGv_i32 tmp = tcg_temp_new_i32(); 1481 1482 tcg_gen_mov_i32(tmp, arg[0].in); 1483 gen_callw_slot(dc, par[0], tmp, -1); 1484 } 1485 1486 static void translate_clamps(DisasContext *dc, const OpcodeArg arg[], 1487 const uint32_t par[]) 1488 { 1489 TCGv_i32 tmp1 = tcg_constant_i32(-1u << arg[2].imm); 1490 TCGv_i32 tmp2 = tcg_constant_i32((1 << arg[2].imm) - 1); 1491 1492 tcg_gen_smax_i32(arg[0].out, tmp1, arg[1].in); 1493 tcg_gen_smin_i32(arg[0].out, arg[0].out, tmp2); 1494 } 1495 1496 static void translate_clrb_expstate(DisasContext *dc, const OpcodeArg arg[], 1497 const uint32_t par[]) 1498 { 1499 /* TODO: GPIO32 may be a part of coprocessor */ 1500 tcg_gen_andi_i32(cpu_UR[EXPSTATE], cpu_UR[EXPSTATE], ~(1u << arg[0].imm)); 1501 } 1502 1503 static void translate_clrex(DisasContext *dc, const OpcodeArg arg[], 1504 const uint32_t par[]) 1505 { 1506 tcg_gen_movi_i32(cpu_exclusive_addr, -1); 1507 } 1508 1509 static void translate_const16(DisasContext *dc, const OpcodeArg arg[], 1510 const uint32_t par[]) 1511 { 1512 TCGv_i32 c = tcg_constant_i32(arg[1].imm); 1513 1514 tcg_gen_deposit_i32(arg[0].out, c, arg[0].in, 16, 16); 1515 } 1516 1517 static void translate_dcache(DisasContext *dc, const OpcodeArg arg[], 1518 const uint32_t par[]) 1519 { 1520 TCGv_i32 addr = tcg_temp_new_i32(); 1521 TCGv_i32 res = tcg_temp_new_i32(); 1522 1523 tcg_gen_addi_i32(addr, arg[0].in, arg[1].imm); 1524 tcg_gen_qemu_ld_i32(res, addr, dc->cring, MO_UB); 1525 } 1526 1527 static void translate_depbits(DisasContext *dc, const OpcodeArg arg[], 1528 const uint32_t par[]) 1529 { 1530 tcg_gen_deposit_i32(arg[1].out, arg[1].in, arg[0].in, 1531 arg[2].imm, arg[3].imm); 1532 } 1533 1534 static void translate_diwbuip(DisasContext *dc, const OpcodeArg arg[], 1535 const uint32_t par[]) 1536 { 1537 tcg_gen_addi_i32(arg[0].out, arg[0].in, dc->config->dcache_line_bytes); 1538 } 1539 1540 static uint32_t test_exceptions_entry(DisasContext *dc, const OpcodeArg arg[], 1541 const uint32_t par[]) 1542 { 1543 if (arg[0].imm > 3 || !dc->cwoe) { 1544 qemu_log_mask(LOG_GUEST_ERROR, 1545 "Illegal entry instruction(pc = %08x)\n", dc->pc); 1546 return XTENSA_OP_ILL; 1547 } else { 1548 return 0; 1549 } 1550 } 1551 1552 static uint32_t test_overflow_entry(DisasContext *dc, const OpcodeArg arg[], 1553 const uint32_t par[]) 1554 { 1555 return 1 << (dc->callinc * 4); 1556 } 1557 1558 static void translate_entry(DisasContext *dc, const OpcodeArg arg[], 1559 const uint32_t par[]) 1560 { 1561 TCGv_i32 pc = tcg_constant_i32(dc->pc); 1562 TCGv_i32 s = tcg_constant_i32(arg[0].imm); 1563 TCGv_i32 imm = tcg_constant_i32(arg[1].imm); 1564 gen_helper_entry(tcg_env, pc, s, imm); 1565 } 1566 1567 static void translate_extui(DisasContext *dc, const OpcodeArg arg[], 1568 const uint32_t par[]) 1569 { 1570 int maskimm = (1 << arg[3].imm) - 1; 1571 1572 TCGv_i32 tmp = tcg_temp_new_i32(); 1573 tcg_gen_shri_i32(tmp, arg[1].in, arg[2].imm); 1574 tcg_gen_andi_i32(arg[0].out, tmp, maskimm); 1575 } 1576 1577 static void translate_getex(DisasContext *dc, const OpcodeArg arg[], 1578 const uint32_t par[]) 1579 { 1580 TCGv_i32 tmp = tcg_temp_new_i32(); 1581 1582 tcg_gen_extract_i32(tmp, cpu_SR[ATOMCTL], 8, 1); 1583 tcg_gen_deposit_i32(cpu_SR[ATOMCTL], cpu_SR[ATOMCTL], arg[0].in, 8, 1); 1584 tcg_gen_mov_i32(arg[0].out, tmp); 1585 } 1586 1587 static void translate_icache(DisasContext *dc, const OpcodeArg arg[], 1588 const uint32_t par[]) 1589 { 1590 #ifndef CONFIG_USER_ONLY 1591 TCGv_i32 addr = tcg_temp_new_i32(); 1592 1593 tcg_gen_movi_i32(cpu_pc, dc->pc); 1594 tcg_gen_addi_i32(addr, arg[0].in, arg[1].imm); 1595 gen_helper_itlb_hit_test(tcg_env, addr); 1596 #endif 1597 } 1598 1599 static void translate_itlb(DisasContext *dc, const OpcodeArg arg[], 1600 const uint32_t par[]) 1601 { 1602 #ifndef CONFIG_USER_ONLY 1603 TCGv_i32 dtlb = tcg_constant_i32(par[0]); 1604 1605 gen_helper_itlb(tcg_env, arg[0].in, dtlb); 1606 #endif 1607 } 1608 1609 static void translate_j(DisasContext *dc, const OpcodeArg arg[], 1610 const uint32_t par[]) 1611 { 1612 gen_jumpi(dc, arg[0].imm, 0); 1613 } 1614 1615 static void translate_jx(DisasContext *dc, const OpcodeArg arg[], 1616 const uint32_t par[]) 1617 { 1618 gen_jump(dc, arg[0].in); 1619 } 1620 1621 static void translate_l32e(DisasContext *dc, const OpcodeArg arg[], 1622 const uint32_t par[]) 1623 { 1624 TCGv_i32 addr = tcg_temp_new_i32(); 1625 MemOp mop; 1626 1627 tcg_gen_addi_i32(addr, arg[1].in, arg[2].imm); 1628 mop = gen_load_store_alignment(dc, MO_TEUL, addr); 1629 tcg_gen_qemu_ld_tl(arg[0].out, addr, dc->ring, mop); 1630 } 1631 1632 #ifdef CONFIG_USER_ONLY 1633 static void gen_check_exclusive(DisasContext *dc, TCGv_i32 addr, bool is_write) 1634 { 1635 } 1636 #else 1637 static void gen_check_exclusive(DisasContext *dc, TCGv_i32 addr, bool is_write) 1638 { 1639 if (!option_enabled(dc, XTENSA_OPTION_MPU)) { 1640 TCGv_i32 pc = tcg_constant_i32(dc->pc); 1641 1642 gen_helper_check_exclusive(tcg_env, pc, addr, 1643 tcg_constant_i32(is_write)); 1644 } 1645 } 1646 #endif 1647 1648 static void translate_l32ex(DisasContext *dc, const OpcodeArg arg[], 1649 const uint32_t par[]) 1650 { 1651 TCGv_i32 addr = tcg_temp_new_i32(); 1652 MemOp mop; 1653 1654 tcg_gen_mov_i32(addr, arg[1].in); 1655 mop = gen_load_store_alignment(dc, MO_TEUL | MO_ALIGN, addr); 1656 gen_check_exclusive(dc, addr, false); 1657 tcg_gen_qemu_ld_i32(arg[0].out, addr, dc->cring, mop); 1658 tcg_gen_mov_i32(cpu_exclusive_addr, addr); 1659 tcg_gen_mov_i32(cpu_exclusive_val, arg[0].out); 1660 } 1661 1662 static void translate_ldst(DisasContext *dc, const OpcodeArg arg[], 1663 const uint32_t par[]) 1664 { 1665 TCGv_i32 addr = tcg_temp_new_i32(); 1666 MemOp mop; 1667 1668 tcg_gen_addi_i32(addr, arg[1].in, arg[2].imm); 1669 mop = gen_load_store_alignment(dc, par[0], addr); 1670 1671 if (par[2]) { 1672 if (par[1]) { 1673 tcg_gen_mb(TCG_BAR_STRL | TCG_MO_ALL); 1674 } 1675 tcg_gen_qemu_st_tl(arg[0].in, addr, dc->cring, mop); 1676 } else { 1677 tcg_gen_qemu_ld_tl(arg[0].out, addr, dc->cring, mop); 1678 if (par[1]) { 1679 tcg_gen_mb(TCG_BAR_LDAQ | TCG_MO_ALL); 1680 } 1681 } 1682 } 1683 1684 static void translate_lct(DisasContext *dc, const OpcodeArg arg[], 1685 const uint32_t par[]) 1686 { 1687 tcg_gen_movi_i32(arg[0].out, 0); 1688 } 1689 1690 static void translate_l32r(DisasContext *dc, const OpcodeArg arg[], 1691 const uint32_t par[]) 1692 { 1693 TCGv_i32 tmp; 1694 1695 if (dc->base.tb->flags & XTENSA_TBFLAG_LITBASE) { 1696 tmp = tcg_temp_new(); 1697 tcg_gen_addi_i32(tmp, cpu_SR[LITBASE], arg[1].raw_imm - 1); 1698 } else { 1699 tmp = tcg_constant_i32(arg[1].imm); 1700 } 1701 tcg_gen_qemu_ld_i32(arg[0].out, tmp, dc->cring, MO_TEUL); 1702 } 1703 1704 static void translate_loop(DisasContext *dc, const OpcodeArg arg[], 1705 const uint32_t par[]) 1706 { 1707 uint32_t lend = arg[1].imm; 1708 1709 tcg_gen_subi_i32(cpu_SR[LCOUNT], arg[0].in, 1); 1710 tcg_gen_movi_i32(cpu_SR[LBEG], dc->base.pc_next); 1711 tcg_gen_movi_i32(cpu_SR[LEND], lend); 1712 1713 if (par[0] != TCG_COND_NEVER) { 1714 TCGLabel *label = gen_new_label(); 1715 tcg_gen_brcondi_i32(par[0], arg[0].in, 0, label); 1716 gen_jumpi(dc, lend, 1); 1717 gen_set_label(label); 1718 } 1719 1720 gen_jumpi(dc, dc->base.pc_next, 0); 1721 } 1722 1723 enum { 1724 MAC16_UMUL, 1725 MAC16_MUL, 1726 MAC16_MULA, 1727 MAC16_MULS, 1728 MAC16_NONE, 1729 }; 1730 1731 enum { 1732 MAC16_LL, 1733 MAC16_HL, 1734 MAC16_LH, 1735 MAC16_HH, 1736 1737 MAC16_HX = 0x1, 1738 MAC16_XH = 0x2, 1739 }; 1740 1741 static void translate_mac16(DisasContext *dc, const OpcodeArg arg[], 1742 const uint32_t par[]) 1743 { 1744 int op = par[0]; 1745 unsigned half = par[1]; 1746 uint32_t ld_offset = par[2]; 1747 unsigned off = ld_offset ? 2 : 0; 1748 TCGv_i32 vaddr = tcg_temp_new_i32(); 1749 TCGv_i32 mem32 = tcg_temp_new_i32(); 1750 1751 if (ld_offset) { 1752 MemOp mop; 1753 1754 tcg_gen_addi_i32(vaddr, arg[1].in, ld_offset); 1755 mop = gen_load_store_alignment(dc, MO_TEUL, vaddr); 1756 tcg_gen_qemu_ld_tl(mem32, vaddr, dc->cring, mop); 1757 } 1758 if (op != MAC16_NONE) { 1759 TCGv_i32 m1 = gen_mac16_m(arg[off].in, 1760 half & MAC16_HX, op == MAC16_UMUL); 1761 TCGv_i32 m2 = gen_mac16_m(arg[off + 1].in, 1762 half & MAC16_XH, op == MAC16_UMUL); 1763 1764 if (op == MAC16_MUL || op == MAC16_UMUL) { 1765 tcg_gen_mul_i32(cpu_SR[ACCLO], m1, m2); 1766 if (op == MAC16_UMUL) { 1767 tcg_gen_movi_i32(cpu_SR[ACCHI], 0); 1768 } else { 1769 tcg_gen_sari_i32(cpu_SR[ACCHI], cpu_SR[ACCLO], 31); 1770 } 1771 } else { 1772 TCGv_i32 lo = tcg_temp_new_i32(); 1773 TCGv_i32 hi = tcg_temp_new_i32(); 1774 1775 tcg_gen_mul_i32(lo, m1, m2); 1776 tcg_gen_sari_i32(hi, lo, 31); 1777 if (op == MAC16_MULA) { 1778 tcg_gen_add2_i32(cpu_SR[ACCLO], cpu_SR[ACCHI], 1779 cpu_SR[ACCLO], cpu_SR[ACCHI], 1780 lo, hi); 1781 } else { 1782 tcg_gen_sub2_i32(cpu_SR[ACCLO], cpu_SR[ACCHI], 1783 cpu_SR[ACCLO], cpu_SR[ACCHI], 1784 lo, hi); 1785 } 1786 tcg_gen_ext8s_i32(cpu_SR[ACCHI], cpu_SR[ACCHI]); 1787 } 1788 } 1789 if (ld_offset) { 1790 tcg_gen_mov_i32(arg[1].out, vaddr); 1791 tcg_gen_mov_i32(cpu_SR[MR + arg[0].imm], mem32); 1792 } 1793 } 1794 1795 static void translate_memw(DisasContext *dc, const OpcodeArg arg[], 1796 const uint32_t par[]) 1797 { 1798 tcg_gen_mb(TCG_BAR_SC | TCG_MO_ALL); 1799 } 1800 1801 static void translate_smin(DisasContext *dc, const OpcodeArg arg[], 1802 const uint32_t par[]) 1803 { 1804 tcg_gen_smin_i32(arg[0].out, arg[1].in, arg[2].in); 1805 } 1806 1807 static void translate_umin(DisasContext *dc, const OpcodeArg arg[], 1808 const uint32_t par[]) 1809 { 1810 tcg_gen_umin_i32(arg[0].out, arg[1].in, arg[2].in); 1811 } 1812 1813 static void translate_smax(DisasContext *dc, const OpcodeArg arg[], 1814 const uint32_t par[]) 1815 { 1816 tcg_gen_smax_i32(arg[0].out, arg[1].in, arg[2].in); 1817 } 1818 1819 static void translate_umax(DisasContext *dc, const OpcodeArg arg[], 1820 const uint32_t par[]) 1821 { 1822 tcg_gen_umax_i32(arg[0].out, arg[1].in, arg[2].in); 1823 } 1824 1825 static void translate_mov(DisasContext *dc, const OpcodeArg arg[], 1826 const uint32_t par[]) 1827 { 1828 tcg_gen_mov_i32(arg[0].out, arg[1].in); 1829 } 1830 1831 static void translate_movcond(DisasContext *dc, const OpcodeArg arg[], 1832 const uint32_t par[]) 1833 { 1834 TCGv_i32 zero = tcg_constant_i32(0); 1835 1836 tcg_gen_movcond_i32(par[0], arg[0].out, 1837 arg[2].in, zero, arg[1].in, arg[0].in); 1838 } 1839 1840 static void translate_movi(DisasContext *dc, const OpcodeArg arg[], 1841 const uint32_t par[]) 1842 { 1843 tcg_gen_movi_i32(arg[0].out, arg[1].imm); 1844 } 1845 1846 static void translate_movp(DisasContext *dc, const OpcodeArg arg[], 1847 const uint32_t par[]) 1848 { 1849 TCGv_i32 zero = tcg_constant_i32(0); 1850 TCGv_i32 tmp = tcg_temp_new_i32(); 1851 1852 tcg_gen_andi_i32(tmp, arg[2].in, 1 << arg[2].imm); 1853 tcg_gen_movcond_i32(par[0], 1854 arg[0].out, tmp, zero, 1855 arg[1].in, arg[0].in); 1856 } 1857 1858 static void translate_movsp(DisasContext *dc, const OpcodeArg arg[], 1859 const uint32_t par[]) 1860 { 1861 tcg_gen_mov_i32(arg[0].out, arg[1].in); 1862 } 1863 1864 static void translate_mul16(DisasContext *dc, const OpcodeArg arg[], 1865 const uint32_t par[]) 1866 { 1867 TCGv_i32 v1 = tcg_temp_new_i32(); 1868 TCGv_i32 v2 = tcg_temp_new_i32(); 1869 1870 if (par[0]) { 1871 tcg_gen_ext16s_i32(v1, arg[1].in); 1872 tcg_gen_ext16s_i32(v2, arg[2].in); 1873 } else { 1874 tcg_gen_ext16u_i32(v1, arg[1].in); 1875 tcg_gen_ext16u_i32(v2, arg[2].in); 1876 } 1877 tcg_gen_mul_i32(arg[0].out, v1, v2); 1878 } 1879 1880 static void translate_mull(DisasContext *dc, const OpcodeArg arg[], 1881 const uint32_t par[]) 1882 { 1883 tcg_gen_mul_i32(arg[0].out, arg[1].in, arg[2].in); 1884 } 1885 1886 static void translate_mulh(DisasContext *dc, const OpcodeArg arg[], 1887 const uint32_t par[]) 1888 { 1889 TCGv_i32 lo = tcg_temp_new(); 1890 1891 if (par[0]) { 1892 tcg_gen_muls2_i32(lo, arg[0].out, arg[1].in, arg[2].in); 1893 } else { 1894 tcg_gen_mulu2_i32(lo, arg[0].out, arg[1].in, arg[2].in); 1895 } 1896 } 1897 1898 static void translate_neg(DisasContext *dc, const OpcodeArg arg[], 1899 const uint32_t par[]) 1900 { 1901 tcg_gen_neg_i32(arg[0].out, arg[1].in); 1902 } 1903 1904 static void translate_nop(DisasContext *dc, const OpcodeArg arg[], 1905 const uint32_t par[]) 1906 { 1907 } 1908 1909 static void translate_nsa(DisasContext *dc, const OpcodeArg arg[], 1910 const uint32_t par[]) 1911 { 1912 tcg_gen_clrsb_i32(arg[0].out, arg[1].in); 1913 } 1914 1915 static void translate_nsau(DisasContext *dc, const OpcodeArg arg[], 1916 const uint32_t par[]) 1917 { 1918 tcg_gen_clzi_i32(arg[0].out, arg[1].in, 32); 1919 } 1920 1921 static void translate_or(DisasContext *dc, const OpcodeArg arg[], 1922 const uint32_t par[]) 1923 { 1924 tcg_gen_or_i32(arg[0].out, arg[1].in, arg[2].in); 1925 } 1926 1927 static void translate_ptlb(DisasContext *dc, const OpcodeArg arg[], 1928 const uint32_t par[]) 1929 { 1930 #ifndef CONFIG_USER_ONLY 1931 TCGv_i32 dtlb = tcg_constant_i32(par[0]); 1932 1933 tcg_gen_movi_i32(cpu_pc, dc->pc); 1934 gen_helper_ptlb(arg[0].out, tcg_env, arg[1].in, dtlb); 1935 #endif 1936 } 1937 1938 static void translate_pptlb(DisasContext *dc, const OpcodeArg arg[], 1939 const uint32_t par[]) 1940 { 1941 #ifndef CONFIG_USER_ONLY 1942 tcg_gen_movi_i32(cpu_pc, dc->pc); 1943 gen_helper_pptlb(arg[0].out, tcg_env, arg[1].in); 1944 #endif 1945 } 1946 1947 static void translate_quos(DisasContext *dc, const OpcodeArg arg[], 1948 const uint32_t par[]) 1949 { 1950 TCGLabel *label1 = gen_new_label(); 1951 TCGLabel *label2 = gen_new_label(); 1952 1953 tcg_gen_brcondi_i32(TCG_COND_NE, arg[1].in, 0x80000000, 1954 label1); 1955 tcg_gen_brcondi_i32(TCG_COND_NE, arg[2].in, 0xffffffff, 1956 label1); 1957 tcg_gen_movi_i32(arg[0].out, 1958 par[0] ? 0x80000000 : 0); 1959 tcg_gen_br(label2); 1960 gen_set_label(label1); 1961 if (par[0]) { 1962 tcg_gen_div_i32(arg[0].out, 1963 arg[1].in, arg[2].in); 1964 } else { 1965 tcg_gen_rem_i32(arg[0].out, 1966 arg[1].in, arg[2].in); 1967 } 1968 gen_set_label(label2); 1969 } 1970 1971 static void translate_quou(DisasContext *dc, const OpcodeArg arg[], 1972 const uint32_t par[]) 1973 { 1974 tcg_gen_divu_i32(arg[0].out, 1975 arg[1].in, arg[2].in); 1976 } 1977 1978 static void translate_read_impwire(DisasContext *dc, const OpcodeArg arg[], 1979 const uint32_t par[]) 1980 { 1981 /* TODO: GPIO32 may be a part of coprocessor */ 1982 tcg_gen_movi_i32(arg[0].out, 0); 1983 } 1984 1985 static void translate_remu(DisasContext *dc, const OpcodeArg arg[], 1986 const uint32_t par[]) 1987 { 1988 tcg_gen_remu_i32(arg[0].out, 1989 arg[1].in, arg[2].in); 1990 } 1991 1992 static void translate_rer(DisasContext *dc, const OpcodeArg arg[], 1993 const uint32_t par[]) 1994 { 1995 gen_helper_rer(arg[0].out, tcg_env, arg[1].in); 1996 } 1997 1998 static void translate_ret(DisasContext *dc, const OpcodeArg arg[], 1999 const uint32_t par[]) 2000 { 2001 gen_jump(dc, cpu_R[0]); 2002 } 2003 2004 static uint32_t test_exceptions_retw(DisasContext *dc, const OpcodeArg arg[], 2005 const uint32_t par[]) 2006 { 2007 if (!dc->cwoe) { 2008 qemu_log_mask(LOG_GUEST_ERROR, 2009 "Illegal retw instruction(pc = %08x)\n", dc->pc); 2010 return XTENSA_OP_ILL; 2011 } else { 2012 TCGv_i32 pc = tcg_constant_i32(dc->pc); 2013 2014 gen_helper_test_ill_retw(tcg_env, pc); 2015 return 0; 2016 } 2017 } 2018 2019 static void translate_retw(DisasContext *dc, const OpcodeArg arg[], 2020 const uint32_t par[]) 2021 { 2022 TCGv_i32 tmp = tcg_temp_new(); 2023 tcg_gen_shl_i32(tmp, tcg_constant_i32(1), cpu_SR[WINDOW_BASE]); 2024 tcg_gen_andc_i32(cpu_SR[WINDOW_START], 2025 cpu_SR[WINDOW_START], tmp); 2026 tcg_gen_movi_i32(tmp, dc->pc); 2027 tcg_gen_deposit_i32(tmp, tmp, cpu_R[0], 0, 30); 2028 gen_helper_retw(tcg_env, cpu_R[0]); 2029 gen_jump(dc, tmp); 2030 } 2031 2032 static void translate_rfde(DisasContext *dc, const OpcodeArg arg[], 2033 const uint32_t par[]) 2034 { 2035 gen_jump(dc, cpu_SR[dc->config->ndepc ? DEPC : EPC1]); 2036 } 2037 2038 static void translate_rfe(DisasContext *dc, const OpcodeArg arg[], 2039 const uint32_t par[]) 2040 { 2041 tcg_gen_andi_i32(cpu_SR[PS], cpu_SR[PS], ~PS_EXCM); 2042 gen_jump(dc, cpu_SR[EPC1]); 2043 } 2044 2045 static void translate_rfi(DisasContext *dc, const OpcodeArg arg[], 2046 const uint32_t par[]) 2047 { 2048 tcg_gen_mov_i32(cpu_SR[PS], cpu_SR[EPS2 + arg[0].imm - 2]); 2049 gen_jump(dc, cpu_SR[EPC1 + arg[0].imm - 1]); 2050 } 2051 2052 static void translate_rfw(DisasContext *dc, const OpcodeArg arg[], 2053 const uint32_t par[]) 2054 { 2055 TCGv_i32 tmp = tcg_temp_new(); 2056 2057 tcg_gen_andi_i32(cpu_SR[PS], cpu_SR[PS], ~PS_EXCM); 2058 tcg_gen_shl_i32(tmp, tcg_constant_i32(1), cpu_SR[WINDOW_BASE]); 2059 2060 if (par[0]) { 2061 tcg_gen_andc_i32(cpu_SR[WINDOW_START], 2062 cpu_SR[WINDOW_START], tmp); 2063 } else { 2064 tcg_gen_or_i32(cpu_SR[WINDOW_START], 2065 cpu_SR[WINDOW_START], tmp); 2066 } 2067 2068 gen_helper_restore_owb(tcg_env); 2069 gen_jump(dc, cpu_SR[EPC1]); 2070 } 2071 2072 static void translate_rotw(DisasContext *dc, const OpcodeArg arg[], 2073 const uint32_t par[]) 2074 { 2075 tcg_gen_addi_i32(cpu_windowbase_next, cpu_SR[WINDOW_BASE], arg[0].imm); 2076 } 2077 2078 static void translate_rsil(DisasContext *dc, const OpcodeArg arg[], 2079 const uint32_t par[]) 2080 { 2081 tcg_gen_mov_i32(arg[0].out, cpu_SR[PS]); 2082 tcg_gen_andi_i32(cpu_SR[PS], cpu_SR[PS], ~PS_INTLEVEL); 2083 tcg_gen_ori_i32(cpu_SR[PS], cpu_SR[PS], arg[1].imm); 2084 } 2085 2086 static void translate_rsr(DisasContext *dc, const OpcodeArg arg[], 2087 const uint32_t par[]) 2088 { 2089 if (sr_name[par[0]]) { 2090 tcg_gen_mov_i32(arg[0].out, cpu_SR[par[0]]); 2091 } else { 2092 tcg_gen_movi_i32(arg[0].out, 0); 2093 } 2094 } 2095 2096 static void translate_rsr_ccount(DisasContext *dc, const OpcodeArg arg[], 2097 const uint32_t par[]) 2098 { 2099 #ifndef CONFIG_USER_ONLY 2100 translator_io_start(&dc->base); 2101 gen_helper_update_ccount(tcg_env); 2102 tcg_gen_mov_i32(arg[0].out, cpu_SR[par[0]]); 2103 #endif 2104 } 2105 2106 static void translate_rsr_ptevaddr(DisasContext *dc, const OpcodeArg arg[], 2107 const uint32_t par[]) 2108 { 2109 #ifndef CONFIG_USER_ONLY 2110 TCGv_i32 tmp = tcg_temp_new_i32(); 2111 2112 tcg_gen_shri_i32(tmp, cpu_SR[EXCVADDR], 10); 2113 tcg_gen_or_i32(tmp, tmp, cpu_SR[PTEVADDR]); 2114 tcg_gen_andi_i32(arg[0].out, tmp, 0xfffffffc); 2115 #endif 2116 } 2117 2118 static void translate_rtlb(DisasContext *dc, const OpcodeArg arg[], 2119 const uint32_t par[]) 2120 { 2121 #ifndef CONFIG_USER_ONLY 2122 static void (* const helper[])(TCGv_i32 r, TCGv_env env, TCGv_i32 a1, 2123 TCGv_i32 a2) = { 2124 gen_helper_rtlb0, 2125 gen_helper_rtlb1, 2126 }; 2127 TCGv_i32 dtlb = tcg_constant_i32(par[0]); 2128 2129 helper[par[1]](arg[0].out, tcg_env, arg[1].in, dtlb); 2130 #endif 2131 } 2132 2133 static void translate_rptlb0(DisasContext *dc, const OpcodeArg arg[], 2134 const uint32_t par[]) 2135 { 2136 #ifndef CONFIG_USER_ONLY 2137 gen_helper_rptlb0(arg[0].out, tcg_env, arg[1].in); 2138 #endif 2139 } 2140 2141 static void translate_rptlb1(DisasContext *dc, const OpcodeArg arg[], 2142 const uint32_t par[]) 2143 { 2144 #ifndef CONFIG_USER_ONLY 2145 gen_helper_rptlb1(arg[0].out, tcg_env, arg[1].in); 2146 #endif 2147 } 2148 2149 static void translate_rur(DisasContext *dc, const OpcodeArg arg[], 2150 const uint32_t par[]) 2151 { 2152 tcg_gen_mov_i32(arg[0].out, cpu_UR[par[0]]); 2153 } 2154 2155 static void translate_setb_expstate(DisasContext *dc, const OpcodeArg arg[], 2156 const uint32_t par[]) 2157 { 2158 /* TODO: GPIO32 may be a part of coprocessor */ 2159 tcg_gen_ori_i32(cpu_UR[EXPSTATE], cpu_UR[EXPSTATE], 1u << arg[0].imm); 2160 } 2161 2162 #ifdef CONFIG_USER_ONLY 2163 static void gen_check_atomctl(DisasContext *dc, TCGv_i32 addr) 2164 { 2165 } 2166 #else 2167 static void gen_check_atomctl(DisasContext *dc, TCGv_i32 addr) 2168 { 2169 TCGv_i32 pc = tcg_constant_i32(dc->pc); 2170 2171 gen_helper_check_atomctl(tcg_env, pc, addr); 2172 } 2173 #endif 2174 2175 static void translate_s32c1i(DisasContext *dc, const OpcodeArg arg[], 2176 const uint32_t par[]) 2177 { 2178 TCGv_i32 tmp = tcg_temp_new_i32(); 2179 TCGv_i32 addr = tcg_temp_new_i32(); 2180 MemOp mop; 2181 2182 tcg_gen_mov_i32(tmp, arg[0].in); 2183 tcg_gen_addi_i32(addr, arg[1].in, arg[2].imm); 2184 mop = gen_load_store_alignment(dc, MO_TEUL | MO_ALIGN, addr); 2185 gen_check_atomctl(dc, addr); 2186 tcg_gen_atomic_cmpxchg_i32(arg[0].out, addr, cpu_SR[SCOMPARE1], 2187 tmp, dc->cring, mop); 2188 } 2189 2190 static void translate_s32e(DisasContext *dc, const OpcodeArg arg[], 2191 const uint32_t par[]) 2192 { 2193 TCGv_i32 addr = tcg_temp_new_i32(); 2194 MemOp mop; 2195 2196 tcg_gen_addi_i32(addr, arg[1].in, arg[2].imm); 2197 mop = gen_load_store_alignment(dc, MO_TEUL, addr); 2198 tcg_gen_qemu_st_tl(arg[0].in, addr, dc->ring, mop); 2199 } 2200 2201 static void translate_s32ex(DisasContext *dc, const OpcodeArg arg[], 2202 const uint32_t par[]) 2203 { 2204 TCGv_i32 prev = tcg_temp_new_i32(); 2205 TCGv_i32 addr = tcg_temp_new_i32(); 2206 TCGv_i32 res = tcg_temp_new_i32(); 2207 TCGLabel *label = gen_new_label(); 2208 MemOp mop; 2209 2210 tcg_gen_movi_i32(res, 0); 2211 tcg_gen_mov_i32(addr, arg[1].in); 2212 mop = gen_load_store_alignment(dc, MO_TEUL | MO_ALIGN, addr); 2213 tcg_gen_brcond_i32(TCG_COND_NE, addr, cpu_exclusive_addr, label); 2214 gen_check_exclusive(dc, addr, true); 2215 tcg_gen_atomic_cmpxchg_i32(prev, cpu_exclusive_addr, cpu_exclusive_val, 2216 arg[0].in, dc->cring, mop); 2217 tcg_gen_setcond_i32(TCG_COND_EQ, res, prev, cpu_exclusive_val); 2218 tcg_gen_movcond_i32(TCG_COND_EQ, cpu_exclusive_val, 2219 prev, cpu_exclusive_val, prev, cpu_exclusive_val); 2220 tcg_gen_movi_i32(cpu_exclusive_addr, -1); 2221 gen_set_label(label); 2222 tcg_gen_extract_i32(arg[0].out, cpu_SR[ATOMCTL], 8, 1); 2223 tcg_gen_deposit_i32(cpu_SR[ATOMCTL], cpu_SR[ATOMCTL], res, 8, 1); 2224 } 2225 2226 static void translate_salt(DisasContext *dc, const OpcodeArg arg[], 2227 const uint32_t par[]) 2228 { 2229 tcg_gen_setcond_i32(par[0], 2230 arg[0].out, 2231 arg[1].in, arg[2].in); 2232 } 2233 2234 static void translate_sext(DisasContext *dc, const OpcodeArg arg[], 2235 const uint32_t par[]) 2236 { 2237 tcg_gen_sextract_i32(arg[0].out, arg[1].in, 0, arg[2].imm + 1); 2238 } 2239 2240 static uint32_t test_exceptions_simcall(DisasContext *dc, 2241 const OpcodeArg arg[], 2242 const uint32_t par[]) 2243 { 2244 bool is_semi = semihosting_enabled(dc->cring != 0); 2245 #ifdef CONFIG_USER_ONLY 2246 bool ill = true; 2247 #else 2248 /* Between RE.2 and RE.3 simcall opcode's become nop for the hardware. */ 2249 bool ill = dc->config->hw_version <= 250002 && !is_semi; 2250 #endif 2251 if (ill || !is_semi) { 2252 qemu_log_mask(LOG_GUEST_ERROR, "SIMCALL but semihosting is disabled\n"); 2253 } 2254 return ill ? XTENSA_OP_ILL : 0; 2255 } 2256 2257 static void translate_simcall(DisasContext *dc, const OpcodeArg arg[], 2258 const uint32_t par[]) 2259 { 2260 #ifndef CONFIG_USER_ONLY 2261 if (semihosting_enabled(dc->cring != 0)) { 2262 gen_helper_simcall(tcg_env); 2263 } 2264 #endif 2265 } 2266 2267 /* 2268 * Note: 64 bit ops are used here solely because SAR values 2269 * have range 0..63 2270 */ 2271 #define gen_shift_reg(cmd, reg) do { \ 2272 TCGv_i64 tmp = tcg_temp_new_i64(); \ 2273 tcg_gen_extu_i32_i64(tmp, reg); \ 2274 tcg_gen_##cmd##_i64(v, v, tmp); \ 2275 tcg_gen_extrl_i64_i32(arg[0].out, v); \ 2276 } while (0) 2277 2278 #define gen_shift(cmd) gen_shift_reg(cmd, cpu_SR[SAR]) 2279 2280 static void translate_sll(DisasContext *dc, const OpcodeArg arg[], 2281 const uint32_t par[]) 2282 { 2283 if (dc->sar_m32_5bit) { 2284 tcg_gen_shl_i32(arg[0].out, arg[1].in, dc->sar_m32); 2285 } else { 2286 TCGv_i64 v = tcg_temp_new_i64(); 2287 TCGv_i32 s = tcg_temp_new(); 2288 tcg_gen_subfi_i32(s, 32, cpu_SR[SAR]); 2289 tcg_gen_andi_i32(s, s, 0x3f); 2290 tcg_gen_extu_i32_i64(v, arg[1].in); 2291 gen_shift_reg(shl, s); 2292 } 2293 } 2294 2295 static void translate_slli(DisasContext *dc, const OpcodeArg arg[], 2296 const uint32_t par[]) 2297 { 2298 if (arg[2].imm == 32) { 2299 qemu_log_mask(LOG_GUEST_ERROR, "slli a%d, a%d, 32 is undefined\n", 2300 arg[0].imm, arg[1].imm); 2301 } 2302 tcg_gen_shli_i32(arg[0].out, arg[1].in, arg[2].imm & 0x1f); 2303 } 2304 2305 static void translate_sra(DisasContext *dc, const OpcodeArg arg[], 2306 const uint32_t par[]) 2307 { 2308 if (dc->sar_m32_5bit) { 2309 tcg_gen_sar_i32(arg[0].out, arg[1].in, cpu_SR[SAR]); 2310 } else { 2311 TCGv_i64 v = tcg_temp_new_i64(); 2312 tcg_gen_ext_i32_i64(v, arg[1].in); 2313 gen_shift(sar); 2314 } 2315 } 2316 2317 static void translate_srai(DisasContext *dc, const OpcodeArg arg[], 2318 const uint32_t par[]) 2319 { 2320 tcg_gen_sari_i32(arg[0].out, arg[1].in, arg[2].imm); 2321 } 2322 2323 static void translate_src(DisasContext *dc, const OpcodeArg arg[], 2324 const uint32_t par[]) 2325 { 2326 TCGv_i64 v = tcg_temp_new_i64(); 2327 tcg_gen_concat_i32_i64(v, arg[2].in, arg[1].in); 2328 gen_shift(shr); 2329 } 2330 2331 static void translate_srl(DisasContext *dc, const OpcodeArg arg[], 2332 const uint32_t par[]) 2333 { 2334 if (dc->sar_m32_5bit) { 2335 tcg_gen_shr_i32(arg[0].out, arg[1].in, cpu_SR[SAR]); 2336 } else { 2337 TCGv_i64 v = tcg_temp_new_i64(); 2338 tcg_gen_extu_i32_i64(v, arg[1].in); 2339 gen_shift(shr); 2340 } 2341 } 2342 2343 #undef gen_shift 2344 #undef gen_shift_reg 2345 2346 static void translate_srli(DisasContext *dc, const OpcodeArg arg[], 2347 const uint32_t par[]) 2348 { 2349 tcg_gen_shri_i32(arg[0].out, arg[1].in, arg[2].imm); 2350 } 2351 2352 static void translate_ssa8b(DisasContext *dc, const OpcodeArg arg[], 2353 const uint32_t par[]) 2354 { 2355 TCGv_i32 tmp = tcg_temp_new_i32(); 2356 tcg_gen_shli_i32(tmp, arg[0].in, 3); 2357 gen_left_shift_sar(dc, tmp); 2358 } 2359 2360 static void translate_ssa8l(DisasContext *dc, const OpcodeArg arg[], 2361 const uint32_t par[]) 2362 { 2363 TCGv_i32 tmp = tcg_temp_new_i32(); 2364 tcg_gen_shli_i32(tmp, arg[0].in, 3); 2365 gen_right_shift_sar(dc, tmp); 2366 } 2367 2368 static void translate_ssai(DisasContext *dc, const OpcodeArg arg[], 2369 const uint32_t par[]) 2370 { 2371 gen_right_shift_sar(dc, tcg_constant_i32(arg[0].imm)); 2372 } 2373 2374 static void translate_ssl(DisasContext *dc, const OpcodeArg arg[], 2375 const uint32_t par[]) 2376 { 2377 gen_left_shift_sar(dc, arg[0].in); 2378 } 2379 2380 static void translate_ssr(DisasContext *dc, const OpcodeArg arg[], 2381 const uint32_t par[]) 2382 { 2383 gen_right_shift_sar(dc, arg[0].in); 2384 } 2385 2386 static void translate_sub(DisasContext *dc, const OpcodeArg arg[], 2387 const uint32_t par[]) 2388 { 2389 tcg_gen_sub_i32(arg[0].out, arg[1].in, arg[2].in); 2390 } 2391 2392 static void translate_subx(DisasContext *dc, const OpcodeArg arg[], 2393 const uint32_t par[]) 2394 { 2395 TCGv_i32 tmp = tcg_temp_new_i32(); 2396 tcg_gen_shli_i32(tmp, arg[1].in, par[0]); 2397 tcg_gen_sub_i32(arg[0].out, tmp, arg[2].in); 2398 } 2399 2400 static void translate_waiti(DisasContext *dc, const OpcodeArg arg[], 2401 const uint32_t par[]) 2402 { 2403 #ifndef CONFIG_USER_ONLY 2404 TCGv_i32 pc = tcg_constant_i32(dc->base.pc_next); 2405 2406 translator_io_start(&dc->base); 2407 gen_helper_waiti(tcg_env, pc, tcg_constant_i32(arg[0].imm)); 2408 #endif 2409 } 2410 2411 static void translate_wtlb(DisasContext *dc, const OpcodeArg arg[], 2412 const uint32_t par[]) 2413 { 2414 #ifndef CONFIG_USER_ONLY 2415 TCGv_i32 dtlb = tcg_constant_i32(par[0]); 2416 2417 gen_helper_wtlb(tcg_env, arg[0].in, arg[1].in, dtlb); 2418 #endif 2419 } 2420 2421 static void translate_wptlb(DisasContext *dc, const OpcodeArg arg[], 2422 const uint32_t par[]) 2423 { 2424 #ifndef CONFIG_USER_ONLY 2425 gen_helper_wptlb(tcg_env, arg[0].in, arg[1].in); 2426 #endif 2427 } 2428 2429 static void translate_wer(DisasContext *dc, const OpcodeArg arg[], 2430 const uint32_t par[]) 2431 { 2432 gen_helper_wer(tcg_env, arg[0].in, arg[1].in); 2433 } 2434 2435 static void translate_wrmsk_expstate(DisasContext *dc, const OpcodeArg arg[], 2436 const uint32_t par[]) 2437 { 2438 /* TODO: GPIO32 may be a part of coprocessor */ 2439 tcg_gen_and_i32(cpu_UR[EXPSTATE], arg[0].in, arg[1].in); 2440 } 2441 2442 static void translate_wsr(DisasContext *dc, const OpcodeArg arg[], 2443 const uint32_t par[]) 2444 { 2445 if (sr_name[par[0]]) { 2446 tcg_gen_mov_i32(cpu_SR[par[0]], arg[0].in); 2447 } 2448 } 2449 2450 static void translate_wsr_mask(DisasContext *dc, const OpcodeArg arg[], 2451 const uint32_t par[]) 2452 { 2453 if (sr_name[par[0]]) { 2454 tcg_gen_andi_i32(cpu_SR[par[0]], arg[0].in, par[2]); 2455 } 2456 } 2457 2458 static void translate_wsr_acchi(DisasContext *dc, const OpcodeArg arg[], 2459 const uint32_t par[]) 2460 { 2461 tcg_gen_ext8s_i32(cpu_SR[par[0]], arg[0].in); 2462 } 2463 2464 static void translate_wsr_ccompare(DisasContext *dc, const OpcodeArg arg[], 2465 const uint32_t par[]) 2466 { 2467 #ifndef CONFIG_USER_ONLY 2468 uint32_t id = par[0] - CCOMPARE; 2469 2470 assert(id < dc->config->nccompare); 2471 translator_io_start(&dc->base); 2472 tcg_gen_mov_i32(cpu_SR[par[0]], arg[0].in); 2473 gen_helper_update_ccompare(tcg_env, tcg_constant_i32(id)); 2474 #endif 2475 } 2476 2477 static void translate_wsr_ccount(DisasContext *dc, const OpcodeArg arg[], 2478 const uint32_t par[]) 2479 { 2480 #ifndef CONFIG_USER_ONLY 2481 translator_io_start(&dc->base); 2482 gen_helper_wsr_ccount(tcg_env, arg[0].in); 2483 #endif 2484 } 2485 2486 static void translate_wsr_dbreaka(DisasContext *dc, const OpcodeArg arg[], 2487 const uint32_t par[]) 2488 { 2489 #ifndef CONFIG_USER_ONLY 2490 unsigned id = par[0] - DBREAKA; 2491 2492 assert(id < dc->config->ndbreak); 2493 gen_helper_wsr_dbreaka(tcg_env, tcg_constant_i32(id), arg[0].in); 2494 #endif 2495 } 2496 2497 static void translate_wsr_dbreakc(DisasContext *dc, const OpcodeArg arg[], 2498 const uint32_t par[]) 2499 { 2500 #ifndef CONFIG_USER_ONLY 2501 unsigned id = par[0] - DBREAKC; 2502 2503 assert(id < dc->config->ndbreak); 2504 gen_helper_wsr_dbreakc(tcg_env, tcg_constant_i32(id), arg[0].in); 2505 #endif 2506 } 2507 2508 static void translate_wsr_ibreaka(DisasContext *dc, const OpcodeArg arg[], 2509 const uint32_t par[]) 2510 { 2511 #ifndef CONFIG_USER_ONLY 2512 unsigned id = par[0] - IBREAKA; 2513 2514 assert(id < dc->config->nibreak); 2515 gen_helper_wsr_ibreaka(tcg_env, tcg_constant_i32(id), arg[0].in); 2516 #endif 2517 } 2518 2519 static void translate_wsr_ibreakenable(DisasContext *dc, const OpcodeArg arg[], 2520 const uint32_t par[]) 2521 { 2522 #ifndef CONFIG_USER_ONLY 2523 gen_helper_wsr_ibreakenable(tcg_env, arg[0].in); 2524 #endif 2525 } 2526 2527 static void translate_wsr_icount(DisasContext *dc, const OpcodeArg arg[], 2528 const uint32_t par[]) 2529 { 2530 #ifndef CONFIG_USER_ONLY 2531 if (dc->icount) { 2532 tcg_gen_mov_i32(dc->next_icount, arg[0].in); 2533 } else { 2534 tcg_gen_mov_i32(cpu_SR[par[0]], arg[0].in); 2535 } 2536 #endif 2537 } 2538 2539 static void translate_wsr_intclear(DisasContext *dc, const OpcodeArg arg[], 2540 const uint32_t par[]) 2541 { 2542 #ifndef CONFIG_USER_ONLY 2543 gen_helper_intclear(tcg_env, arg[0].in); 2544 #endif 2545 } 2546 2547 static void translate_wsr_intset(DisasContext *dc, const OpcodeArg arg[], 2548 const uint32_t par[]) 2549 { 2550 #ifndef CONFIG_USER_ONLY 2551 gen_helper_intset(tcg_env, arg[0].in); 2552 #endif 2553 } 2554 2555 static void translate_wsr_memctl(DisasContext *dc, const OpcodeArg arg[], 2556 const uint32_t par[]) 2557 { 2558 #ifndef CONFIG_USER_ONLY 2559 gen_helper_wsr_memctl(tcg_env, arg[0].in); 2560 #endif 2561 } 2562 2563 static void translate_wsr_mpuenb(DisasContext *dc, const OpcodeArg arg[], 2564 const uint32_t par[]) 2565 { 2566 #ifndef CONFIG_USER_ONLY 2567 gen_helper_wsr_mpuenb(tcg_env, arg[0].in); 2568 #endif 2569 } 2570 2571 static void translate_wsr_ps(DisasContext *dc, const OpcodeArg arg[], 2572 const uint32_t par[]) 2573 { 2574 #ifndef CONFIG_USER_ONLY 2575 uint32_t mask = PS_WOE | PS_CALLINC | PS_OWB | 2576 PS_UM | PS_EXCM | PS_INTLEVEL; 2577 2578 if (option_enabled(dc, XTENSA_OPTION_MMU) || 2579 option_enabled(dc, XTENSA_OPTION_MPU)) { 2580 mask |= PS_RING; 2581 } 2582 tcg_gen_andi_i32(cpu_SR[par[0]], arg[0].in, mask); 2583 #endif 2584 } 2585 2586 static void translate_wsr_rasid(DisasContext *dc, const OpcodeArg arg[], 2587 const uint32_t par[]) 2588 { 2589 #ifndef CONFIG_USER_ONLY 2590 gen_helper_wsr_rasid(tcg_env, arg[0].in); 2591 #endif 2592 } 2593 2594 static void translate_wsr_sar(DisasContext *dc, const OpcodeArg arg[], 2595 const uint32_t par[]) 2596 { 2597 tcg_gen_andi_i32(cpu_SR[par[0]], arg[0].in, 0x3f); 2598 if (dc->sar_m32_5bit) { 2599 tcg_gen_discard_i32(dc->sar_m32); 2600 } 2601 dc->sar_5bit = false; 2602 dc->sar_m32_5bit = false; 2603 } 2604 2605 static void translate_wsr_windowbase(DisasContext *dc, const OpcodeArg arg[], 2606 const uint32_t par[]) 2607 { 2608 #ifndef CONFIG_USER_ONLY 2609 tcg_gen_mov_i32(cpu_windowbase_next, arg[0].in); 2610 #endif 2611 } 2612 2613 static void translate_wsr_windowstart(DisasContext *dc, const OpcodeArg arg[], 2614 const uint32_t par[]) 2615 { 2616 #ifndef CONFIG_USER_ONLY 2617 tcg_gen_andi_i32(cpu_SR[par[0]], arg[0].in, 2618 (1 << dc->config->nareg / 4) - 1); 2619 #endif 2620 } 2621 2622 static void translate_wur(DisasContext *dc, const OpcodeArg arg[], 2623 const uint32_t par[]) 2624 { 2625 tcg_gen_mov_i32(cpu_UR[par[0]], arg[0].in); 2626 } 2627 2628 static void translate_xor(DisasContext *dc, const OpcodeArg arg[], 2629 const uint32_t par[]) 2630 { 2631 tcg_gen_xor_i32(arg[0].out, arg[1].in, arg[2].in); 2632 } 2633 2634 static void translate_xsr(DisasContext *dc, const OpcodeArg arg[], 2635 const uint32_t par[]) 2636 { 2637 if (sr_name[par[0]]) { 2638 TCGv_i32 tmp = tcg_temp_new_i32(); 2639 2640 tcg_gen_mov_i32(tmp, arg[0].in); 2641 tcg_gen_mov_i32(arg[0].out, cpu_SR[par[0]]); 2642 tcg_gen_mov_i32(cpu_SR[par[0]], tmp); 2643 } else { 2644 tcg_gen_movi_i32(arg[0].out, 0); 2645 } 2646 } 2647 2648 static void translate_xsr_mask(DisasContext *dc, const OpcodeArg arg[], 2649 const uint32_t par[]) 2650 { 2651 if (sr_name[par[0]]) { 2652 TCGv_i32 tmp = tcg_temp_new_i32(); 2653 2654 tcg_gen_mov_i32(tmp, arg[0].in); 2655 tcg_gen_mov_i32(arg[0].out, cpu_SR[par[0]]); 2656 tcg_gen_andi_i32(cpu_SR[par[0]], tmp, par[2]); 2657 } else { 2658 tcg_gen_movi_i32(arg[0].out, 0); 2659 } 2660 } 2661 2662 static void translate_xsr_ccount(DisasContext *dc, const OpcodeArg arg[], 2663 const uint32_t par[]) 2664 { 2665 #ifndef CONFIG_USER_ONLY 2666 TCGv_i32 tmp = tcg_temp_new_i32(); 2667 2668 translator_io_start(&dc->base); 2669 gen_helper_update_ccount(tcg_env); 2670 tcg_gen_mov_i32(tmp, cpu_SR[par[0]]); 2671 gen_helper_wsr_ccount(tcg_env, arg[0].in); 2672 tcg_gen_mov_i32(arg[0].out, tmp); 2673 2674 #endif 2675 } 2676 2677 #define gen_translate_xsr(name) \ 2678 static void translate_xsr_##name(DisasContext *dc, const OpcodeArg arg[], \ 2679 const uint32_t par[]) \ 2680 { \ 2681 TCGv_i32 tmp = tcg_temp_new_i32(); \ 2682 \ 2683 if (sr_name[par[0]]) { \ 2684 tcg_gen_mov_i32(tmp, cpu_SR[par[0]]); \ 2685 } else { \ 2686 tcg_gen_movi_i32(tmp, 0); \ 2687 } \ 2688 translate_wsr_##name(dc, arg, par); \ 2689 tcg_gen_mov_i32(arg[0].out, tmp); \ 2690 } 2691 2692 gen_translate_xsr(acchi) 2693 gen_translate_xsr(ccompare) 2694 gen_translate_xsr(dbreaka) 2695 gen_translate_xsr(dbreakc) 2696 gen_translate_xsr(ibreaka) 2697 gen_translate_xsr(ibreakenable) 2698 gen_translate_xsr(icount) 2699 gen_translate_xsr(memctl) 2700 gen_translate_xsr(mpuenb) 2701 gen_translate_xsr(ps) 2702 gen_translate_xsr(rasid) 2703 gen_translate_xsr(sar) 2704 gen_translate_xsr(windowbase) 2705 gen_translate_xsr(windowstart) 2706 2707 #undef gen_translate_xsr 2708 2709 static const XtensaOpcodeOps core_ops[] = { 2710 { 2711 .name = "abs", 2712 .translate = translate_abs, 2713 }, { 2714 .name = (const char * const[]) { 2715 "add", "add.n", NULL, 2716 }, 2717 .translate = translate_add, 2718 .op_flags = XTENSA_OP_NAME_ARRAY, 2719 }, { 2720 .name = (const char * const[]) { 2721 "addi", "addi.n", NULL, 2722 }, 2723 .translate = translate_addi, 2724 .op_flags = XTENSA_OP_NAME_ARRAY, 2725 }, { 2726 .name = "addmi", 2727 .translate = translate_addi, 2728 }, { 2729 .name = "addx2", 2730 .translate = translate_addx, 2731 .par = (const uint32_t[]){1}, 2732 }, { 2733 .name = "addx4", 2734 .translate = translate_addx, 2735 .par = (const uint32_t[]){2}, 2736 }, { 2737 .name = "addx8", 2738 .translate = translate_addx, 2739 .par = (const uint32_t[]){3}, 2740 }, { 2741 .name = "all4", 2742 .translate = translate_all, 2743 .par = (const uint32_t[]){true, 4}, 2744 }, { 2745 .name = "all8", 2746 .translate = translate_all, 2747 .par = (const uint32_t[]){true, 8}, 2748 }, { 2749 .name = "and", 2750 .translate = translate_and, 2751 }, { 2752 .name = "andb", 2753 .translate = translate_boolean, 2754 .par = (const uint32_t[]){BOOLEAN_AND}, 2755 }, { 2756 .name = "andbc", 2757 .translate = translate_boolean, 2758 .par = (const uint32_t[]){BOOLEAN_ANDC}, 2759 }, { 2760 .name = "any4", 2761 .translate = translate_all, 2762 .par = (const uint32_t[]){false, 4}, 2763 }, { 2764 .name = "any8", 2765 .translate = translate_all, 2766 .par = (const uint32_t[]){false, 8}, 2767 }, { 2768 .name = (const char * const[]) { 2769 "ball", "ball.w15", "ball.w18", NULL, 2770 }, 2771 .translate = translate_ball, 2772 .par = (const uint32_t[]){TCG_COND_EQ}, 2773 .op_flags = XTENSA_OP_NAME_ARRAY, 2774 }, { 2775 .name = (const char * const[]) { 2776 "bany", "bany.w15", "bany.w18", NULL, 2777 }, 2778 .translate = translate_bany, 2779 .par = (const uint32_t[]){TCG_COND_NE}, 2780 .op_flags = XTENSA_OP_NAME_ARRAY, 2781 }, { 2782 .name = (const char * const[]) { 2783 "bbc", "bbc.w15", "bbc.w18", NULL, 2784 }, 2785 .translate = translate_bb, 2786 .par = (const uint32_t[]){TCG_COND_EQ}, 2787 .op_flags = XTENSA_OP_NAME_ARRAY, 2788 }, { 2789 .name = (const char * const[]) { 2790 "bbci", "bbci.w15", "bbci.w18", NULL, 2791 }, 2792 .translate = translate_bbi, 2793 .par = (const uint32_t[]){TCG_COND_EQ}, 2794 .op_flags = XTENSA_OP_NAME_ARRAY, 2795 }, { 2796 .name = (const char * const[]) { 2797 "bbs", "bbs.w15", "bbs.w18", NULL, 2798 }, 2799 .translate = translate_bb, 2800 .par = (const uint32_t[]){TCG_COND_NE}, 2801 .op_flags = XTENSA_OP_NAME_ARRAY, 2802 }, { 2803 .name = (const char * const[]) { 2804 "bbsi", "bbsi.w15", "bbsi.w18", NULL, 2805 }, 2806 .translate = translate_bbi, 2807 .par = (const uint32_t[]){TCG_COND_NE}, 2808 .op_flags = XTENSA_OP_NAME_ARRAY, 2809 }, { 2810 .name = (const char * const[]) { 2811 "beq", "beq.w15", "beq.w18", NULL, 2812 }, 2813 .translate = translate_b, 2814 .par = (const uint32_t[]){TCG_COND_EQ}, 2815 .op_flags = XTENSA_OP_NAME_ARRAY, 2816 }, { 2817 .name = (const char * const[]) { 2818 "beqi", "beqi.w15", "beqi.w18", NULL, 2819 }, 2820 .translate = translate_bi, 2821 .par = (const uint32_t[]){TCG_COND_EQ}, 2822 .op_flags = XTENSA_OP_NAME_ARRAY, 2823 }, { 2824 .name = (const char * const[]) { 2825 "beqz", "beqz.n", "beqz.w15", "beqz.w18", NULL, 2826 }, 2827 .translate = translate_bz, 2828 .par = (const uint32_t[]){TCG_COND_EQ}, 2829 .op_flags = XTENSA_OP_NAME_ARRAY, 2830 }, { 2831 .name = "bf", 2832 .translate = translate_bp, 2833 .par = (const uint32_t[]){TCG_COND_EQ}, 2834 }, { 2835 .name = (const char * const[]) { 2836 "bge", "bge.w15", "bge.w18", NULL, 2837 }, 2838 .translate = translate_b, 2839 .par = (const uint32_t[]){TCG_COND_GE}, 2840 .op_flags = XTENSA_OP_NAME_ARRAY, 2841 }, { 2842 .name = (const char * const[]) { 2843 "bgei", "bgei.w15", "bgei.w18", NULL, 2844 }, 2845 .translate = translate_bi, 2846 .par = (const uint32_t[]){TCG_COND_GE}, 2847 .op_flags = XTENSA_OP_NAME_ARRAY, 2848 }, { 2849 .name = (const char * const[]) { 2850 "bgeu", "bgeu.w15", "bgeu.w18", NULL, 2851 }, 2852 .translate = translate_b, 2853 .par = (const uint32_t[]){TCG_COND_GEU}, 2854 .op_flags = XTENSA_OP_NAME_ARRAY, 2855 }, { 2856 .name = (const char * const[]) { 2857 "bgeui", "bgeui.w15", "bgeui.w18", NULL, 2858 }, 2859 .translate = translate_bi, 2860 .par = (const uint32_t[]){TCG_COND_GEU}, 2861 .op_flags = XTENSA_OP_NAME_ARRAY, 2862 }, { 2863 .name = (const char * const[]) { 2864 "bgez", "bgez.w15", "bgez.w18", NULL, 2865 }, 2866 .translate = translate_bz, 2867 .par = (const uint32_t[]){TCG_COND_GE}, 2868 .op_flags = XTENSA_OP_NAME_ARRAY, 2869 }, { 2870 .name = (const char * const[]) { 2871 "blt", "blt.w15", "blt.w18", NULL, 2872 }, 2873 .translate = translate_b, 2874 .par = (const uint32_t[]){TCG_COND_LT}, 2875 .op_flags = XTENSA_OP_NAME_ARRAY, 2876 }, { 2877 .name = (const char * const[]) { 2878 "blti", "blti.w15", "blti.w18", NULL, 2879 }, 2880 .translate = translate_bi, 2881 .par = (const uint32_t[]){TCG_COND_LT}, 2882 .op_flags = XTENSA_OP_NAME_ARRAY, 2883 }, { 2884 .name = (const char * const[]) { 2885 "bltu", "bltu.w15", "bltu.w18", NULL, 2886 }, 2887 .translate = translate_b, 2888 .par = (const uint32_t[]){TCG_COND_LTU}, 2889 .op_flags = XTENSA_OP_NAME_ARRAY, 2890 }, { 2891 .name = (const char * const[]) { 2892 "bltui", "bltui.w15", "bltui.w18", NULL, 2893 }, 2894 .translate = translate_bi, 2895 .par = (const uint32_t[]){TCG_COND_LTU}, 2896 .op_flags = XTENSA_OP_NAME_ARRAY, 2897 }, { 2898 .name = (const char * const[]) { 2899 "bltz", "bltz.w15", "bltz.w18", NULL, 2900 }, 2901 .translate = translate_bz, 2902 .par = (const uint32_t[]){TCG_COND_LT}, 2903 .op_flags = XTENSA_OP_NAME_ARRAY, 2904 }, { 2905 .name = (const char * const[]) { 2906 "bnall", "bnall.w15", "bnall.w18", NULL, 2907 }, 2908 .translate = translate_ball, 2909 .par = (const uint32_t[]){TCG_COND_NE}, 2910 .op_flags = XTENSA_OP_NAME_ARRAY, 2911 }, { 2912 .name = (const char * const[]) { 2913 "bne", "bne.w15", "bne.w18", NULL, 2914 }, 2915 .translate = translate_b, 2916 .par = (const uint32_t[]){TCG_COND_NE}, 2917 .op_flags = XTENSA_OP_NAME_ARRAY, 2918 }, { 2919 .name = (const char * const[]) { 2920 "bnei", "bnei.w15", "bnei.w18", NULL, 2921 }, 2922 .translate = translate_bi, 2923 .par = (const uint32_t[]){TCG_COND_NE}, 2924 .op_flags = XTENSA_OP_NAME_ARRAY, 2925 }, { 2926 .name = (const char * const[]) { 2927 "bnez", "bnez.n", "bnez.w15", "bnez.w18", NULL, 2928 }, 2929 .translate = translate_bz, 2930 .par = (const uint32_t[]){TCG_COND_NE}, 2931 .op_flags = XTENSA_OP_NAME_ARRAY, 2932 }, { 2933 .name = (const char * const[]) { 2934 "bnone", "bnone.w15", "bnone.w18", NULL, 2935 }, 2936 .translate = translate_bany, 2937 .par = (const uint32_t[]){TCG_COND_EQ}, 2938 .op_flags = XTENSA_OP_NAME_ARRAY, 2939 }, { 2940 .name = "break", 2941 .translate = translate_nop, 2942 .par = (const uint32_t[]){DEBUGCAUSE_BI}, 2943 .op_flags = XTENSA_OP_DEBUG_BREAK, 2944 }, { 2945 .name = "break.n", 2946 .translate = translate_nop, 2947 .par = (const uint32_t[]){DEBUGCAUSE_BN}, 2948 .op_flags = XTENSA_OP_DEBUG_BREAK, 2949 }, { 2950 .name = "bt", 2951 .translate = translate_bp, 2952 .par = (const uint32_t[]){TCG_COND_NE}, 2953 }, { 2954 .name = "call0", 2955 .translate = translate_call0, 2956 }, { 2957 .name = "call12", 2958 .translate = translate_callw, 2959 .par = (const uint32_t[]){3}, 2960 }, { 2961 .name = "call4", 2962 .translate = translate_callw, 2963 .par = (const uint32_t[]){1}, 2964 }, { 2965 .name = "call8", 2966 .translate = translate_callw, 2967 .par = (const uint32_t[]){2}, 2968 }, { 2969 .name = "callx0", 2970 .translate = translate_callx0, 2971 }, { 2972 .name = "callx12", 2973 .translate = translate_callxw, 2974 .par = (const uint32_t[]){3}, 2975 }, { 2976 .name = "callx4", 2977 .translate = translate_callxw, 2978 .par = (const uint32_t[]){1}, 2979 }, { 2980 .name = "callx8", 2981 .translate = translate_callxw, 2982 .par = (const uint32_t[]){2}, 2983 }, { 2984 .name = "clamps", 2985 .translate = translate_clamps, 2986 }, { 2987 .name = "clrb_expstate", 2988 .translate = translate_clrb_expstate, 2989 }, { 2990 .name = "clrex", 2991 .translate = translate_clrex, 2992 }, { 2993 .name = "const16", 2994 .translate = translate_const16, 2995 }, { 2996 .name = "depbits", 2997 .translate = translate_depbits, 2998 }, { 2999 .name = "dhi", 3000 .translate = translate_dcache, 3001 .op_flags = XTENSA_OP_PRIVILEGED, 3002 }, { 3003 .name = "dhi.b", 3004 .translate = translate_nop, 3005 }, { 3006 .name = "dhu", 3007 .translate = translate_dcache, 3008 .op_flags = XTENSA_OP_PRIVILEGED, 3009 }, { 3010 .name = "dhwb", 3011 .translate = translate_dcache, 3012 }, { 3013 .name = "dhwb.b", 3014 .translate = translate_nop, 3015 }, { 3016 .name = "dhwbi", 3017 .translate = translate_dcache, 3018 }, { 3019 .name = "dhwbi.b", 3020 .translate = translate_nop, 3021 }, { 3022 .name = "dii", 3023 .translate = translate_nop, 3024 .op_flags = XTENSA_OP_PRIVILEGED, 3025 }, { 3026 .name = "diu", 3027 .translate = translate_nop, 3028 .op_flags = XTENSA_OP_PRIVILEGED, 3029 }, { 3030 .name = "diwb", 3031 .translate = translate_nop, 3032 .op_flags = XTENSA_OP_PRIVILEGED, 3033 }, { 3034 .name = "diwbi", 3035 .translate = translate_nop, 3036 .op_flags = XTENSA_OP_PRIVILEGED, 3037 }, { 3038 .name = "diwbui.p", 3039 .translate = translate_diwbuip, 3040 .op_flags = XTENSA_OP_PRIVILEGED, 3041 }, { 3042 .name = "dpfl", 3043 .translate = translate_dcache, 3044 .op_flags = XTENSA_OP_PRIVILEGED, 3045 }, { 3046 .name = "dpfm.b", 3047 .translate = translate_nop, 3048 }, { 3049 .name = "dpfm.bf", 3050 .translate = translate_nop, 3051 }, { 3052 .name = "dpfr", 3053 .translate = translate_nop, 3054 }, { 3055 .name = "dpfr.b", 3056 .translate = translate_nop, 3057 }, { 3058 .name = "dpfr.bf", 3059 .translate = translate_nop, 3060 }, { 3061 .name = "dpfro", 3062 .translate = translate_nop, 3063 }, { 3064 .name = "dpfw", 3065 .translate = translate_nop, 3066 }, { 3067 .name = "dpfw.b", 3068 .translate = translate_nop, 3069 }, { 3070 .name = "dpfw.bf", 3071 .translate = translate_nop, 3072 }, { 3073 .name = "dpfwo", 3074 .translate = translate_nop, 3075 }, { 3076 .name = "dsync", 3077 .translate = translate_nop, 3078 }, { 3079 .name = "entry", 3080 .translate = translate_entry, 3081 .test_exceptions = test_exceptions_entry, 3082 .test_overflow = test_overflow_entry, 3083 .op_flags = XTENSA_OP_EXIT_TB_M1 | 3084 XTENSA_OP_SYNC_REGISTER_WINDOW, 3085 }, { 3086 .name = "esync", 3087 .translate = translate_nop, 3088 }, { 3089 .name = "excw", 3090 .translate = translate_nop, 3091 }, { 3092 .name = "extui", 3093 .translate = translate_extui, 3094 }, { 3095 .name = "extw", 3096 .translate = translate_memw, 3097 }, { 3098 .name = "getex", 3099 .translate = translate_getex, 3100 }, { 3101 .name = "hwwdtlba", 3102 .op_flags = XTENSA_OP_ILL, 3103 }, { 3104 .name = "hwwitlba", 3105 .op_flags = XTENSA_OP_ILL, 3106 }, { 3107 .name = "idtlb", 3108 .translate = translate_itlb, 3109 .par = (const uint32_t[]){true}, 3110 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_M1, 3111 }, { 3112 .name = "ihi", 3113 .translate = translate_icache, 3114 }, { 3115 .name = "ihu", 3116 .translate = translate_icache, 3117 .op_flags = XTENSA_OP_PRIVILEGED, 3118 }, { 3119 .name = "iii", 3120 .translate = translate_nop, 3121 .op_flags = XTENSA_OP_PRIVILEGED, 3122 }, { 3123 .name = "iitlb", 3124 .translate = translate_itlb, 3125 .par = (const uint32_t[]){false}, 3126 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_M1, 3127 }, { 3128 .name = "iiu", 3129 .translate = translate_nop, 3130 .op_flags = XTENSA_OP_PRIVILEGED, 3131 }, { 3132 .name = (const char * const[]) { 3133 "ill", "ill.n", NULL, 3134 }, 3135 .op_flags = XTENSA_OP_ILL | XTENSA_OP_NAME_ARRAY, 3136 }, { 3137 .name = "ipf", 3138 .translate = translate_nop, 3139 }, { 3140 .name = "ipfl", 3141 .translate = translate_icache, 3142 .op_flags = XTENSA_OP_PRIVILEGED, 3143 }, { 3144 .name = "isync", 3145 .translate = translate_nop, 3146 }, { 3147 .name = "j", 3148 .translate = translate_j, 3149 }, { 3150 .name = "jx", 3151 .translate = translate_jx, 3152 }, { 3153 .name = "l16si", 3154 .translate = translate_ldst, 3155 .par = (const uint32_t[]){MO_TESW, false, false}, 3156 .op_flags = XTENSA_OP_LOAD, 3157 }, { 3158 .name = "l16ui", 3159 .translate = translate_ldst, 3160 .par = (const uint32_t[]){MO_TEUW, false, false}, 3161 .op_flags = XTENSA_OP_LOAD, 3162 }, { 3163 .name = "l32ai", 3164 .translate = translate_ldst, 3165 .par = (const uint32_t[]){MO_TEUL | MO_ALIGN, true, false}, 3166 .op_flags = XTENSA_OP_LOAD, 3167 }, { 3168 .name = "l32e", 3169 .translate = translate_l32e, 3170 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_LOAD, 3171 }, { 3172 .name = "l32ex", 3173 .translate = translate_l32ex, 3174 .op_flags = XTENSA_OP_LOAD, 3175 }, { 3176 .name = (const char * const[]) { 3177 "l32i", "l32i.n", NULL, 3178 }, 3179 .translate = translate_ldst, 3180 .par = (const uint32_t[]){MO_TEUL, false, false}, 3181 .op_flags = XTENSA_OP_NAME_ARRAY | XTENSA_OP_LOAD, 3182 }, { 3183 .name = "l32r", 3184 .translate = translate_l32r, 3185 .op_flags = XTENSA_OP_LOAD, 3186 }, { 3187 .name = "l8ui", 3188 .translate = translate_ldst, 3189 .par = (const uint32_t[]){MO_UB, false, false}, 3190 .op_flags = XTENSA_OP_LOAD, 3191 }, { 3192 .name = "ldct", 3193 .translate = translate_lct, 3194 .op_flags = XTENSA_OP_PRIVILEGED, 3195 }, { 3196 .name = "ldcw", 3197 .translate = translate_nop, 3198 .op_flags = XTENSA_OP_PRIVILEGED, 3199 }, { 3200 .name = "lddec", 3201 .translate = translate_mac16, 3202 .par = (const uint32_t[]){MAC16_NONE, 0, -4}, 3203 .op_flags = XTENSA_OP_LOAD, 3204 }, { 3205 .name = "ldinc", 3206 .translate = translate_mac16, 3207 .par = (const uint32_t[]){MAC16_NONE, 0, 4}, 3208 .op_flags = XTENSA_OP_LOAD, 3209 }, { 3210 .name = "ldpte", 3211 .op_flags = XTENSA_OP_ILL, 3212 }, { 3213 .name = "lict", 3214 .translate = translate_lct, 3215 .op_flags = XTENSA_OP_PRIVILEGED, 3216 }, { 3217 .name = "licw", 3218 .translate = translate_nop, 3219 .op_flags = XTENSA_OP_PRIVILEGED, 3220 }, { 3221 .name = (const char * const[]) { 3222 "loop", "loop.w15", NULL, 3223 }, 3224 .translate = translate_loop, 3225 .par = (const uint32_t[]){TCG_COND_NEVER}, 3226 .op_flags = XTENSA_OP_NAME_ARRAY, 3227 }, { 3228 .name = (const char * const[]) { 3229 "loopgtz", "loopgtz.w15", NULL, 3230 }, 3231 .translate = translate_loop, 3232 .par = (const uint32_t[]){TCG_COND_GT}, 3233 .op_flags = XTENSA_OP_NAME_ARRAY, 3234 }, { 3235 .name = (const char * const[]) { 3236 "loopnez", "loopnez.w15", NULL, 3237 }, 3238 .translate = translate_loop, 3239 .par = (const uint32_t[]){TCG_COND_NE}, 3240 .op_flags = XTENSA_OP_NAME_ARRAY, 3241 }, { 3242 .name = "max", 3243 .translate = translate_smax, 3244 }, { 3245 .name = "maxu", 3246 .translate = translate_umax, 3247 }, { 3248 .name = "memw", 3249 .translate = translate_memw, 3250 }, { 3251 .name = "min", 3252 .translate = translate_smin, 3253 }, { 3254 .name = "minu", 3255 .translate = translate_umin, 3256 }, { 3257 .name = (const char * const[]) { 3258 "mov", "mov.n", NULL, 3259 }, 3260 .translate = translate_mov, 3261 .op_flags = XTENSA_OP_NAME_ARRAY, 3262 }, { 3263 .name = "moveqz", 3264 .translate = translate_movcond, 3265 .par = (const uint32_t[]){TCG_COND_EQ}, 3266 }, { 3267 .name = "movf", 3268 .translate = translate_movp, 3269 .par = (const uint32_t[]){TCG_COND_EQ}, 3270 }, { 3271 .name = "movgez", 3272 .translate = translate_movcond, 3273 .par = (const uint32_t[]){TCG_COND_GE}, 3274 }, { 3275 .name = "movi", 3276 .translate = translate_movi, 3277 }, { 3278 .name = "movi.n", 3279 .translate = translate_movi, 3280 }, { 3281 .name = "movltz", 3282 .translate = translate_movcond, 3283 .par = (const uint32_t[]){TCG_COND_LT}, 3284 }, { 3285 .name = "movnez", 3286 .translate = translate_movcond, 3287 .par = (const uint32_t[]){TCG_COND_NE}, 3288 }, { 3289 .name = "movsp", 3290 .translate = translate_movsp, 3291 .op_flags = XTENSA_OP_ALLOCA, 3292 }, { 3293 .name = "movt", 3294 .translate = translate_movp, 3295 .par = (const uint32_t[]){TCG_COND_NE}, 3296 }, { 3297 .name = "mul.aa.hh", 3298 .translate = translate_mac16, 3299 .par = (const uint32_t[]){MAC16_MUL, MAC16_HH, 0}, 3300 }, { 3301 .name = "mul.aa.hl", 3302 .translate = translate_mac16, 3303 .par = (const uint32_t[]){MAC16_MUL, MAC16_HL, 0}, 3304 }, { 3305 .name = "mul.aa.lh", 3306 .translate = translate_mac16, 3307 .par = (const uint32_t[]){MAC16_MUL, MAC16_LH, 0}, 3308 }, { 3309 .name = "mul.aa.ll", 3310 .translate = translate_mac16, 3311 .par = (const uint32_t[]){MAC16_MUL, MAC16_LL, 0}, 3312 }, { 3313 .name = "mul.ad.hh", 3314 .translate = translate_mac16, 3315 .par = (const uint32_t[]){MAC16_MUL, MAC16_HH, 0}, 3316 }, { 3317 .name = "mul.ad.hl", 3318 .translate = translate_mac16, 3319 .par = (const uint32_t[]){MAC16_MUL, MAC16_HL, 0}, 3320 }, { 3321 .name = "mul.ad.lh", 3322 .translate = translate_mac16, 3323 .par = (const uint32_t[]){MAC16_MUL, MAC16_LH, 0}, 3324 }, { 3325 .name = "mul.ad.ll", 3326 .translate = translate_mac16, 3327 .par = (const uint32_t[]){MAC16_MUL, MAC16_LL, 0}, 3328 }, { 3329 .name = "mul.da.hh", 3330 .translate = translate_mac16, 3331 .par = (const uint32_t[]){MAC16_MUL, MAC16_HH, 0}, 3332 }, { 3333 .name = "mul.da.hl", 3334 .translate = translate_mac16, 3335 .par = (const uint32_t[]){MAC16_MUL, MAC16_HL, 0}, 3336 }, { 3337 .name = "mul.da.lh", 3338 .translate = translate_mac16, 3339 .par = (const uint32_t[]){MAC16_MUL, MAC16_LH, 0}, 3340 }, { 3341 .name = "mul.da.ll", 3342 .translate = translate_mac16, 3343 .par = (const uint32_t[]){MAC16_MUL, MAC16_LL, 0}, 3344 }, { 3345 .name = "mul.dd.hh", 3346 .translate = translate_mac16, 3347 .par = (const uint32_t[]){MAC16_MUL, MAC16_HH, 0}, 3348 }, { 3349 .name = "mul.dd.hl", 3350 .translate = translate_mac16, 3351 .par = (const uint32_t[]){MAC16_MUL, MAC16_HL, 0}, 3352 }, { 3353 .name = "mul.dd.lh", 3354 .translate = translate_mac16, 3355 .par = (const uint32_t[]){MAC16_MUL, MAC16_LH, 0}, 3356 }, { 3357 .name = "mul.dd.ll", 3358 .translate = translate_mac16, 3359 .par = (const uint32_t[]){MAC16_MUL, MAC16_LL, 0}, 3360 }, { 3361 .name = "mul16s", 3362 .translate = translate_mul16, 3363 .par = (const uint32_t[]){true}, 3364 }, { 3365 .name = "mul16u", 3366 .translate = translate_mul16, 3367 .par = (const uint32_t[]){false}, 3368 }, { 3369 .name = "mula.aa.hh", 3370 .translate = translate_mac16, 3371 .par = (const uint32_t[]){MAC16_MULA, MAC16_HH, 0}, 3372 }, { 3373 .name = "mula.aa.hl", 3374 .translate = translate_mac16, 3375 .par = (const uint32_t[]){MAC16_MULA, MAC16_HL, 0}, 3376 }, { 3377 .name = "mula.aa.lh", 3378 .translate = translate_mac16, 3379 .par = (const uint32_t[]){MAC16_MULA, MAC16_LH, 0}, 3380 }, { 3381 .name = "mula.aa.ll", 3382 .translate = translate_mac16, 3383 .par = (const uint32_t[]){MAC16_MULA, MAC16_LL, 0}, 3384 }, { 3385 .name = "mula.ad.hh", 3386 .translate = translate_mac16, 3387 .par = (const uint32_t[]){MAC16_MULA, MAC16_HH, 0}, 3388 }, { 3389 .name = "mula.ad.hl", 3390 .translate = translate_mac16, 3391 .par = (const uint32_t[]){MAC16_MULA, MAC16_HL, 0}, 3392 }, { 3393 .name = "mula.ad.lh", 3394 .translate = translate_mac16, 3395 .par = (const uint32_t[]){MAC16_MULA, MAC16_LH, 0}, 3396 }, { 3397 .name = "mula.ad.ll", 3398 .translate = translate_mac16, 3399 .par = (const uint32_t[]){MAC16_MULA, MAC16_LL, 0}, 3400 }, { 3401 .name = "mula.da.hh", 3402 .translate = translate_mac16, 3403 .par = (const uint32_t[]){MAC16_MULA, MAC16_HH, 0}, 3404 }, { 3405 .name = "mula.da.hh.lddec", 3406 .translate = translate_mac16, 3407 .par = (const uint32_t[]){MAC16_MULA, MAC16_HH, -4}, 3408 }, { 3409 .name = "mula.da.hh.ldinc", 3410 .translate = translate_mac16, 3411 .par = (const uint32_t[]){MAC16_MULA, MAC16_HH, 4}, 3412 }, { 3413 .name = "mula.da.hl", 3414 .translate = translate_mac16, 3415 .par = (const uint32_t[]){MAC16_MULA, MAC16_HL, 0}, 3416 }, { 3417 .name = "mula.da.hl.lddec", 3418 .translate = translate_mac16, 3419 .par = (const uint32_t[]){MAC16_MULA, MAC16_HL, -4}, 3420 }, { 3421 .name = "mula.da.hl.ldinc", 3422 .translate = translate_mac16, 3423 .par = (const uint32_t[]){MAC16_MULA, MAC16_HL, 4}, 3424 }, { 3425 .name = "mula.da.lh", 3426 .translate = translate_mac16, 3427 .par = (const uint32_t[]){MAC16_MULA, MAC16_LH, 0}, 3428 }, { 3429 .name = "mula.da.lh.lddec", 3430 .translate = translate_mac16, 3431 .par = (const uint32_t[]){MAC16_MULA, MAC16_LH, -4}, 3432 }, { 3433 .name = "mula.da.lh.ldinc", 3434 .translate = translate_mac16, 3435 .par = (const uint32_t[]){MAC16_MULA, MAC16_LH, 4}, 3436 }, { 3437 .name = "mula.da.ll", 3438 .translate = translate_mac16, 3439 .par = (const uint32_t[]){MAC16_MULA, MAC16_LL, 0}, 3440 }, { 3441 .name = "mula.da.ll.lddec", 3442 .translate = translate_mac16, 3443 .par = (const uint32_t[]){MAC16_MULA, MAC16_LL, -4}, 3444 }, { 3445 .name = "mula.da.ll.ldinc", 3446 .translate = translate_mac16, 3447 .par = (const uint32_t[]){MAC16_MULA, MAC16_LL, 4}, 3448 }, { 3449 .name = "mula.dd.hh", 3450 .translate = translate_mac16, 3451 .par = (const uint32_t[]){MAC16_MULA, MAC16_HH, 0}, 3452 }, { 3453 .name = "mula.dd.hh.lddec", 3454 .translate = translate_mac16, 3455 .par = (const uint32_t[]){MAC16_MULA, MAC16_HH, -4}, 3456 }, { 3457 .name = "mula.dd.hh.ldinc", 3458 .translate = translate_mac16, 3459 .par = (const uint32_t[]){MAC16_MULA, MAC16_HH, 4}, 3460 }, { 3461 .name = "mula.dd.hl", 3462 .translate = translate_mac16, 3463 .par = (const uint32_t[]){MAC16_MULA, MAC16_HL, 0}, 3464 }, { 3465 .name = "mula.dd.hl.lddec", 3466 .translate = translate_mac16, 3467 .par = (const uint32_t[]){MAC16_MULA, MAC16_HL, -4}, 3468 }, { 3469 .name = "mula.dd.hl.ldinc", 3470 .translate = translate_mac16, 3471 .par = (const uint32_t[]){MAC16_MULA, MAC16_HL, 4}, 3472 }, { 3473 .name = "mula.dd.lh", 3474 .translate = translate_mac16, 3475 .par = (const uint32_t[]){MAC16_MULA, MAC16_LH, 0}, 3476 }, { 3477 .name = "mula.dd.lh.lddec", 3478 .translate = translate_mac16, 3479 .par = (const uint32_t[]){MAC16_MULA, MAC16_LH, -4}, 3480 }, { 3481 .name = "mula.dd.lh.ldinc", 3482 .translate = translate_mac16, 3483 .par = (const uint32_t[]){MAC16_MULA, MAC16_LH, 4}, 3484 }, { 3485 .name = "mula.dd.ll", 3486 .translate = translate_mac16, 3487 .par = (const uint32_t[]){MAC16_MULA, MAC16_LL, 0}, 3488 }, { 3489 .name = "mula.dd.ll.lddec", 3490 .translate = translate_mac16, 3491 .par = (const uint32_t[]){MAC16_MULA, MAC16_LL, -4}, 3492 }, { 3493 .name = "mula.dd.ll.ldinc", 3494 .translate = translate_mac16, 3495 .par = (const uint32_t[]){MAC16_MULA, MAC16_LL, 4}, 3496 }, { 3497 .name = "mull", 3498 .translate = translate_mull, 3499 }, { 3500 .name = "muls.aa.hh", 3501 .translate = translate_mac16, 3502 .par = (const uint32_t[]){MAC16_MULS, MAC16_HH, 0}, 3503 }, { 3504 .name = "muls.aa.hl", 3505 .translate = translate_mac16, 3506 .par = (const uint32_t[]){MAC16_MULS, MAC16_HL, 0}, 3507 }, { 3508 .name = "muls.aa.lh", 3509 .translate = translate_mac16, 3510 .par = (const uint32_t[]){MAC16_MULS, MAC16_LH, 0}, 3511 }, { 3512 .name = "muls.aa.ll", 3513 .translate = translate_mac16, 3514 .par = (const uint32_t[]){MAC16_MULS, MAC16_LL, 0}, 3515 }, { 3516 .name = "muls.ad.hh", 3517 .translate = translate_mac16, 3518 .par = (const uint32_t[]){MAC16_MULS, MAC16_HH, 0}, 3519 }, { 3520 .name = "muls.ad.hl", 3521 .translate = translate_mac16, 3522 .par = (const uint32_t[]){MAC16_MULS, MAC16_HL, 0}, 3523 }, { 3524 .name = "muls.ad.lh", 3525 .translate = translate_mac16, 3526 .par = (const uint32_t[]){MAC16_MULS, MAC16_LH, 0}, 3527 }, { 3528 .name = "muls.ad.ll", 3529 .translate = translate_mac16, 3530 .par = (const uint32_t[]){MAC16_MULS, MAC16_LL, 0}, 3531 }, { 3532 .name = "muls.da.hh", 3533 .translate = translate_mac16, 3534 .par = (const uint32_t[]){MAC16_MULS, MAC16_HH, 0}, 3535 }, { 3536 .name = "muls.da.hl", 3537 .translate = translate_mac16, 3538 .par = (const uint32_t[]){MAC16_MULS, MAC16_HL, 0}, 3539 }, { 3540 .name = "muls.da.lh", 3541 .translate = translate_mac16, 3542 .par = (const uint32_t[]){MAC16_MULS, MAC16_LH, 0}, 3543 }, { 3544 .name = "muls.da.ll", 3545 .translate = translate_mac16, 3546 .par = (const uint32_t[]){MAC16_MULS, MAC16_LL, 0}, 3547 }, { 3548 .name = "muls.dd.hh", 3549 .translate = translate_mac16, 3550 .par = (const uint32_t[]){MAC16_MULS, MAC16_HH, 0}, 3551 }, { 3552 .name = "muls.dd.hl", 3553 .translate = translate_mac16, 3554 .par = (const uint32_t[]){MAC16_MULS, MAC16_HL, 0}, 3555 }, { 3556 .name = "muls.dd.lh", 3557 .translate = translate_mac16, 3558 .par = (const uint32_t[]){MAC16_MULS, MAC16_LH, 0}, 3559 }, { 3560 .name = "muls.dd.ll", 3561 .translate = translate_mac16, 3562 .par = (const uint32_t[]){MAC16_MULS, MAC16_LL, 0}, 3563 }, { 3564 .name = "mulsh", 3565 .translate = translate_mulh, 3566 .par = (const uint32_t[]){true}, 3567 }, { 3568 .name = "muluh", 3569 .translate = translate_mulh, 3570 .par = (const uint32_t[]){false}, 3571 }, { 3572 .name = "neg", 3573 .translate = translate_neg, 3574 }, { 3575 .name = (const char * const[]) { 3576 "nop", "nop.n", NULL, 3577 }, 3578 .translate = translate_nop, 3579 .op_flags = XTENSA_OP_NAME_ARRAY, 3580 }, { 3581 .name = "nsa", 3582 .translate = translate_nsa, 3583 }, { 3584 .name = "nsau", 3585 .translate = translate_nsau, 3586 }, { 3587 .name = "or", 3588 .translate = translate_or, 3589 }, { 3590 .name = "orb", 3591 .translate = translate_boolean, 3592 .par = (const uint32_t[]){BOOLEAN_OR}, 3593 }, { 3594 .name = "orbc", 3595 .translate = translate_boolean, 3596 .par = (const uint32_t[]){BOOLEAN_ORC}, 3597 }, { 3598 .name = "pdtlb", 3599 .translate = translate_ptlb, 3600 .par = (const uint32_t[]){true}, 3601 .op_flags = XTENSA_OP_PRIVILEGED, 3602 }, { 3603 .name = "pfend.a", 3604 .translate = translate_nop, 3605 }, { 3606 .name = "pfend.o", 3607 .translate = translate_nop, 3608 }, { 3609 .name = "pfnxt.f", 3610 .translate = translate_nop, 3611 }, { 3612 .name = "pfwait.a", 3613 .translate = translate_nop, 3614 }, { 3615 .name = "pfwait.r", 3616 .translate = translate_nop, 3617 }, { 3618 .name = "pitlb", 3619 .translate = translate_ptlb, 3620 .par = (const uint32_t[]){false}, 3621 .op_flags = XTENSA_OP_PRIVILEGED, 3622 }, { 3623 .name = "pptlb", 3624 .translate = translate_pptlb, 3625 .op_flags = XTENSA_OP_PRIVILEGED, 3626 }, { 3627 .name = "quos", 3628 .translate = translate_quos, 3629 .par = (const uint32_t[]){true}, 3630 .op_flags = XTENSA_OP_DIVIDE_BY_ZERO, 3631 }, { 3632 .name = "quou", 3633 .translate = translate_quou, 3634 .op_flags = XTENSA_OP_DIVIDE_BY_ZERO, 3635 }, { 3636 .name = "rdtlb0", 3637 .translate = translate_rtlb, 3638 .par = (const uint32_t[]){true, 0}, 3639 .op_flags = XTENSA_OP_PRIVILEGED, 3640 }, { 3641 .name = "rdtlb1", 3642 .translate = translate_rtlb, 3643 .par = (const uint32_t[]){true, 1}, 3644 .op_flags = XTENSA_OP_PRIVILEGED, 3645 }, { 3646 .name = "read_impwire", 3647 .translate = translate_read_impwire, 3648 }, { 3649 .name = "rems", 3650 .translate = translate_quos, 3651 .par = (const uint32_t[]){false}, 3652 .op_flags = XTENSA_OP_DIVIDE_BY_ZERO, 3653 }, { 3654 .name = "remu", 3655 .translate = translate_remu, 3656 .op_flags = XTENSA_OP_DIVIDE_BY_ZERO, 3657 }, { 3658 .name = "rer", 3659 .translate = translate_rer, 3660 .op_flags = XTENSA_OP_PRIVILEGED, 3661 }, { 3662 .name = (const char * const[]) { 3663 "ret", "ret.n", NULL, 3664 }, 3665 .translate = translate_ret, 3666 .op_flags = XTENSA_OP_NAME_ARRAY, 3667 }, { 3668 .name = (const char * const[]) { 3669 "retw", "retw.n", NULL, 3670 }, 3671 .translate = translate_retw, 3672 .test_exceptions = test_exceptions_retw, 3673 .op_flags = XTENSA_OP_UNDERFLOW | XTENSA_OP_NAME_ARRAY, 3674 }, { 3675 .name = "rfdd", 3676 .op_flags = XTENSA_OP_ILL, 3677 }, { 3678 .name = "rfde", 3679 .translate = translate_rfde, 3680 .op_flags = XTENSA_OP_PRIVILEGED, 3681 }, { 3682 .name = "rfdo", 3683 .op_flags = XTENSA_OP_ILL, 3684 }, { 3685 .name = "rfe", 3686 .translate = translate_rfe, 3687 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_CHECK_INTERRUPTS, 3688 }, { 3689 .name = "rfi", 3690 .translate = translate_rfi, 3691 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_CHECK_INTERRUPTS, 3692 }, { 3693 .name = "rfwo", 3694 .translate = translate_rfw, 3695 .par = (const uint32_t[]){true}, 3696 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_CHECK_INTERRUPTS, 3697 }, { 3698 .name = "rfwu", 3699 .translate = translate_rfw, 3700 .par = (const uint32_t[]){false}, 3701 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_CHECK_INTERRUPTS, 3702 }, { 3703 .name = "ritlb0", 3704 .translate = translate_rtlb, 3705 .par = (const uint32_t[]){false, 0}, 3706 .op_flags = XTENSA_OP_PRIVILEGED, 3707 }, { 3708 .name = "ritlb1", 3709 .translate = translate_rtlb, 3710 .par = (const uint32_t[]){false, 1}, 3711 .op_flags = XTENSA_OP_PRIVILEGED, 3712 }, { 3713 .name = "rptlb0", 3714 .translate = translate_rptlb0, 3715 .op_flags = XTENSA_OP_PRIVILEGED, 3716 }, { 3717 .name = "rptlb1", 3718 .translate = translate_rptlb1, 3719 .op_flags = XTENSA_OP_PRIVILEGED, 3720 }, { 3721 .name = "rotw", 3722 .translate = translate_rotw, 3723 .op_flags = XTENSA_OP_PRIVILEGED | 3724 XTENSA_OP_EXIT_TB_M1 | 3725 XTENSA_OP_SYNC_REGISTER_WINDOW, 3726 }, { 3727 .name = "rsil", 3728 .translate = translate_rsil, 3729 .op_flags = 3730 XTENSA_OP_PRIVILEGED | 3731 XTENSA_OP_EXIT_TB_0 | 3732 XTENSA_OP_CHECK_INTERRUPTS, 3733 }, { 3734 .name = "rsr.176", 3735 .translate = translate_rsr, 3736 .par = (const uint32_t[]){176}, 3737 .op_flags = XTENSA_OP_PRIVILEGED, 3738 }, { 3739 .name = "rsr.208", 3740 .translate = translate_rsr, 3741 .par = (const uint32_t[]){208}, 3742 .op_flags = XTENSA_OP_PRIVILEGED, 3743 }, { 3744 .name = "rsr.acchi", 3745 .translate = translate_rsr, 3746 .test_exceptions = test_exceptions_sr, 3747 .par = (const uint32_t[]){ 3748 ACCHI, 3749 XTENSA_OPTION_MAC16, 3750 }, 3751 }, { 3752 .name = "rsr.acclo", 3753 .translate = translate_rsr, 3754 .test_exceptions = test_exceptions_sr, 3755 .par = (const uint32_t[]){ 3756 ACCLO, 3757 XTENSA_OPTION_MAC16, 3758 }, 3759 }, { 3760 .name = "rsr.atomctl", 3761 .translate = translate_rsr, 3762 .test_exceptions = test_exceptions_sr, 3763 .par = (const uint32_t[]){ 3764 ATOMCTL, 3765 XTENSA_OPTION_ATOMCTL, 3766 }, 3767 .op_flags = XTENSA_OP_PRIVILEGED, 3768 }, { 3769 .name = "rsr.br", 3770 .translate = translate_rsr, 3771 .test_exceptions = test_exceptions_sr, 3772 .par = (const uint32_t[]){ 3773 BR, 3774 XTENSA_OPTION_BOOLEAN, 3775 }, 3776 }, { 3777 .name = "rsr.cacheadrdis", 3778 .translate = translate_rsr, 3779 .test_exceptions = test_exceptions_sr, 3780 .par = (const uint32_t[]){ 3781 CACHEADRDIS, 3782 XTENSA_OPTION_MPU, 3783 }, 3784 .op_flags = XTENSA_OP_PRIVILEGED, 3785 }, { 3786 .name = "rsr.cacheattr", 3787 .translate = translate_rsr, 3788 .test_exceptions = test_exceptions_sr, 3789 .par = (const uint32_t[]){ 3790 CACHEATTR, 3791 XTENSA_OPTION_CACHEATTR, 3792 }, 3793 .op_flags = XTENSA_OP_PRIVILEGED, 3794 }, { 3795 .name = "rsr.ccompare0", 3796 .translate = translate_rsr, 3797 .test_exceptions = test_exceptions_ccompare, 3798 .par = (const uint32_t[]){ 3799 CCOMPARE, 3800 XTENSA_OPTION_TIMER_INTERRUPT, 3801 }, 3802 .op_flags = XTENSA_OP_PRIVILEGED, 3803 }, { 3804 .name = "rsr.ccompare1", 3805 .translate = translate_rsr, 3806 .test_exceptions = test_exceptions_ccompare, 3807 .par = (const uint32_t[]){ 3808 CCOMPARE + 1, 3809 XTENSA_OPTION_TIMER_INTERRUPT, 3810 }, 3811 .op_flags = XTENSA_OP_PRIVILEGED, 3812 }, { 3813 .name = "rsr.ccompare2", 3814 .translate = translate_rsr, 3815 .test_exceptions = test_exceptions_ccompare, 3816 .par = (const uint32_t[]){ 3817 CCOMPARE + 2, 3818 XTENSA_OPTION_TIMER_INTERRUPT, 3819 }, 3820 .op_flags = XTENSA_OP_PRIVILEGED, 3821 }, { 3822 .name = "rsr.ccount", 3823 .translate = translate_rsr_ccount, 3824 .test_exceptions = test_exceptions_sr, 3825 .par = (const uint32_t[]){ 3826 CCOUNT, 3827 XTENSA_OPTION_TIMER_INTERRUPT, 3828 }, 3829 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 3830 }, { 3831 .name = "rsr.configid0", 3832 .translate = translate_rsr, 3833 .par = (const uint32_t[]){CONFIGID0}, 3834 .op_flags = XTENSA_OP_PRIVILEGED, 3835 }, { 3836 .name = "rsr.configid1", 3837 .translate = translate_rsr, 3838 .par = (const uint32_t[]){CONFIGID1}, 3839 .op_flags = XTENSA_OP_PRIVILEGED, 3840 }, { 3841 .name = "rsr.cpenable", 3842 .translate = translate_rsr, 3843 .test_exceptions = test_exceptions_sr, 3844 .par = (const uint32_t[]){ 3845 CPENABLE, 3846 XTENSA_OPTION_COPROCESSOR, 3847 }, 3848 .op_flags = XTENSA_OP_PRIVILEGED, 3849 }, { 3850 .name = "rsr.dbreaka0", 3851 .translate = translate_rsr, 3852 .test_exceptions = test_exceptions_dbreak, 3853 .par = (const uint32_t[]){ 3854 DBREAKA, 3855 XTENSA_OPTION_DEBUG, 3856 }, 3857 .op_flags = XTENSA_OP_PRIVILEGED, 3858 }, { 3859 .name = "rsr.dbreaka1", 3860 .translate = translate_rsr, 3861 .test_exceptions = test_exceptions_dbreak, 3862 .par = (const uint32_t[]){ 3863 DBREAKA + 1, 3864 XTENSA_OPTION_DEBUG, 3865 }, 3866 .op_flags = XTENSA_OP_PRIVILEGED, 3867 }, { 3868 .name = "rsr.dbreakc0", 3869 .translate = translate_rsr, 3870 .test_exceptions = test_exceptions_dbreak, 3871 .par = (const uint32_t[]){ 3872 DBREAKC, 3873 XTENSA_OPTION_DEBUG, 3874 }, 3875 .op_flags = XTENSA_OP_PRIVILEGED, 3876 }, { 3877 .name = "rsr.dbreakc1", 3878 .translate = translate_rsr, 3879 .test_exceptions = test_exceptions_dbreak, 3880 .par = (const uint32_t[]){ 3881 DBREAKC + 1, 3882 XTENSA_OPTION_DEBUG, 3883 }, 3884 .op_flags = XTENSA_OP_PRIVILEGED, 3885 }, { 3886 .name = "rsr.ddr", 3887 .translate = translate_rsr, 3888 .test_exceptions = test_exceptions_sr, 3889 .par = (const uint32_t[]){ 3890 DDR, 3891 XTENSA_OPTION_DEBUG, 3892 }, 3893 .op_flags = XTENSA_OP_PRIVILEGED, 3894 }, { 3895 .name = "rsr.debugcause", 3896 .translate = translate_rsr, 3897 .test_exceptions = test_exceptions_sr, 3898 .par = (const uint32_t[]){ 3899 DEBUGCAUSE, 3900 XTENSA_OPTION_DEBUG, 3901 }, 3902 .op_flags = XTENSA_OP_PRIVILEGED, 3903 }, { 3904 .name = "rsr.depc", 3905 .translate = translate_rsr, 3906 .test_exceptions = test_exceptions_sr, 3907 .par = (const uint32_t[]){ 3908 DEPC, 3909 XTENSA_OPTION_EXCEPTION, 3910 }, 3911 .op_flags = XTENSA_OP_PRIVILEGED, 3912 }, { 3913 .name = "rsr.dtlbcfg", 3914 .translate = translate_rsr, 3915 .test_exceptions = test_exceptions_sr, 3916 .par = (const uint32_t[]){ 3917 DTLBCFG, 3918 XTENSA_OPTION_MMU, 3919 }, 3920 .op_flags = XTENSA_OP_PRIVILEGED, 3921 }, { 3922 .name = "rsr.epc1", 3923 .translate = translate_rsr, 3924 .test_exceptions = test_exceptions_sr, 3925 .par = (const uint32_t[]){ 3926 EPC1, 3927 XTENSA_OPTION_EXCEPTION, 3928 }, 3929 .op_flags = XTENSA_OP_PRIVILEGED, 3930 }, { 3931 .name = "rsr.epc2", 3932 .translate = translate_rsr, 3933 .test_exceptions = test_exceptions_hpi, 3934 .par = (const uint32_t[]){ 3935 EPC1 + 1, 3936 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 3937 }, 3938 .op_flags = XTENSA_OP_PRIVILEGED, 3939 }, { 3940 .name = "rsr.epc3", 3941 .translate = translate_rsr, 3942 .test_exceptions = test_exceptions_hpi, 3943 .par = (const uint32_t[]){ 3944 EPC1 + 2, 3945 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 3946 }, 3947 .op_flags = XTENSA_OP_PRIVILEGED, 3948 }, { 3949 .name = "rsr.epc4", 3950 .translate = translate_rsr, 3951 .test_exceptions = test_exceptions_hpi, 3952 .par = (const uint32_t[]){ 3953 EPC1 + 3, 3954 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 3955 }, 3956 .op_flags = XTENSA_OP_PRIVILEGED, 3957 }, { 3958 .name = "rsr.epc5", 3959 .translate = translate_rsr, 3960 .test_exceptions = test_exceptions_hpi, 3961 .par = (const uint32_t[]){ 3962 EPC1 + 4, 3963 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 3964 }, 3965 .op_flags = XTENSA_OP_PRIVILEGED, 3966 }, { 3967 .name = "rsr.epc6", 3968 .translate = translate_rsr, 3969 .test_exceptions = test_exceptions_hpi, 3970 .par = (const uint32_t[]){ 3971 EPC1 + 5, 3972 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 3973 }, 3974 .op_flags = XTENSA_OP_PRIVILEGED, 3975 }, { 3976 .name = "rsr.epc7", 3977 .translate = translate_rsr, 3978 .test_exceptions = test_exceptions_hpi, 3979 .par = (const uint32_t[]){ 3980 EPC1 + 6, 3981 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 3982 }, 3983 .op_flags = XTENSA_OP_PRIVILEGED, 3984 }, { 3985 .name = "rsr.eps2", 3986 .translate = translate_rsr, 3987 .test_exceptions = test_exceptions_hpi, 3988 .par = (const uint32_t[]){ 3989 EPS2, 3990 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 3991 }, 3992 .op_flags = XTENSA_OP_PRIVILEGED, 3993 }, { 3994 .name = "rsr.eps3", 3995 .translate = translate_rsr, 3996 .test_exceptions = test_exceptions_hpi, 3997 .par = (const uint32_t[]){ 3998 EPS2 + 1, 3999 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4000 }, 4001 .op_flags = XTENSA_OP_PRIVILEGED, 4002 }, { 4003 .name = "rsr.eps4", 4004 .translate = translate_rsr, 4005 .test_exceptions = test_exceptions_hpi, 4006 .par = (const uint32_t[]){ 4007 EPS2 + 2, 4008 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4009 }, 4010 .op_flags = XTENSA_OP_PRIVILEGED, 4011 }, { 4012 .name = "rsr.eps5", 4013 .translate = translate_rsr, 4014 .test_exceptions = test_exceptions_hpi, 4015 .par = (const uint32_t[]){ 4016 EPS2 + 3, 4017 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4018 }, 4019 .op_flags = XTENSA_OP_PRIVILEGED, 4020 }, { 4021 .name = "rsr.eps6", 4022 .translate = translate_rsr, 4023 .test_exceptions = test_exceptions_hpi, 4024 .par = (const uint32_t[]){ 4025 EPS2 + 4, 4026 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4027 }, 4028 .op_flags = XTENSA_OP_PRIVILEGED, 4029 }, { 4030 .name = "rsr.eps7", 4031 .translate = translate_rsr, 4032 .test_exceptions = test_exceptions_hpi, 4033 .par = (const uint32_t[]){ 4034 EPS2 + 5, 4035 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4036 }, 4037 .op_flags = XTENSA_OP_PRIVILEGED, 4038 }, { 4039 .name = "rsr.eraccess", 4040 .translate = translate_rsr, 4041 .par = (const uint32_t[]){ERACCESS}, 4042 .op_flags = XTENSA_OP_PRIVILEGED, 4043 }, { 4044 .name = "rsr.exccause", 4045 .translate = translate_rsr, 4046 .test_exceptions = test_exceptions_sr, 4047 .par = (const uint32_t[]){ 4048 EXCCAUSE, 4049 XTENSA_OPTION_EXCEPTION, 4050 }, 4051 .op_flags = XTENSA_OP_PRIVILEGED, 4052 }, { 4053 .name = "rsr.excsave1", 4054 .translate = translate_rsr, 4055 .test_exceptions = test_exceptions_sr, 4056 .par = (const uint32_t[]){ 4057 EXCSAVE1, 4058 XTENSA_OPTION_EXCEPTION, 4059 }, 4060 .op_flags = XTENSA_OP_PRIVILEGED, 4061 }, { 4062 .name = "rsr.excsave2", 4063 .translate = translate_rsr, 4064 .test_exceptions = test_exceptions_hpi, 4065 .par = (const uint32_t[]){ 4066 EXCSAVE1 + 1, 4067 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4068 }, 4069 .op_flags = XTENSA_OP_PRIVILEGED, 4070 }, { 4071 .name = "rsr.excsave3", 4072 .translate = translate_rsr, 4073 .test_exceptions = test_exceptions_hpi, 4074 .par = (const uint32_t[]){ 4075 EXCSAVE1 + 2, 4076 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4077 }, 4078 .op_flags = XTENSA_OP_PRIVILEGED, 4079 }, { 4080 .name = "rsr.excsave4", 4081 .translate = translate_rsr, 4082 .test_exceptions = test_exceptions_hpi, 4083 .par = (const uint32_t[]){ 4084 EXCSAVE1 + 3, 4085 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4086 }, 4087 .op_flags = XTENSA_OP_PRIVILEGED, 4088 }, { 4089 .name = "rsr.excsave5", 4090 .translate = translate_rsr, 4091 .test_exceptions = test_exceptions_hpi, 4092 .par = (const uint32_t[]){ 4093 EXCSAVE1 + 4, 4094 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4095 }, 4096 .op_flags = XTENSA_OP_PRIVILEGED, 4097 }, { 4098 .name = "rsr.excsave6", 4099 .translate = translate_rsr, 4100 .test_exceptions = test_exceptions_hpi, 4101 .par = (const uint32_t[]){ 4102 EXCSAVE1 + 5, 4103 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4104 }, 4105 .op_flags = XTENSA_OP_PRIVILEGED, 4106 }, { 4107 .name = "rsr.excsave7", 4108 .translate = translate_rsr, 4109 .test_exceptions = test_exceptions_hpi, 4110 .par = (const uint32_t[]){ 4111 EXCSAVE1 + 6, 4112 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4113 }, 4114 .op_flags = XTENSA_OP_PRIVILEGED, 4115 }, { 4116 .name = "rsr.excvaddr", 4117 .translate = translate_rsr, 4118 .test_exceptions = test_exceptions_sr, 4119 .par = (const uint32_t[]){ 4120 EXCVADDR, 4121 XTENSA_OPTION_EXCEPTION, 4122 }, 4123 .op_flags = XTENSA_OP_PRIVILEGED, 4124 }, { 4125 .name = "rsr.ibreaka0", 4126 .translate = translate_rsr, 4127 .test_exceptions = test_exceptions_ibreak, 4128 .par = (const uint32_t[]){ 4129 IBREAKA, 4130 XTENSA_OPTION_DEBUG, 4131 }, 4132 .op_flags = XTENSA_OP_PRIVILEGED, 4133 }, { 4134 .name = "rsr.ibreaka1", 4135 .translate = translate_rsr, 4136 .test_exceptions = test_exceptions_ibreak, 4137 .par = (const uint32_t[]){ 4138 IBREAKA + 1, 4139 XTENSA_OPTION_DEBUG, 4140 }, 4141 .op_flags = XTENSA_OP_PRIVILEGED, 4142 }, { 4143 .name = "rsr.ibreakenable", 4144 .translate = translate_rsr, 4145 .test_exceptions = test_exceptions_sr, 4146 .par = (const uint32_t[]){ 4147 IBREAKENABLE, 4148 XTENSA_OPTION_DEBUG, 4149 }, 4150 .op_flags = XTENSA_OP_PRIVILEGED, 4151 }, { 4152 .name = "rsr.icount", 4153 .translate = translate_rsr, 4154 .test_exceptions = test_exceptions_sr, 4155 .par = (const uint32_t[]){ 4156 ICOUNT, 4157 XTENSA_OPTION_DEBUG, 4158 }, 4159 .op_flags = XTENSA_OP_PRIVILEGED, 4160 }, { 4161 .name = "rsr.icountlevel", 4162 .translate = translate_rsr, 4163 .test_exceptions = test_exceptions_sr, 4164 .par = (const uint32_t[]){ 4165 ICOUNTLEVEL, 4166 XTENSA_OPTION_DEBUG, 4167 }, 4168 .op_flags = XTENSA_OP_PRIVILEGED, 4169 }, { 4170 .name = "rsr.intclear", 4171 .translate = translate_rsr, 4172 .test_exceptions = test_exceptions_sr, 4173 .par = (const uint32_t[]){ 4174 INTCLEAR, 4175 XTENSA_OPTION_INTERRUPT, 4176 }, 4177 .op_flags = XTENSA_OP_PRIVILEGED, 4178 }, { 4179 .name = "rsr.intenable", 4180 .translate = translate_rsr, 4181 .test_exceptions = test_exceptions_sr, 4182 .par = (const uint32_t[]){ 4183 INTENABLE, 4184 XTENSA_OPTION_INTERRUPT, 4185 }, 4186 .op_flags = XTENSA_OP_PRIVILEGED, 4187 }, { 4188 .name = "rsr.interrupt", 4189 .translate = translate_rsr_ccount, 4190 .test_exceptions = test_exceptions_sr, 4191 .par = (const uint32_t[]){ 4192 INTSET, 4193 XTENSA_OPTION_INTERRUPT, 4194 }, 4195 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 4196 }, { 4197 .name = "rsr.intset", 4198 .translate = translate_rsr_ccount, 4199 .test_exceptions = test_exceptions_sr, 4200 .par = (const uint32_t[]){ 4201 INTSET, 4202 XTENSA_OPTION_INTERRUPT, 4203 }, 4204 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 4205 }, { 4206 .name = "rsr.itlbcfg", 4207 .translate = translate_rsr, 4208 .test_exceptions = test_exceptions_sr, 4209 .par = (const uint32_t[]){ 4210 ITLBCFG, 4211 XTENSA_OPTION_MMU, 4212 }, 4213 .op_flags = XTENSA_OP_PRIVILEGED, 4214 }, { 4215 .name = "rsr.lbeg", 4216 .translate = translate_rsr, 4217 .test_exceptions = test_exceptions_sr, 4218 .par = (const uint32_t[]){ 4219 LBEG, 4220 XTENSA_OPTION_LOOP, 4221 }, 4222 }, { 4223 .name = "rsr.lcount", 4224 .translate = translate_rsr, 4225 .test_exceptions = test_exceptions_sr, 4226 .par = (const uint32_t[]){ 4227 LCOUNT, 4228 XTENSA_OPTION_LOOP, 4229 }, 4230 }, { 4231 .name = "rsr.lend", 4232 .translate = translate_rsr, 4233 .test_exceptions = test_exceptions_sr, 4234 .par = (const uint32_t[]){ 4235 LEND, 4236 XTENSA_OPTION_LOOP, 4237 }, 4238 }, { 4239 .name = "rsr.litbase", 4240 .translate = translate_rsr, 4241 .test_exceptions = test_exceptions_sr, 4242 .par = (const uint32_t[]){ 4243 LITBASE, 4244 XTENSA_OPTION_EXTENDED_L32R, 4245 }, 4246 }, { 4247 .name = "rsr.m0", 4248 .translate = translate_rsr, 4249 .test_exceptions = test_exceptions_sr, 4250 .par = (const uint32_t[]){ 4251 MR, 4252 XTENSA_OPTION_MAC16, 4253 }, 4254 }, { 4255 .name = "rsr.m1", 4256 .translate = translate_rsr, 4257 .test_exceptions = test_exceptions_sr, 4258 .par = (const uint32_t[]){ 4259 MR + 1, 4260 XTENSA_OPTION_MAC16, 4261 }, 4262 }, { 4263 .name = "rsr.m2", 4264 .translate = translate_rsr, 4265 .test_exceptions = test_exceptions_sr, 4266 .par = (const uint32_t[]){ 4267 MR + 2, 4268 XTENSA_OPTION_MAC16, 4269 }, 4270 }, { 4271 .name = "rsr.m3", 4272 .translate = translate_rsr, 4273 .test_exceptions = test_exceptions_sr, 4274 .par = (const uint32_t[]){ 4275 MR + 3, 4276 XTENSA_OPTION_MAC16, 4277 }, 4278 }, { 4279 .name = "rsr.memctl", 4280 .translate = translate_rsr, 4281 .par = (const uint32_t[]){MEMCTL}, 4282 .op_flags = XTENSA_OP_PRIVILEGED, 4283 }, { 4284 .name = "rsr.mecr", 4285 .translate = translate_rsr, 4286 .test_exceptions = test_exceptions_sr, 4287 .par = (const uint32_t[]){ 4288 MECR, 4289 XTENSA_OPTION_MEMORY_ECC_PARITY, 4290 }, 4291 .op_flags = XTENSA_OP_PRIVILEGED, 4292 }, { 4293 .name = "rsr.mepc", 4294 .translate = translate_rsr, 4295 .test_exceptions = test_exceptions_sr, 4296 .par = (const uint32_t[]){ 4297 MEPC, 4298 XTENSA_OPTION_MEMORY_ECC_PARITY, 4299 }, 4300 .op_flags = XTENSA_OP_PRIVILEGED, 4301 }, { 4302 .name = "rsr.meps", 4303 .translate = translate_rsr, 4304 .test_exceptions = test_exceptions_sr, 4305 .par = (const uint32_t[]){ 4306 MEPS, 4307 XTENSA_OPTION_MEMORY_ECC_PARITY, 4308 }, 4309 .op_flags = XTENSA_OP_PRIVILEGED, 4310 }, { 4311 .name = "rsr.mesave", 4312 .translate = translate_rsr, 4313 .test_exceptions = test_exceptions_sr, 4314 .par = (const uint32_t[]){ 4315 MESAVE, 4316 XTENSA_OPTION_MEMORY_ECC_PARITY, 4317 }, 4318 .op_flags = XTENSA_OP_PRIVILEGED, 4319 }, { 4320 .name = "rsr.mesr", 4321 .translate = translate_rsr, 4322 .test_exceptions = test_exceptions_sr, 4323 .par = (const uint32_t[]){ 4324 MESR, 4325 XTENSA_OPTION_MEMORY_ECC_PARITY, 4326 }, 4327 .op_flags = XTENSA_OP_PRIVILEGED, 4328 }, { 4329 .name = "rsr.mevaddr", 4330 .translate = translate_rsr, 4331 .test_exceptions = test_exceptions_sr, 4332 .par = (const uint32_t[]){ 4333 MESR, 4334 XTENSA_OPTION_MEMORY_ECC_PARITY, 4335 }, 4336 .op_flags = XTENSA_OP_PRIVILEGED, 4337 }, { 4338 .name = "rsr.misc0", 4339 .translate = translate_rsr, 4340 .test_exceptions = test_exceptions_sr, 4341 .par = (const uint32_t[]){ 4342 MISC, 4343 XTENSA_OPTION_MISC_SR, 4344 }, 4345 .op_flags = XTENSA_OP_PRIVILEGED, 4346 }, { 4347 .name = "rsr.misc1", 4348 .translate = translate_rsr, 4349 .test_exceptions = test_exceptions_sr, 4350 .par = (const uint32_t[]){ 4351 MISC + 1, 4352 XTENSA_OPTION_MISC_SR, 4353 }, 4354 .op_flags = XTENSA_OP_PRIVILEGED, 4355 }, { 4356 .name = "rsr.misc2", 4357 .translate = translate_rsr, 4358 .test_exceptions = test_exceptions_sr, 4359 .par = (const uint32_t[]){ 4360 MISC + 2, 4361 XTENSA_OPTION_MISC_SR, 4362 }, 4363 .op_flags = XTENSA_OP_PRIVILEGED, 4364 }, { 4365 .name = "rsr.misc3", 4366 .translate = translate_rsr, 4367 .test_exceptions = test_exceptions_sr, 4368 .par = (const uint32_t[]){ 4369 MISC + 3, 4370 XTENSA_OPTION_MISC_SR, 4371 }, 4372 .op_flags = XTENSA_OP_PRIVILEGED, 4373 }, { 4374 .name = "rsr.mpucfg", 4375 .translate = translate_rsr, 4376 .test_exceptions = test_exceptions_sr, 4377 .par = (const uint32_t[]){ 4378 MPUCFG, 4379 XTENSA_OPTION_MPU, 4380 }, 4381 .op_flags = XTENSA_OP_PRIVILEGED, 4382 }, { 4383 .name = "rsr.mpuenb", 4384 .translate = translate_rsr, 4385 .test_exceptions = test_exceptions_sr, 4386 .par = (const uint32_t[]){ 4387 MPUENB, 4388 XTENSA_OPTION_MPU, 4389 }, 4390 .op_flags = XTENSA_OP_PRIVILEGED, 4391 }, { 4392 .name = "rsr.prefctl", 4393 .translate = translate_rsr, 4394 .par = (const uint32_t[]){PREFCTL}, 4395 }, { 4396 .name = "rsr.prid", 4397 .translate = translate_rsr, 4398 .test_exceptions = test_exceptions_sr, 4399 .par = (const uint32_t[]){ 4400 PRID, 4401 XTENSA_OPTION_PROCESSOR_ID, 4402 }, 4403 .op_flags = XTENSA_OP_PRIVILEGED, 4404 }, { 4405 .name = "rsr.ps", 4406 .translate = translate_rsr, 4407 .test_exceptions = test_exceptions_sr, 4408 .par = (const uint32_t[]){ 4409 PS, 4410 XTENSA_OPTION_EXCEPTION, 4411 }, 4412 .op_flags = XTENSA_OP_PRIVILEGED, 4413 }, { 4414 .name = "rsr.ptevaddr", 4415 .translate = translate_rsr_ptevaddr, 4416 .test_exceptions = test_exceptions_sr, 4417 .par = (const uint32_t[]){ 4418 PTEVADDR, 4419 XTENSA_OPTION_MMU, 4420 }, 4421 .op_flags = XTENSA_OP_PRIVILEGED, 4422 }, { 4423 .name = "rsr.rasid", 4424 .translate = translate_rsr, 4425 .test_exceptions = test_exceptions_sr, 4426 .par = (const uint32_t[]){ 4427 RASID, 4428 XTENSA_OPTION_MMU, 4429 }, 4430 .op_flags = XTENSA_OP_PRIVILEGED, 4431 }, { 4432 .name = "rsr.sar", 4433 .translate = translate_rsr, 4434 .par = (const uint32_t[]){SAR}, 4435 }, { 4436 .name = "rsr.scompare1", 4437 .translate = translate_rsr, 4438 .test_exceptions = test_exceptions_sr, 4439 .par = (const uint32_t[]){ 4440 SCOMPARE1, 4441 XTENSA_OPTION_CONDITIONAL_STORE, 4442 }, 4443 }, { 4444 .name = "rsr.vecbase", 4445 .translate = translate_rsr, 4446 .test_exceptions = test_exceptions_sr, 4447 .par = (const uint32_t[]){ 4448 VECBASE, 4449 XTENSA_OPTION_RELOCATABLE_VECTOR, 4450 }, 4451 .op_flags = XTENSA_OP_PRIVILEGED, 4452 }, { 4453 .name = "rsr.windowbase", 4454 .translate = translate_rsr, 4455 .test_exceptions = test_exceptions_sr, 4456 .par = (const uint32_t[]){ 4457 WINDOW_BASE, 4458 XTENSA_OPTION_WINDOWED_REGISTER, 4459 }, 4460 .op_flags = XTENSA_OP_PRIVILEGED, 4461 }, { 4462 .name = "rsr.windowstart", 4463 .translate = translate_rsr, 4464 .test_exceptions = test_exceptions_sr, 4465 .par = (const uint32_t[]){ 4466 WINDOW_START, 4467 XTENSA_OPTION_WINDOWED_REGISTER, 4468 }, 4469 .op_flags = XTENSA_OP_PRIVILEGED, 4470 }, { 4471 .name = "rsync", 4472 .translate = translate_nop, 4473 }, { 4474 .name = "rur.expstate", 4475 .translate = translate_rur, 4476 .par = (const uint32_t[]){EXPSTATE}, 4477 }, { 4478 .name = "rur.threadptr", 4479 .translate = translate_rur, 4480 .par = (const uint32_t[]){THREADPTR}, 4481 }, { 4482 .name = "s16i", 4483 .translate = translate_ldst, 4484 .par = (const uint32_t[]){MO_TEUW, false, true}, 4485 .op_flags = XTENSA_OP_STORE, 4486 }, { 4487 .name = "s32c1i", 4488 .translate = translate_s32c1i, 4489 .op_flags = XTENSA_OP_LOAD | XTENSA_OP_STORE, 4490 }, { 4491 .name = "s32e", 4492 .translate = translate_s32e, 4493 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_STORE, 4494 }, { 4495 .name = "s32ex", 4496 .translate = translate_s32ex, 4497 .op_flags = XTENSA_OP_LOAD | XTENSA_OP_STORE, 4498 }, { 4499 .name = (const char * const[]) { 4500 "s32i", "s32i.n", "s32nb", NULL, 4501 }, 4502 .translate = translate_ldst, 4503 .par = (const uint32_t[]){MO_TEUL, false, true}, 4504 .op_flags = XTENSA_OP_NAME_ARRAY | XTENSA_OP_STORE, 4505 }, { 4506 .name = "s32ri", 4507 .translate = translate_ldst, 4508 .par = (const uint32_t[]){MO_TEUL | MO_ALIGN, true, true}, 4509 .op_flags = XTENSA_OP_STORE, 4510 }, { 4511 .name = "s8i", 4512 .translate = translate_ldst, 4513 .par = (const uint32_t[]){MO_UB, false, true}, 4514 .op_flags = XTENSA_OP_STORE, 4515 }, { 4516 .name = "salt", 4517 .translate = translate_salt, 4518 .par = (const uint32_t[]){TCG_COND_LT}, 4519 }, { 4520 .name = "saltu", 4521 .translate = translate_salt, 4522 .par = (const uint32_t[]){TCG_COND_LTU}, 4523 }, { 4524 .name = "sdct", 4525 .translate = translate_nop, 4526 .op_flags = XTENSA_OP_PRIVILEGED, 4527 }, { 4528 .name = "sdcw", 4529 .translate = translate_nop, 4530 .op_flags = XTENSA_OP_PRIVILEGED, 4531 }, { 4532 .name = "setb_expstate", 4533 .translate = translate_setb_expstate, 4534 }, { 4535 .name = "sext", 4536 .translate = translate_sext, 4537 }, { 4538 .name = "sict", 4539 .translate = translate_nop, 4540 .op_flags = XTENSA_OP_PRIVILEGED, 4541 }, { 4542 .name = "sicw", 4543 .translate = translate_nop, 4544 .op_flags = XTENSA_OP_PRIVILEGED, 4545 }, { 4546 .name = "simcall", 4547 .translate = translate_simcall, 4548 .test_exceptions = test_exceptions_simcall, 4549 .op_flags = XTENSA_OP_PRIVILEGED, 4550 }, { 4551 .name = "sll", 4552 .translate = translate_sll, 4553 }, { 4554 .name = "slli", 4555 .translate = translate_slli, 4556 }, { 4557 .name = "sra", 4558 .translate = translate_sra, 4559 }, { 4560 .name = "srai", 4561 .translate = translate_srai, 4562 }, { 4563 .name = "src", 4564 .translate = translate_src, 4565 }, { 4566 .name = "srl", 4567 .translate = translate_srl, 4568 }, { 4569 .name = "srli", 4570 .translate = translate_srli, 4571 }, { 4572 .name = "ssa8b", 4573 .translate = translate_ssa8b, 4574 }, { 4575 .name = "ssa8l", 4576 .translate = translate_ssa8l, 4577 }, { 4578 .name = "ssai", 4579 .translate = translate_ssai, 4580 }, { 4581 .name = "ssl", 4582 .translate = translate_ssl, 4583 }, { 4584 .name = "ssr", 4585 .translate = translate_ssr, 4586 }, { 4587 .name = "sub", 4588 .translate = translate_sub, 4589 }, { 4590 .name = "subx2", 4591 .translate = translate_subx, 4592 .par = (const uint32_t[]){1}, 4593 }, { 4594 .name = "subx4", 4595 .translate = translate_subx, 4596 .par = (const uint32_t[]){2}, 4597 }, { 4598 .name = "subx8", 4599 .translate = translate_subx, 4600 .par = (const uint32_t[]){3}, 4601 }, { 4602 .name = "syscall", 4603 .op_flags = XTENSA_OP_SYSCALL, 4604 }, { 4605 .name = "umul.aa.hh", 4606 .translate = translate_mac16, 4607 .par = (const uint32_t[]){MAC16_UMUL, MAC16_HH, 0}, 4608 }, { 4609 .name = "umul.aa.hl", 4610 .translate = translate_mac16, 4611 .par = (const uint32_t[]){MAC16_UMUL, MAC16_HL, 0}, 4612 }, { 4613 .name = "umul.aa.lh", 4614 .translate = translate_mac16, 4615 .par = (const uint32_t[]){MAC16_UMUL, MAC16_LH, 0}, 4616 }, { 4617 .name = "umul.aa.ll", 4618 .translate = translate_mac16, 4619 .par = (const uint32_t[]){MAC16_UMUL, MAC16_LL, 0}, 4620 }, { 4621 .name = "waiti", 4622 .translate = translate_waiti, 4623 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 4624 }, { 4625 .name = "wdtlb", 4626 .translate = translate_wtlb, 4627 .par = (const uint32_t[]){true}, 4628 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_M1, 4629 }, { 4630 .name = "wer", 4631 .translate = translate_wer, 4632 .op_flags = XTENSA_OP_PRIVILEGED, 4633 }, { 4634 .name = "witlb", 4635 .translate = translate_wtlb, 4636 .par = (const uint32_t[]){false}, 4637 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_M1, 4638 }, { 4639 .name = "wptlb", 4640 .translate = translate_wptlb, 4641 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_M1, 4642 }, { 4643 .name = "wrmsk_expstate", 4644 .translate = translate_wrmsk_expstate, 4645 }, { 4646 .name = "wsr.176", 4647 .op_flags = XTENSA_OP_ILL, 4648 }, { 4649 .name = "wsr.208", 4650 .op_flags = XTENSA_OP_ILL, 4651 }, { 4652 .name = "wsr.acchi", 4653 .translate = translate_wsr_acchi, 4654 .test_exceptions = test_exceptions_sr, 4655 .par = (const uint32_t[]){ 4656 ACCHI, 4657 XTENSA_OPTION_MAC16, 4658 }, 4659 }, { 4660 .name = "wsr.acclo", 4661 .translate = translate_wsr, 4662 .test_exceptions = test_exceptions_sr, 4663 .par = (const uint32_t[]){ 4664 ACCLO, 4665 XTENSA_OPTION_MAC16, 4666 }, 4667 }, { 4668 .name = "wsr.atomctl", 4669 .translate = translate_wsr_mask, 4670 .test_exceptions = test_exceptions_sr, 4671 .par = (const uint32_t[]){ 4672 ATOMCTL, 4673 XTENSA_OPTION_ATOMCTL, 4674 0x3f, 4675 }, 4676 .op_flags = XTENSA_OP_PRIVILEGED, 4677 }, { 4678 .name = "wsr.br", 4679 .translate = translate_wsr_mask, 4680 .test_exceptions = test_exceptions_sr, 4681 .par = (const uint32_t[]){ 4682 BR, 4683 XTENSA_OPTION_BOOLEAN, 4684 0xffff, 4685 }, 4686 }, { 4687 .name = "wsr.cacheadrdis", 4688 .translate = translate_wsr_mask, 4689 .test_exceptions = test_exceptions_sr, 4690 .par = (const uint32_t[]){ 4691 CACHEADRDIS, 4692 XTENSA_OPTION_MPU, 4693 0xff, 4694 }, 4695 .op_flags = XTENSA_OP_PRIVILEGED, 4696 }, { 4697 .name = "wsr.cacheattr", 4698 .translate = translate_wsr, 4699 .test_exceptions = test_exceptions_sr, 4700 .par = (const uint32_t[]){ 4701 CACHEATTR, 4702 XTENSA_OPTION_CACHEATTR, 4703 }, 4704 .op_flags = XTENSA_OP_PRIVILEGED, 4705 }, { 4706 .name = "wsr.ccompare0", 4707 .translate = translate_wsr_ccompare, 4708 .test_exceptions = test_exceptions_ccompare, 4709 .par = (const uint32_t[]){ 4710 CCOMPARE, 4711 XTENSA_OPTION_TIMER_INTERRUPT, 4712 }, 4713 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 4714 }, { 4715 .name = "wsr.ccompare1", 4716 .translate = translate_wsr_ccompare, 4717 .test_exceptions = test_exceptions_ccompare, 4718 .par = (const uint32_t[]){ 4719 CCOMPARE + 1, 4720 XTENSA_OPTION_TIMER_INTERRUPT, 4721 }, 4722 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 4723 }, { 4724 .name = "wsr.ccompare2", 4725 .translate = translate_wsr_ccompare, 4726 .test_exceptions = test_exceptions_ccompare, 4727 .par = (const uint32_t[]){ 4728 CCOMPARE + 2, 4729 XTENSA_OPTION_TIMER_INTERRUPT, 4730 }, 4731 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 4732 }, { 4733 .name = "wsr.ccount", 4734 .translate = translate_wsr_ccount, 4735 .test_exceptions = test_exceptions_sr, 4736 .par = (const uint32_t[]){ 4737 CCOUNT, 4738 XTENSA_OPTION_TIMER_INTERRUPT, 4739 }, 4740 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 4741 }, { 4742 .name = "wsr.configid0", 4743 .op_flags = XTENSA_OP_ILL, 4744 }, { 4745 .name = "wsr.configid1", 4746 .op_flags = XTENSA_OP_ILL, 4747 }, { 4748 .name = "wsr.cpenable", 4749 .translate = translate_wsr_mask, 4750 .test_exceptions = test_exceptions_sr, 4751 .par = (const uint32_t[]){ 4752 CPENABLE, 4753 XTENSA_OPTION_COPROCESSOR, 4754 0xff, 4755 }, 4756 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_M1, 4757 }, { 4758 .name = "wsr.dbreaka0", 4759 .translate = translate_wsr_dbreaka, 4760 .test_exceptions = test_exceptions_dbreak, 4761 .par = (const uint32_t[]){ 4762 DBREAKA, 4763 XTENSA_OPTION_DEBUG, 4764 }, 4765 .op_flags = XTENSA_OP_PRIVILEGED, 4766 }, { 4767 .name = "wsr.dbreaka1", 4768 .translate = translate_wsr_dbreaka, 4769 .test_exceptions = test_exceptions_dbreak, 4770 .par = (const uint32_t[]){ 4771 DBREAKA + 1, 4772 XTENSA_OPTION_DEBUG, 4773 }, 4774 .op_flags = XTENSA_OP_PRIVILEGED, 4775 }, { 4776 .name = "wsr.dbreakc0", 4777 .translate = translate_wsr_dbreakc, 4778 .test_exceptions = test_exceptions_dbreak, 4779 .par = (const uint32_t[]){ 4780 DBREAKC, 4781 XTENSA_OPTION_DEBUG, 4782 }, 4783 .op_flags = XTENSA_OP_PRIVILEGED, 4784 }, { 4785 .name = "wsr.dbreakc1", 4786 .translate = translate_wsr_dbreakc, 4787 .test_exceptions = test_exceptions_dbreak, 4788 .par = (const uint32_t[]){ 4789 DBREAKC + 1, 4790 XTENSA_OPTION_DEBUG, 4791 }, 4792 .op_flags = XTENSA_OP_PRIVILEGED, 4793 }, { 4794 .name = "wsr.ddr", 4795 .translate = translate_wsr, 4796 .test_exceptions = test_exceptions_sr, 4797 .par = (const uint32_t[]){ 4798 DDR, 4799 XTENSA_OPTION_DEBUG, 4800 }, 4801 .op_flags = XTENSA_OP_PRIVILEGED, 4802 }, { 4803 .name = "wsr.debugcause", 4804 .op_flags = XTENSA_OP_ILL, 4805 }, { 4806 .name = "wsr.depc", 4807 .translate = translate_wsr, 4808 .test_exceptions = test_exceptions_sr, 4809 .par = (const uint32_t[]){ 4810 DEPC, 4811 XTENSA_OPTION_EXCEPTION, 4812 }, 4813 .op_flags = XTENSA_OP_PRIVILEGED, 4814 }, { 4815 .name = "wsr.dtlbcfg", 4816 .translate = translate_wsr_mask, 4817 .test_exceptions = test_exceptions_sr, 4818 .par = (const uint32_t[]){ 4819 DTLBCFG, 4820 XTENSA_OPTION_MMU, 4821 0x01130000, 4822 }, 4823 .op_flags = XTENSA_OP_PRIVILEGED, 4824 }, { 4825 .name = "wsr.epc1", 4826 .translate = translate_wsr, 4827 .test_exceptions = test_exceptions_sr, 4828 .par = (const uint32_t[]){ 4829 EPC1, 4830 XTENSA_OPTION_EXCEPTION, 4831 }, 4832 .op_flags = XTENSA_OP_PRIVILEGED, 4833 }, { 4834 .name = "wsr.epc2", 4835 .translate = translate_wsr, 4836 .test_exceptions = test_exceptions_hpi, 4837 .par = (const uint32_t[]){ 4838 EPC1 + 1, 4839 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4840 }, 4841 .op_flags = XTENSA_OP_PRIVILEGED, 4842 }, { 4843 .name = "wsr.epc3", 4844 .translate = translate_wsr, 4845 .test_exceptions = test_exceptions_hpi, 4846 .par = (const uint32_t[]){ 4847 EPC1 + 2, 4848 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4849 }, 4850 .op_flags = XTENSA_OP_PRIVILEGED, 4851 }, { 4852 .name = "wsr.epc4", 4853 .translate = translate_wsr, 4854 .test_exceptions = test_exceptions_hpi, 4855 .par = (const uint32_t[]){ 4856 EPC1 + 3, 4857 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4858 }, 4859 .op_flags = XTENSA_OP_PRIVILEGED, 4860 }, { 4861 .name = "wsr.epc5", 4862 .translate = translate_wsr, 4863 .test_exceptions = test_exceptions_hpi, 4864 .par = (const uint32_t[]){ 4865 EPC1 + 4, 4866 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4867 }, 4868 .op_flags = XTENSA_OP_PRIVILEGED, 4869 }, { 4870 .name = "wsr.epc6", 4871 .translate = translate_wsr, 4872 .test_exceptions = test_exceptions_hpi, 4873 .par = (const uint32_t[]){ 4874 EPC1 + 5, 4875 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4876 }, 4877 .op_flags = XTENSA_OP_PRIVILEGED, 4878 }, { 4879 .name = "wsr.epc7", 4880 .translate = translate_wsr, 4881 .test_exceptions = test_exceptions_hpi, 4882 .par = (const uint32_t[]){ 4883 EPC1 + 6, 4884 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4885 }, 4886 .op_flags = XTENSA_OP_PRIVILEGED, 4887 }, { 4888 .name = "wsr.eps2", 4889 .translate = translate_wsr, 4890 .test_exceptions = test_exceptions_hpi, 4891 .par = (const uint32_t[]){ 4892 EPS2, 4893 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4894 }, 4895 .op_flags = XTENSA_OP_PRIVILEGED, 4896 }, { 4897 .name = "wsr.eps3", 4898 .translate = translate_wsr, 4899 .test_exceptions = test_exceptions_hpi, 4900 .par = (const uint32_t[]){ 4901 EPS2 + 1, 4902 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4903 }, 4904 .op_flags = XTENSA_OP_PRIVILEGED, 4905 }, { 4906 .name = "wsr.eps4", 4907 .translate = translate_wsr, 4908 .test_exceptions = test_exceptions_hpi, 4909 .par = (const uint32_t[]){ 4910 EPS2 + 2, 4911 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4912 }, 4913 .op_flags = XTENSA_OP_PRIVILEGED, 4914 }, { 4915 .name = "wsr.eps5", 4916 .translate = translate_wsr, 4917 .test_exceptions = test_exceptions_hpi, 4918 .par = (const uint32_t[]){ 4919 EPS2 + 3, 4920 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4921 }, 4922 .op_flags = XTENSA_OP_PRIVILEGED, 4923 }, { 4924 .name = "wsr.eps6", 4925 .translate = translate_wsr, 4926 .test_exceptions = test_exceptions_hpi, 4927 .par = (const uint32_t[]){ 4928 EPS2 + 4, 4929 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4930 }, 4931 .op_flags = XTENSA_OP_PRIVILEGED, 4932 }, { 4933 .name = "wsr.eps7", 4934 .translate = translate_wsr, 4935 .test_exceptions = test_exceptions_hpi, 4936 .par = (const uint32_t[]){ 4937 EPS2 + 5, 4938 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4939 }, 4940 .op_flags = XTENSA_OP_PRIVILEGED, 4941 }, { 4942 .name = "wsr.eraccess", 4943 .translate = translate_wsr_mask, 4944 .par = (const uint32_t[]){ 4945 ERACCESS, 4946 0, 4947 0xffff, 4948 }, 4949 .op_flags = XTENSA_OP_PRIVILEGED, 4950 }, { 4951 .name = "wsr.exccause", 4952 .translate = translate_wsr, 4953 .test_exceptions = test_exceptions_sr, 4954 .par = (const uint32_t[]){ 4955 EXCCAUSE, 4956 XTENSA_OPTION_EXCEPTION, 4957 }, 4958 .op_flags = XTENSA_OP_PRIVILEGED, 4959 }, { 4960 .name = "wsr.excsave1", 4961 .translate = translate_wsr, 4962 .test_exceptions = test_exceptions_sr, 4963 .par = (const uint32_t[]){ 4964 EXCSAVE1, 4965 XTENSA_OPTION_EXCEPTION, 4966 }, 4967 .op_flags = XTENSA_OP_PRIVILEGED, 4968 }, { 4969 .name = "wsr.excsave2", 4970 .translate = translate_wsr, 4971 .test_exceptions = test_exceptions_hpi, 4972 .par = (const uint32_t[]){ 4973 EXCSAVE1 + 1, 4974 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4975 }, 4976 .op_flags = XTENSA_OP_PRIVILEGED, 4977 }, { 4978 .name = "wsr.excsave3", 4979 .translate = translate_wsr, 4980 .test_exceptions = test_exceptions_hpi, 4981 .par = (const uint32_t[]){ 4982 EXCSAVE1 + 2, 4983 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4984 }, 4985 .op_flags = XTENSA_OP_PRIVILEGED, 4986 }, { 4987 .name = "wsr.excsave4", 4988 .translate = translate_wsr, 4989 .test_exceptions = test_exceptions_hpi, 4990 .par = (const uint32_t[]){ 4991 EXCSAVE1 + 3, 4992 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 4993 }, 4994 .op_flags = XTENSA_OP_PRIVILEGED, 4995 }, { 4996 .name = "wsr.excsave5", 4997 .translate = translate_wsr, 4998 .test_exceptions = test_exceptions_hpi, 4999 .par = (const uint32_t[]){ 5000 EXCSAVE1 + 4, 5001 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5002 }, 5003 .op_flags = XTENSA_OP_PRIVILEGED, 5004 }, { 5005 .name = "wsr.excsave6", 5006 .translate = translate_wsr, 5007 .test_exceptions = test_exceptions_hpi, 5008 .par = (const uint32_t[]){ 5009 EXCSAVE1 + 5, 5010 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5011 }, 5012 .op_flags = XTENSA_OP_PRIVILEGED, 5013 }, { 5014 .name = "wsr.excsave7", 5015 .translate = translate_wsr, 5016 .test_exceptions = test_exceptions_hpi, 5017 .par = (const uint32_t[]){ 5018 EXCSAVE1 + 6, 5019 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5020 }, 5021 .op_flags = XTENSA_OP_PRIVILEGED, 5022 }, { 5023 .name = "wsr.excvaddr", 5024 .translate = translate_wsr, 5025 .test_exceptions = test_exceptions_sr, 5026 .par = (const uint32_t[]){ 5027 EXCVADDR, 5028 XTENSA_OPTION_EXCEPTION, 5029 }, 5030 .op_flags = XTENSA_OP_PRIVILEGED, 5031 }, { 5032 .name = "wsr.ibreaka0", 5033 .translate = translate_wsr_ibreaka, 5034 .test_exceptions = test_exceptions_ibreak, 5035 .par = (const uint32_t[]){ 5036 IBREAKA, 5037 XTENSA_OPTION_DEBUG, 5038 }, 5039 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 5040 }, { 5041 .name = "wsr.ibreaka1", 5042 .translate = translate_wsr_ibreaka, 5043 .test_exceptions = test_exceptions_ibreak, 5044 .par = (const uint32_t[]){ 5045 IBREAKA + 1, 5046 XTENSA_OPTION_DEBUG, 5047 }, 5048 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 5049 }, { 5050 .name = "wsr.ibreakenable", 5051 .translate = translate_wsr_ibreakenable, 5052 .test_exceptions = test_exceptions_sr, 5053 .par = (const uint32_t[]){ 5054 IBREAKENABLE, 5055 XTENSA_OPTION_DEBUG, 5056 }, 5057 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 5058 }, { 5059 .name = "wsr.icount", 5060 .translate = translate_wsr_icount, 5061 .test_exceptions = test_exceptions_sr, 5062 .par = (const uint32_t[]){ 5063 ICOUNT, 5064 XTENSA_OPTION_DEBUG, 5065 }, 5066 .op_flags = XTENSA_OP_PRIVILEGED, 5067 }, { 5068 .name = "wsr.icountlevel", 5069 .translate = translate_wsr_mask, 5070 .test_exceptions = test_exceptions_sr, 5071 .par = (const uint32_t[]){ 5072 ICOUNTLEVEL, 5073 XTENSA_OPTION_DEBUG, 5074 0xf, 5075 }, 5076 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_M1, 5077 }, { 5078 .name = "wsr.intclear", 5079 .translate = translate_wsr_intclear, 5080 .test_exceptions = test_exceptions_sr, 5081 .par = (const uint32_t[]){ 5082 INTCLEAR, 5083 XTENSA_OPTION_INTERRUPT, 5084 }, 5085 .op_flags = 5086 XTENSA_OP_PRIVILEGED | 5087 XTENSA_OP_EXIT_TB_0 | 5088 XTENSA_OP_CHECK_INTERRUPTS, 5089 }, { 5090 .name = "wsr.intenable", 5091 .translate = translate_wsr, 5092 .test_exceptions = test_exceptions_sr, 5093 .par = (const uint32_t[]){ 5094 INTENABLE, 5095 XTENSA_OPTION_INTERRUPT, 5096 }, 5097 .op_flags = 5098 XTENSA_OP_PRIVILEGED | 5099 XTENSA_OP_EXIT_TB_0 | 5100 XTENSA_OP_CHECK_INTERRUPTS, 5101 }, { 5102 .name = "wsr.interrupt", 5103 .translate = translate_wsr, 5104 .test_exceptions = test_exceptions_sr, 5105 .par = (const uint32_t[]){ 5106 INTSET, 5107 XTENSA_OPTION_INTERRUPT, 5108 }, 5109 .op_flags = 5110 XTENSA_OP_PRIVILEGED | 5111 XTENSA_OP_EXIT_TB_0 | 5112 XTENSA_OP_CHECK_INTERRUPTS, 5113 }, { 5114 .name = "wsr.intset", 5115 .translate = translate_wsr_intset, 5116 .test_exceptions = test_exceptions_sr, 5117 .par = (const uint32_t[]){ 5118 INTSET, 5119 XTENSA_OPTION_INTERRUPT, 5120 }, 5121 .op_flags = 5122 XTENSA_OP_PRIVILEGED | 5123 XTENSA_OP_EXIT_TB_0 | 5124 XTENSA_OP_CHECK_INTERRUPTS, 5125 }, { 5126 .name = "wsr.itlbcfg", 5127 .translate = translate_wsr_mask, 5128 .test_exceptions = test_exceptions_sr, 5129 .par = (const uint32_t[]){ 5130 ITLBCFG, 5131 XTENSA_OPTION_MMU, 5132 0x01130000, 5133 }, 5134 .op_flags = XTENSA_OP_PRIVILEGED, 5135 }, { 5136 .name = "wsr.lbeg", 5137 .translate = translate_wsr, 5138 .test_exceptions = test_exceptions_sr, 5139 .par = (const uint32_t[]){ 5140 LBEG, 5141 XTENSA_OPTION_LOOP, 5142 }, 5143 .op_flags = XTENSA_OP_EXIT_TB_M1, 5144 }, { 5145 .name = "wsr.lcount", 5146 .translate = translate_wsr, 5147 .test_exceptions = test_exceptions_sr, 5148 .par = (const uint32_t[]){ 5149 LCOUNT, 5150 XTENSA_OPTION_LOOP, 5151 }, 5152 }, { 5153 .name = "wsr.lend", 5154 .translate = translate_wsr, 5155 .test_exceptions = test_exceptions_sr, 5156 .par = (const uint32_t[]){ 5157 LEND, 5158 XTENSA_OPTION_LOOP, 5159 }, 5160 .op_flags = XTENSA_OP_EXIT_TB_M1, 5161 }, { 5162 .name = "wsr.litbase", 5163 .translate = translate_wsr_mask, 5164 .test_exceptions = test_exceptions_sr, 5165 .par = (const uint32_t[]){ 5166 LITBASE, 5167 XTENSA_OPTION_EXTENDED_L32R, 5168 0xfffff001, 5169 }, 5170 .op_flags = XTENSA_OP_EXIT_TB_M1, 5171 }, { 5172 .name = "wsr.m0", 5173 .translate = translate_wsr, 5174 .test_exceptions = test_exceptions_sr, 5175 .par = (const uint32_t[]){ 5176 MR, 5177 XTENSA_OPTION_MAC16, 5178 }, 5179 }, { 5180 .name = "wsr.m1", 5181 .translate = translate_wsr, 5182 .test_exceptions = test_exceptions_sr, 5183 .par = (const uint32_t[]){ 5184 MR + 1, 5185 XTENSA_OPTION_MAC16, 5186 }, 5187 }, { 5188 .name = "wsr.m2", 5189 .translate = translate_wsr, 5190 .test_exceptions = test_exceptions_sr, 5191 .par = (const uint32_t[]){ 5192 MR + 2, 5193 XTENSA_OPTION_MAC16, 5194 }, 5195 }, { 5196 .name = "wsr.m3", 5197 .translate = translate_wsr, 5198 .test_exceptions = test_exceptions_sr, 5199 .par = (const uint32_t[]){ 5200 MR + 3, 5201 XTENSA_OPTION_MAC16, 5202 }, 5203 }, { 5204 .name = "wsr.memctl", 5205 .translate = translate_wsr_memctl, 5206 .par = (const uint32_t[]){MEMCTL}, 5207 .op_flags = XTENSA_OP_PRIVILEGED, 5208 }, { 5209 .name = "wsr.mecr", 5210 .translate = translate_wsr, 5211 .test_exceptions = test_exceptions_sr, 5212 .par = (const uint32_t[]){ 5213 MECR, 5214 XTENSA_OPTION_MEMORY_ECC_PARITY, 5215 }, 5216 .op_flags = XTENSA_OP_PRIVILEGED, 5217 }, { 5218 .name = "wsr.mepc", 5219 .translate = translate_wsr, 5220 .test_exceptions = test_exceptions_sr, 5221 .par = (const uint32_t[]){ 5222 MEPC, 5223 XTENSA_OPTION_MEMORY_ECC_PARITY, 5224 }, 5225 .op_flags = XTENSA_OP_PRIVILEGED, 5226 }, { 5227 .name = "wsr.meps", 5228 .translate = translate_wsr, 5229 .test_exceptions = test_exceptions_sr, 5230 .par = (const uint32_t[]){ 5231 MEPS, 5232 XTENSA_OPTION_MEMORY_ECC_PARITY, 5233 }, 5234 .op_flags = XTENSA_OP_PRIVILEGED, 5235 }, { 5236 .name = "wsr.mesave", 5237 .translate = translate_wsr, 5238 .test_exceptions = test_exceptions_sr, 5239 .par = (const uint32_t[]){ 5240 MESAVE, 5241 XTENSA_OPTION_MEMORY_ECC_PARITY, 5242 }, 5243 .op_flags = XTENSA_OP_PRIVILEGED, 5244 }, { 5245 .name = "wsr.mesr", 5246 .translate = translate_wsr, 5247 .test_exceptions = test_exceptions_sr, 5248 .par = (const uint32_t[]){ 5249 MESR, 5250 XTENSA_OPTION_MEMORY_ECC_PARITY, 5251 }, 5252 .op_flags = XTENSA_OP_PRIVILEGED, 5253 }, { 5254 .name = "wsr.mevaddr", 5255 .translate = translate_wsr, 5256 .test_exceptions = test_exceptions_sr, 5257 .par = (const uint32_t[]){ 5258 MESR, 5259 XTENSA_OPTION_MEMORY_ECC_PARITY, 5260 }, 5261 .op_flags = XTENSA_OP_PRIVILEGED, 5262 }, { 5263 .name = "wsr.misc0", 5264 .translate = translate_wsr, 5265 .test_exceptions = test_exceptions_sr, 5266 .par = (const uint32_t[]){ 5267 MISC, 5268 XTENSA_OPTION_MISC_SR, 5269 }, 5270 .op_flags = XTENSA_OP_PRIVILEGED, 5271 }, { 5272 .name = "wsr.misc1", 5273 .translate = translate_wsr, 5274 .test_exceptions = test_exceptions_sr, 5275 .par = (const uint32_t[]){ 5276 MISC + 1, 5277 XTENSA_OPTION_MISC_SR, 5278 }, 5279 .op_flags = XTENSA_OP_PRIVILEGED, 5280 }, { 5281 .name = "wsr.misc2", 5282 .translate = translate_wsr, 5283 .test_exceptions = test_exceptions_sr, 5284 .par = (const uint32_t[]){ 5285 MISC + 2, 5286 XTENSA_OPTION_MISC_SR, 5287 }, 5288 .op_flags = XTENSA_OP_PRIVILEGED, 5289 }, { 5290 .name = "wsr.misc3", 5291 .translate = translate_wsr, 5292 .test_exceptions = test_exceptions_sr, 5293 .par = (const uint32_t[]){ 5294 MISC + 3, 5295 XTENSA_OPTION_MISC_SR, 5296 }, 5297 .op_flags = XTENSA_OP_PRIVILEGED, 5298 }, { 5299 .name = "wsr.mmid", 5300 .translate = translate_wsr, 5301 .test_exceptions = test_exceptions_sr, 5302 .par = (const uint32_t[]){ 5303 MMID, 5304 XTENSA_OPTION_TRACE_PORT, 5305 }, 5306 .op_flags = XTENSA_OP_PRIVILEGED, 5307 }, { 5308 .name = "wsr.mpuenb", 5309 .translate = translate_wsr_mpuenb, 5310 .test_exceptions = test_exceptions_sr, 5311 .par = (const uint32_t[]){ 5312 MPUENB, 5313 XTENSA_OPTION_MPU, 5314 }, 5315 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_M1, 5316 }, { 5317 .name = "wsr.prefctl", 5318 .translate = translate_wsr, 5319 .par = (const uint32_t[]){PREFCTL}, 5320 }, { 5321 .name = "wsr.prid", 5322 .op_flags = XTENSA_OP_ILL, 5323 }, { 5324 .name = "wsr.ps", 5325 .translate = translate_wsr_ps, 5326 .test_exceptions = test_exceptions_sr, 5327 .par = (const uint32_t[]){ 5328 PS, 5329 XTENSA_OPTION_EXCEPTION, 5330 }, 5331 .op_flags = 5332 XTENSA_OP_PRIVILEGED | 5333 XTENSA_OP_EXIT_TB_M1 | 5334 XTENSA_OP_CHECK_INTERRUPTS, 5335 }, { 5336 .name = "wsr.ptevaddr", 5337 .translate = translate_wsr_mask, 5338 .test_exceptions = test_exceptions_sr, 5339 .par = (const uint32_t[]){ 5340 PTEVADDR, 5341 XTENSA_OPTION_MMU, 5342 0xffc00000, 5343 }, 5344 .op_flags = XTENSA_OP_PRIVILEGED, 5345 }, { 5346 .name = "wsr.rasid", 5347 .translate = translate_wsr_rasid, 5348 .test_exceptions = test_exceptions_sr, 5349 .par = (const uint32_t[]){ 5350 RASID, 5351 XTENSA_OPTION_MMU, 5352 }, 5353 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_M1, 5354 }, { 5355 .name = "wsr.sar", 5356 .translate = translate_wsr_sar, 5357 .par = (const uint32_t[]){SAR}, 5358 }, { 5359 .name = "wsr.scompare1", 5360 .translate = translate_wsr, 5361 .test_exceptions = test_exceptions_sr, 5362 .par = (const uint32_t[]){ 5363 SCOMPARE1, 5364 XTENSA_OPTION_CONDITIONAL_STORE, 5365 }, 5366 }, { 5367 .name = "wsr.vecbase", 5368 .translate = translate_wsr, 5369 .test_exceptions = test_exceptions_sr, 5370 .par = (const uint32_t[]){ 5371 VECBASE, 5372 XTENSA_OPTION_RELOCATABLE_VECTOR, 5373 }, 5374 .op_flags = XTENSA_OP_PRIVILEGED, 5375 }, { 5376 .name = "wsr.windowbase", 5377 .translate = translate_wsr_windowbase, 5378 .test_exceptions = test_exceptions_sr, 5379 .par = (const uint32_t[]){ 5380 WINDOW_BASE, 5381 XTENSA_OPTION_WINDOWED_REGISTER, 5382 }, 5383 .op_flags = XTENSA_OP_PRIVILEGED | 5384 XTENSA_OP_EXIT_TB_M1 | 5385 XTENSA_OP_SYNC_REGISTER_WINDOW, 5386 }, { 5387 .name = "wsr.windowstart", 5388 .translate = translate_wsr_windowstart, 5389 .test_exceptions = test_exceptions_sr, 5390 .par = (const uint32_t[]){ 5391 WINDOW_START, 5392 XTENSA_OPTION_WINDOWED_REGISTER, 5393 }, 5394 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_M1, 5395 }, { 5396 .name = "wur.expstate", 5397 .translate = translate_wur, 5398 .par = (const uint32_t[]){EXPSTATE}, 5399 }, { 5400 .name = "wur.threadptr", 5401 .translate = translate_wur, 5402 .par = (const uint32_t[]){THREADPTR}, 5403 }, { 5404 .name = "xor", 5405 .translate = translate_xor, 5406 }, { 5407 .name = "xorb", 5408 .translate = translate_boolean, 5409 .par = (const uint32_t[]){BOOLEAN_XOR}, 5410 }, { 5411 .name = "xsr.176", 5412 .op_flags = XTENSA_OP_ILL, 5413 }, { 5414 .name = "xsr.208", 5415 .op_flags = XTENSA_OP_ILL, 5416 }, { 5417 .name = "xsr.acchi", 5418 .translate = translate_xsr_acchi, 5419 .test_exceptions = test_exceptions_sr, 5420 .par = (const uint32_t[]){ 5421 ACCHI, 5422 XTENSA_OPTION_MAC16, 5423 }, 5424 }, { 5425 .name = "xsr.acclo", 5426 .translate = translate_xsr, 5427 .test_exceptions = test_exceptions_sr, 5428 .par = (const uint32_t[]){ 5429 ACCLO, 5430 XTENSA_OPTION_MAC16, 5431 }, 5432 }, { 5433 .name = "xsr.atomctl", 5434 .translate = translate_xsr_mask, 5435 .test_exceptions = test_exceptions_sr, 5436 .par = (const uint32_t[]){ 5437 ATOMCTL, 5438 XTENSA_OPTION_ATOMCTL, 5439 0x3f, 5440 }, 5441 .op_flags = XTENSA_OP_PRIVILEGED, 5442 }, { 5443 .name = "xsr.br", 5444 .translate = translate_xsr_mask, 5445 .test_exceptions = test_exceptions_sr, 5446 .par = (const uint32_t[]){ 5447 BR, 5448 XTENSA_OPTION_BOOLEAN, 5449 0xffff, 5450 }, 5451 }, { 5452 .name = "xsr.cacheadrdis", 5453 .translate = translate_xsr_mask, 5454 .test_exceptions = test_exceptions_sr, 5455 .par = (const uint32_t[]){ 5456 CACHEADRDIS, 5457 XTENSA_OPTION_MPU, 5458 0xff, 5459 }, 5460 .op_flags = XTENSA_OP_PRIVILEGED, 5461 }, { 5462 .name = "xsr.cacheattr", 5463 .translate = translate_xsr, 5464 .test_exceptions = test_exceptions_sr, 5465 .par = (const uint32_t[]){ 5466 CACHEATTR, 5467 XTENSA_OPTION_CACHEATTR, 5468 }, 5469 .op_flags = XTENSA_OP_PRIVILEGED, 5470 }, { 5471 .name = "xsr.ccompare0", 5472 .translate = translate_xsr_ccompare, 5473 .test_exceptions = test_exceptions_ccompare, 5474 .par = (const uint32_t[]){ 5475 CCOMPARE, 5476 XTENSA_OPTION_TIMER_INTERRUPT, 5477 }, 5478 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 5479 }, { 5480 .name = "xsr.ccompare1", 5481 .translate = translate_xsr_ccompare, 5482 .test_exceptions = test_exceptions_ccompare, 5483 .par = (const uint32_t[]){ 5484 CCOMPARE + 1, 5485 XTENSA_OPTION_TIMER_INTERRUPT, 5486 }, 5487 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 5488 }, { 5489 .name = "xsr.ccompare2", 5490 .translate = translate_xsr_ccompare, 5491 .test_exceptions = test_exceptions_ccompare, 5492 .par = (const uint32_t[]){ 5493 CCOMPARE + 2, 5494 XTENSA_OPTION_TIMER_INTERRUPT, 5495 }, 5496 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 5497 }, { 5498 .name = "xsr.ccount", 5499 .translate = translate_xsr_ccount, 5500 .test_exceptions = test_exceptions_sr, 5501 .par = (const uint32_t[]){ 5502 CCOUNT, 5503 XTENSA_OPTION_TIMER_INTERRUPT, 5504 }, 5505 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 5506 }, { 5507 .name = "xsr.configid0", 5508 .op_flags = XTENSA_OP_ILL, 5509 }, { 5510 .name = "xsr.configid1", 5511 .op_flags = XTENSA_OP_ILL, 5512 }, { 5513 .name = "xsr.cpenable", 5514 .translate = translate_xsr_mask, 5515 .test_exceptions = test_exceptions_sr, 5516 .par = (const uint32_t[]){ 5517 CPENABLE, 5518 XTENSA_OPTION_COPROCESSOR, 5519 0xff, 5520 }, 5521 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_M1, 5522 }, { 5523 .name = "xsr.dbreaka0", 5524 .translate = translate_xsr_dbreaka, 5525 .test_exceptions = test_exceptions_dbreak, 5526 .par = (const uint32_t[]){ 5527 DBREAKA, 5528 XTENSA_OPTION_DEBUG, 5529 }, 5530 .op_flags = XTENSA_OP_PRIVILEGED, 5531 }, { 5532 .name = "xsr.dbreaka1", 5533 .translate = translate_xsr_dbreaka, 5534 .test_exceptions = test_exceptions_dbreak, 5535 .par = (const uint32_t[]){ 5536 DBREAKA + 1, 5537 XTENSA_OPTION_DEBUG, 5538 }, 5539 .op_flags = XTENSA_OP_PRIVILEGED, 5540 }, { 5541 .name = "xsr.dbreakc0", 5542 .translate = translate_xsr_dbreakc, 5543 .test_exceptions = test_exceptions_dbreak, 5544 .par = (const uint32_t[]){ 5545 DBREAKC, 5546 XTENSA_OPTION_DEBUG, 5547 }, 5548 .op_flags = XTENSA_OP_PRIVILEGED, 5549 }, { 5550 .name = "xsr.dbreakc1", 5551 .translate = translate_xsr_dbreakc, 5552 .test_exceptions = test_exceptions_dbreak, 5553 .par = (const uint32_t[]){ 5554 DBREAKC + 1, 5555 XTENSA_OPTION_DEBUG, 5556 }, 5557 .op_flags = XTENSA_OP_PRIVILEGED, 5558 }, { 5559 .name = "xsr.ddr", 5560 .translate = translate_xsr, 5561 .test_exceptions = test_exceptions_sr, 5562 .par = (const uint32_t[]){ 5563 DDR, 5564 XTENSA_OPTION_DEBUG, 5565 }, 5566 .op_flags = XTENSA_OP_PRIVILEGED, 5567 }, { 5568 .name = "xsr.debugcause", 5569 .op_flags = XTENSA_OP_ILL, 5570 }, { 5571 .name = "xsr.depc", 5572 .translate = translate_xsr, 5573 .test_exceptions = test_exceptions_sr, 5574 .par = (const uint32_t[]){ 5575 DEPC, 5576 XTENSA_OPTION_EXCEPTION, 5577 }, 5578 .op_flags = XTENSA_OP_PRIVILEGED, 5579 }, { 5580 .name = "xsr.dtlbcfg", 5581 .translate = translate_xsr_mask, 5582 .test_exceptions = test_exceptions_sr, 5583 .par = (const uint32_t[]){ 5584 DTLBCFG, 5585 XTENSA_OPTION_MMU, 5586 0x01130000, 5587 }, 5588 .op_flags = XTENSA_OP_PRIVILEGED, 5589 }, { 5590 .name = "xsr.epc1", 5591 .translate = translate_xsr, 5592 .test_exceptions = test_exceptions_sr, 5593 .par = (const uint32_t[]){ 5594 EPC1, 5595 XTENSA_OPTION_EXCEPTION, 5596 }, 5597 .op_flags = XTENSA_OP_PRIVILEGED, 5598 }, { 5599 .name = "xsr.epc2", 5600 .translate = translate_xsr, 5601 .test_exceptions = test_exceptions_hpi, 5602 .par = (const uint32_t[]){ 5603 EPC1 + 1, 5604 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5605 }, 5606 .op_flags = XTENSA_OP_PRIVILEGED, 5607 }, { 5608 .name = "xsr.epc3", 5609 .translate = translate_xsr, 5610 .test_exceptions = test_exceptions_hpi, 5611 .par = (const uint32_t[]){ 5612 EPC1 + 2, 5613 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5614 }, 5615 .op_flags = XTENSA_OP_PRIVILEGED, 5616 }, { 5617 .name = "xsr.epc4", 5618 .translate = translate_xsr, 5619 .test_exceptions = test_exceptions_hpi, 5620 .par = (const uint32_t[]){ 5621 EPC1 + 3, 5622 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5623 }, 5624 .op_flags = XTENSA_OP_PRIVILEGED, 5625 }, { 5626 .name = "xsr.epc5", 5627 .translate = translate_xsr, 5628 .test_exceptions = test_exceptions_hpi, 5629 .par = (const uint32_t[]){ 5630 EPC1 + 4, 5631 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5632 }, 5633 .op_flags = XTENSA_OP_PRIVILEGED, 5634 }, { 5635 .name = "xsr.epc6", 5636 .translate = translate_xsr, 5637 .test_exceptions = test_exceptions_hpi, 5638 .par = (const uint32_t[]){ 5639 EPC1 + 5, 5640 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5641 }, 5642 .op_flags = XTENSA_OP_PRIVILEGED, 5643 }, { 5644 .name = "xsr.epc7", 5645 .translate = translate_xsr, 5646 .test_exceptions = test_exceptions_hpi, 5647 .par = (const uint32_t[]){ 5648 EPC1 + 6, 5649 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5650 }, 5651 .op_flags = XTENSA_OP_PRIVILEGED, 5652 }, { 5653 .name = "xsr.eps2", 5654 .translate = translate_xsr, 5655 .test_exceptions = test_exceptions_hpi, 5656 .par = (const uint32_t[]){ 5657 EPS2, 5658 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5659 }, 5660 .op_flags = XTENSA_OP_PRIVILEGED, 5661 }, { 5662 .name = "xsr.eps3", 5663 .translate = translate_xsr, 5664 .test_exceptions = test_exceptions_hpi, 5665 .par = (const uint32_t[]){ 5666 EPS2 + 1, 5667 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5668 }, 5669 .op_flags = XTENSA_OP_PRIVILEGED, 5670 }, { 5671 .name = "xsr.eps4", 5672 .translate = translate_xsr, 5673 .test_exceptions = test_exceptions_hpi, 5674 .par = (const uint32_t[]){ 5675 EPS2 + 2, 5676 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5677 }, 5678 .op_flags = XTENSA_OP_PRIVILEGED, 5679 }, { 5680 .name = "xsr.eps5", 5681 .translate = translate_xsr, 5682 .test_exceptions = test_exceptions_hpi, 5683 .par = (const uint32_t[]){ 5684 EPS2 + 3, 5685 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5686 }, 5687 .op_flags = XTENSA_OP_PRIVILEGED, 5688 }, { 5689 .name = "xsr.eps6", 5690 .translate = translate_xsr, 5691 .test_exceptions = test_exceptions_hpi, 5692 .par = (const uint32_t[]){ 5693 EPS2 + 4, 5694 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5695 }, 5696 .op_flags = XTENSA_OP_PRIVILEGED, 5697 }, { 5698 .name = "xsr.eps7", 5699 .translate = translate_xsr, 5700 .test_exceptions = test_exceptions_hpi, 5701 .par = (const uint32_t[]){ 5702 EPS2 + 5, 5703 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5704 }, 5705 .op_flags = XTENSA_OP_PRIVILEGED, 5706 }, { 5707 .name = "xsr.eraccess", 5708 .translate = translate_xsr_mask, 5709 .par = (const uint32_t[]){ 5710 ERACCESS, 5711 0, 5712 0xffff, 5713 }, 5714 .op_flags = XTENSA_OP_PRIVILEGED, 5715 }, { 5716 .name = "xsr.exccause", 5717 .translate = translate_xsr, 5718 .test_exceptions = test_exceptions_sr, 5719 .par = (const uint32_t[]){ 5720 EXCCAUSE, 5721 XTENSA_OPTION_EXCEPTION, 5722 }, 5723 .op_flags = XTENSA_OP_PRIVILEGED, 5724 }, { 5725 .name = "xsr.excsave1", 5726 .translate = translate_xsr, 5727 .test_exceptions = test_exceptions_sr, 5728 .par = (const uint32_t[]){ 5729 EXCSAVE1, 5730 XTENSA_OPTION_EXCEPTION, 5731 }, 5732 .op_flags = XTENSA_OP_PRIVILEGED, 5733 }, { 5734 .name = "xsr.excsave2", 5735 .translate = translate_xsr, 5736 .test_exceptions = test_exceptions_hpi, 5737 .par = (const uint32_t[]){ 5738 EXCSAVE1 + 1, 5739 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5740 }, 5741 .op_flags = XTENSA_OP_PRIVILEGED, 5742 }, { 5743 .name = "xsr.excsave3", 5744 .translate = translate_xsr, 5745 .test_exceptions = test_exceptions_hpi, 5746 .par = (const uint32_t[]){ 5747 EXCSAVE1 + 2, 5748 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5749 }, 5750 .op_flags = XTENSA_OP_PRIVILEGED, 5751 }, { 5752 .name = "xsr.excsave4", 5753 .translate = translate_xsr, 5754 .test_exceptions = test_exceptions_hpi, 5755 .par = (const uint32_t[]){ 5756 EXCSAVE1 + 3, 5757 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5758 }, 5759 .op_flags = XTENSA_OP_PRIVILEGED, 5760 }, { 5761 .name = "xsr.excsave5", 5762 .translate = translate_xsr, 5763 .test_exceptions = test_exceptions_hpi, 5764 .par = (const uint32_t[]){ 5765 EXCSAVE1 + 4, 5766 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5767 }, 5768 .op_flags = XTENSA_OP_PRIVILEGED, 5769 }, { 5770 .name = "xsr.excsave6", 5771 .translate = translate_xsr, 5772 .test_exceptions = test_exceptions_hpi, 5773 .par = (const uint32_t[]){ 5774 EXCSAVE1 + 5, 5775 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5776 }, 5777 .op_flags = XTENSA_OP_PRIVILEGED, 5778 }, { 5779 .name = "xsr.excsave7", 5780 .translate = translate_xsr, 5781 .test_exceptions = test_exceptions_hpi, 5782 .par = (const uint32_t[]){ 5783 EXCSAVE1 + 6, 5784 XTENSA_OPTION_HIGH_PRIORITY_INTERRUPT, 5785 }, 5786 .op_flags = XTENSA_OP_PRIVILEGED, 5787 }, { 5788 .name = "xsr.excvaddr", 5789 .translate = translate_xsr, 5790 .test_exceptions = test_exceptions_sr, 5791 .par = (const uint32_t[]){ 5792 EXCVADDR, 5793 XTENSA_OPTION_EXCEPTION, 5794 }, 5795 .op_flags = XTENSA_OP_PRIVILEGED, 5796 }, { 5797 .name = "xsr.ibreaka0", 5798 .translate = translate_xsr_ibreaka, 5799 .test_exceptions = test_exceptions_ibreak, 5800 .par = (const uint32_t[]){ 5801 IBREAKA, 5802 XTENSA_OPTION_DEBUG, 5803 }, 5804 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 5805 }, { 5806 .name = "xsr.ibreaka1", 5807 .translate = translate_xsr_ibreaka, 5808 .test_exceptions = test_exceptions_ibreak, 5809 .par = (const uint32_t[]){ 5810 IBREAKA + 1, 5811 XTENSA_OPTION_DEBUG, 5812 }, 5813 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 5814 }, { 5815 .name = "xsr.ibreakenable", 5816 .translate = translate_xsr_ibreakenable, 5817 .test_exceptions = test_exceptions_sr, 5818 .par = (const uint32_t[]){ 5819 IBREAKENABLE, 5820 XTENSA_OPTION_DEBUG, 5821 }, 5822 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_0, 5823 }, { 5824 .name = "xsr.icount", 5825 .translate = translate_xsr_icount, 5826 .test_exceptions = test_exceptions_sr, 5827 .par = (const uint32_t[]){ 5828 ICOUNT, 5829 XTENSA_OPTION_DEBUG, 5830 }, 5831 .op_flags = XTENSA_OP_PRIVILEGED, 5832 }, { 5833 .name = "xsr.icountlevel", 5834 .translate = translate_xsr_mask, 5835 .test_exceptions = test_exceptions_sr, 5836 .par = (const uint32_t[]){ 5837 ICOUNTLEVEL, 5838 XTENSA_OPTION_DEBUG, 5839 0xf, 5840 }, 5841 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_M1, 5842 }, { 5843 .name = "xsr.intclear", 5844 .op_flags = XTENSA_OP_ILL, 5845 }, { 5846 .name = "xsr.intenable", 5847 .translate = translate_xsr, 5848 .test_exceptions = test_exceptions_sr, 5849 .par = (const uint32_t[]){ 5850 INTENABLE, 5851 XTENSA_OPTION_INTERRUPT, 5852 }, 5853 .op_flags = 5854 XTENSA_OP_PRIVILEGED | 5855 XTENSA_OP_EXIT_TB_0 | 5856 XTENSA_OP_CHECK_INTERRUPTS, 5857 }, { 5858 .name = "xsr.interrupt", 5859 .op_flags = XTENSA_OP_ILL, 5860 }, { 5861 .name = "xsr.intset", 5862 .op_flags = XTENSA_OP_ILL, 5863 }, { 5864 .name = "xsr.itlbcfg", 5865 .translate = translate_xsr_mask, 5866 .test_exceptions = test_exceptions_sr, 5867 .par = (const uint32_t[]){ 5868 ITLBCFG, 5869 XTENSA_OPTION_MMU, 5870 0x01130000, 5871 }, 5872 .op_flags = XTENSA_OP_PRIVILEGED, 5873 }, { 5874 .name = "xsr.lbeg", 5875 .translate = translate_xsr, 5876 .test_exceptions = test_exceptions_sr, 5877 .par = (const uint32_t[]){ 5878 LBEG, 5879 XTENSA_OPTION_LOOP, 5880 }, 5881 .op_flags = XTENSA_OP_EXIT_TB_M1, 5882 }, { 5883 .name = "xsr.lcount", 5884 .translate = translate_xsr, 5885 .test_exceptions = test_exceptions_sr, 5886 .par = (const uint32_t[]){ 5887 LCOUNT, 5888 XTENSA_OPTION_LOOP, 5889 }, 5890 }, { 5891 .name = "xsr.lend", 5892 .translate = translate_xsr, 5893 .test_exceptions = test_exceptions_sr, 5894 .par = (const uint32_t[]){ 5895 LEND, 5896 XTENSA_OPTION_LOOP, 5897 }, 5898 .op_flags = XTENSA_OP_EXIT_TB_M1, 5899 }, { 5900 .name = "xsr.litbase", 5901 .translate = translate_xsr_mask, 5902 .test_exceptions = test_exceptions_sr, 5903 .par = (const uint32_t[]){ 5904 LITBASE, 5905 XTENSA_OPTION_EXTENDED_L32R, 5906 0xfffff001, 5907 }, 5908 .op_flags = XTENSA_OP_EXIT_TB_M1, 5909 }, { 5910 .name = "xsr.m0", 5911 .translate = translate_xsr, 5912 .test_exceptions = test_exceptions_sr, 5913 .par = (const uint32_t[]){ 5914 MR, 5915 XTENSA_OPTION_MAC16, 5916 }, 5917 }, { 5918 .name = "xsr.m1", 5919 .translate = translate_xsr, 5920 .test_exceptions = test_exceptions_sr, 5921 .par = (const uint32_t[]){ 5922 MR + 1, 5923 XTENSA_OPTION_MAC16, 5924 }, 5925 }, { 5926 .name = "xsr.m2", 5927 .translate = translate_xsr, 5928 .test_exceptions = test_exceptions_sr, 5929 .par = (const uint32_t[]){ 5930 MR + 2, 5931 XTENSA_OPTION_MAC16, 5932 }, 5933 }, { 5934 .name = "xsr.m3", 5935 .translate = translate_xsr, 5936 .test_exceptions = test_exceptions_sr, 5937 .par = (const uint32_t[]){ 5938 MR + 3, 5939 XTENSA_OPTION_MAC16, 5940 }, 5941 }, { 5942 .name = "xsr.memctl", 5943 .translate = translate_xsr_memctl, 5944 .par = (const uint32_t[]){MEMCTL}, 5945 .op_flags = XTENSA_OP_PRIVILEGED, 5946 }, { 5947 .name = "xsr.mecr", 5948 .translate = translate_xsr, 5949 .test_exceptions = test_exceptions_sr, 5950 .par = (const uint32_t[]){ 5951 MECR, 5952 XTENSA_OPTION_MEMORY_ECC_PARITY, 5953 }, 5954 .op_flags = XTENSA_OP_PRIVILEGED, 5955 }, { 5956 .name = "xsr.mepc", 5957 .translate = translate_xsr, 5958 .test_exceptions = test_exceptions_sr, 5959 .par = (const uint32_t[]){ 5960 MEPC, 5961 XTENSA_OPTION_MEMORY_ECC_PARITY, 5962 }, 5963 .op_flags = XTENSA_OP_PRIVILEGED, 5964 }, { 5965 .name = "xsr.meps", 5966 .translate = translate_xsr, 5967 .test_exceptions = test_exceptions_sr, 5968 .par = (const uint32_t[]){ 5969 MEPS, 5970 XTENSA_OPTION_MEMORY_ECC_PARITY, 5971 }, 5972 .op_flags = XTENSA_OP_PRIVILEGED, 5973 }, { 5974 .name = "xsr.mesave", 5975 .translate = translate_xsr, 5976 .test_exceptions = test_exceptions_sr, 5977 .par = (const uint32_t[]){ 5978 MESAVE, 5979 XTENSA_OPTION_MEMORY_ECC_PARITY, 5980 }, 5981 .op_flags = XTENSA_OP_PRIVILEGED, 5982 }, { 5983 .name = "xsr.mesr", 5984 .translate = translate_xsr, 5985 .test_exceptions = test_exceptions_sr, 5986 .par = (const uint32_t[]){ 5987 MESR, 5988 XTENSA_OPTION_MEMORY_ECC_PARITY, 5989 }, 5990 .op_flags = XTENSA_OP_PRIVILEGED, 5991 }, { 5992 .name = "xsr.mevaddr", 5993 .translate = translate_xsr, 5994 .test_exceptions = test_exceptions_sr, 5995 .par = (const uint32_t[]){ 5996 MESR, 5997 XTENSA_OPTION_MEMORY_ECC_PARITY, 5998 }, 5999 .op_flags = XTENSA_OP_PRIVILEGED, 6000 }, { 6001 .name = "xsr.misc0", 6002 .translate = translate_xsr, 6003 .test_exceptions = test_exceptions_sr, 6004 .par = (const uint32_t[]){ 6005 MISC, 6006 XTENSA_OPTION_MISC_SR, 6007 }, 6008 .op_flags = XTENSA_OP_PRIVILEGED, 6009 }, { 6010 .name = "xsr.misc1", 6011 .translate = translate_xsr, 6012 .test_exceptions = test_exceptions_sr, 6013 .par = (const uint32_t[]){ 6014 MISC + 1, 6015 XTENSA_OPTION_MISC_SR, 6016 }, 6017 .op_flags = XTENSA_OP_PRIVILEGED, 6018 }, { 6019 .name = "xsr.misc2", 6020 .translate = translate_xsr, 6021 .test_exceptions = test_exceptions_sr, 6022 .par = (const uint32_t[]){ 6023 MISC + 2, 6024 XTENSA_OPTION_MISC_SR, 6025 }, 6026 .op_flags = XTENSA_OP_PRIVILEGED, 6027 }, { 6028 .name = "xsr.misc3", 6029 .translate = translate_xsr, 6030 .test_exceptions = test_exceptions_sr, 6031 .par = (const uint32_t[]){ 6032 MISC + 3, 6033 XTENSA_OPTION_MISC_SR, 6034 }, 6035 .op_flags = XTENSA_OP_PRIVILEGED, 6036 }, { 6037 .name = "xsr.mpuenb", 6038 .translate = translate_xsr_mpuenb, 6039 .test_exceptions = test_exceptions_sr, 6040 .par = (const uint32_t[]){ 6041 MPUENB, 6042 XTENSA_OPTION_MPU, 6043 }, 6044 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_M1, 6045 }, { 6046 .name = "xsr.prefctl", 6047 .translate = translate_xsr, 6048 .par = (const uint32_t[]){PREFCTL}, 6049 }, { 6050 .name = "xsr.prid", 6051 .op_flags = XTENSA_OP_ILL, 6052 }, { 6053 .name = "xsr.ps", 6054 .translate = translate_xsr_ps, 6055 .test_exceptions = test_exceptions_sr, 6056 .par = (const uint32_t[]){ 6057 PS, 6058 XTENSA_OPTION_EXCEPTION, 6059 }, 6060 .op_flags = 6061 XTENSA_OP_PRIVILEGED | 6062 XTENSA_OP_EXIT_TB_M1 | 6063 XTENSA_OP_CHECK_INTERRUPTS, 6064 }, { 6065 .name = "xsr.ptevaddr", 6066 .translate = translate_xsr_mask, 6067 .test_exceptions = test_exceptions_sr, 6068 .par = (const uint32_t[]){ 6069 PTEVADDR, 6070 XTENSA_OPTION_MMU, 6071 0xffc00000, 6072 }, 6073 .op_flags = XTENSA_OP_PRIVILEGED, 6074 }, { 6075 .name = "xsr.rasid", 6076 .translate = translate_xsr_rasid, 6077 .test_exceptions = test_exceptions_sr, 6078 .par = (const uint32_t[]){ 6079 RASID, 6080 XTENSA_OPTION_MMU, 6081 }, 6082 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_M1, 6083 }, { 6084 .name = "xsr.sar", 6085 .translate = translate_xsr_sar, 6086 .par = (const uint32_t[]){SAR}, 6087 }, { 6088 .name = "xsr.scompare1", 6089 .translate = translate_xsr, 6090 .test_exceptions = test_exceptions_sr, 6091 .par = (const uint32_t[]){ 6092 SCOMPARE1, 6093 XTENSA_OPTION_CONDITIONAL_STORE, 6094 }, 6095 }, { 6096 .name = "xsr.vecbase", 6097 .translate = translate_xsr, 6098 .test_exceptions = test_exceptions_sr, 6099 .par = (const uint32_t[]){ 6100 VECBASE, 6101 XTENSA_OPTION_RELOCATABLE_VECTOR, 6102 }, 6103 .op_flags = XTENSA_OP_PRIVILEGED, 6104 }, { 6105 .name = "xsr.windowbase", 6106 .translate = translate_xsr_windowbase, 6107 .test_exceptions = test_exceptions_sr, 6108 .par = (const uint32_t[]){ 6109 WINDOW_BASE, 6110 XTENSA_OPTION_WINDOWED_REGISTER, 6111 }, 6112 .op_flags = XTENSA_OP_PRIVILEGED | 6113 XTENSA_OP_EXIT_TB_M1 | 6114 XTENSA_OP_SYNC_REGISTER_WINDOW, 6115 }, { 6116 .name = "xsr.windowstart", 6117 .translate = translate_xsr_windowstart, 6118 .test_exceptions = test_exceptions_sr, 6119 .par = (const uint32_t[]){ 6120 WINDOW_START, 6121 XTENSA_OPTION_WINDOWED_REGISTER, 6122 }, 6123 .op_flags = XTENSA_OP_PRIVILEGED | XTENSA_OP_EXIT_TB_M1, 6124 }, 6125 }; 6126 6127 const XtensaOpcodeTranslators xtensa_core_opcodes = { 6128 .num_opcodes = ARRAY_SIZE(core_ops), 6129 .opcode = core_ops, 6130 }; 6131 6132 6133 static inline void get_f32_o1_i3(const OpcodeArg *arg, OpcodeArg *arg32, 6134 int o0, int i0, int i1, int i2) 6135 { 6136 if ((i0 >= 0 && arg[i0].num_bits == 64) || 6137 (o0 >= 0 && arg[o0].num_bits == 64)) { 6138 if (o0 >= 0) { 6139 arg32[o0].out = tcg_temp_new_i32(); 6140 } 6141 if (i0 >= 0) { 6142 arg32[i0].in = tcg_temp_new_i32(); 6143 tcg_gen_extrl_i64_i32(arg32[i0].in, arg[i0].in); 6144 } 6145 if (i1 >= 0) { 6146 arg32[i1].in = tcg_temp_new_i32(); 6147 tcg_gen_extrl_i64_i32(arg32[i1].in, arg[i1].in); 6148 } 6149 if (i2 >= 0) { 6150 arg32[i2].in = tcg_temp_new_i32(); 6151 tcg_gen_extrl_i64_i32(arg32[i2].in, arg[i2].in); 6152 } 6153 } else { 6154 if (o0 >= 0) { 6155 arg32[o0].out = arg[o0].out; 6156 } 6157 if (i0 >= 0) { 6158 arg32[i0].in = arg[i0].in; 6159 } 6160 if (i1 >= 0) { 6161 arg32[i1].in = arg[i1].in; 6162 } 6163 if (i2 >= 0) { 6164 arg32[i2].in = arg[i2].in; 6165 } 6166 } 6167 } 6168 6169 static inline void put_f32_o1_i3(const OpcodeArg *arg, const OpcodeArg *arg32, 6170 int o0, int i0, int i1, int i2) 6171 { 6172 if ((i0 >= 0 && arg[i0].num_bits == 64) || 6173 (o0 >= 0 && arg[o0].num_bits == 64)) { 6174 if (o0 >= 0) { 6175 tcg_gen_extu_i32_i64(arg[o0].out, arg32[o0].out); 6176 } 6177 } 6178 } 6179 6180 static inline void get_f32_o1_i2(const OpcodeArg *arg, OpcodeArg *arg32, 6181 int o0, int i0, int i1) 6182 { 6183 get_f32_o1_i3(arg, arg32, o0, i0, i1, -1); 6184 } 6185 6186 static inline void put_f32_o1_i2(const OpcodeArg *arg, const OpcodeArg *arg32, 6187 int o0, int i0, int i1) 6188 { 6189 put_f32_o1_i3(arg, arg32, o0, i0, i1, -1); 6190 } 6191 6192 static inline void get_f32_o1_i1(const OpcodeArg *arg, OpcodeArg *arg32, 6193 int o0, int i0) 6194 { 6195 get_f32_o1_i2(arg, arg32, o0, i0, -1); 6196 } 6197 6198 static inline void put_f32_o1_i1(const OpcodeArg *arg, const OpcodeArg *arg32, 6199 int o0, int i0) 6200 { 6201 put_f32_o1_i2(arg, arg32, o0, i0, -1); 6202 } 6203 6204 static inline void get_f32_o1(const OpcodeArg *arg, OpcodeArg *arg32, 6205 int o0) 6206 { 6207 get_f32_o1_i1(arg, arg32, o0, -1); 6208 } 6209 6210 static inline void put_f32_o1(const OpcodeArg *arg, const OpcodeArg *arg32, 6211 int o0) 6212 { 6213 put_f32_o1_i1(arg, arg32, o0, -1); 6214 } 6215 6216 static inline void get_f32_i2(const OpcodeArg *arg, OpcodeArg *arg32, 6217 int i0, int i1) 6218 { 6219 get_f32_o1_i2(arg, arg32, -1, i0, i1); 6220 } 6221 6222 static inline void put_f32_i2(const OpcodeArg *arg, const OpcodeArg *arg32, 6223 int i0, int i1) 6224 { 6225 put_f32_o1_i2(arg, arg32, -1, i0, i1); 6226 } 6227 6228 static inline void get_f32_i1(const OpcodeArg *arg, OpcodeArg *arg32, 6229 int i0) 6230 { 6231 get_f32_i2(arg, arg32, i0, -1); 6232 } 6233 6234 static inline void put_f32_i1(const OpcodeArg *arg, const OpcodeArg *arg32, 6235 int i0) 6236 { 6237 put_f32_i2(arg, arg32, i0, -1); 6238 } 6239 6240 6241 static void translate_abs_d(DisasContext *dc, const OpcodeArg arg[], 6242 const uint32_t par[]) 6243 { 6244 gen_helper_abs_d(arg[0].out, arg[1].in); 6245 } 6246 6247 static void translate_abs_s(DisasContext *dc, const OpcodeArg arg[], 6248 const uint32_t par[]) 6249 { 6250 OpcodeArg arg32[2]; 6251 6252 get_f32_o1_i1(arg, arg32, 0, 1); 6253 gen_helper_abs_s(arg32[0].out, arg32[1].in); 6254 put_f32_o1_i1(arg, arg32, 0, 1); 6255 } 6256 6257 static void translate_fpu2k_add_s(DisasContext *dc, const OpcodeArg arg[], 6258 const uint32_t par[]) 6259 { 6260 gen_helper_fpu2k_add_s(arg[0].out, tcg_env, 6261 arg[1].in, arg[2].in); 6262 } 6263 6264 enum { 6265 COMPARE_UN, 6266 COMPARE_OEQ, 6267 COMPARE_UEQ, 6268 COMPARE_OLT, 6269 COMPARE_ULT, 6270 COMPARE_OLE, 6271 COMPARE_ULE, 6272 }; 6273 6274 static void translate_compare_d(DisasContext *dc, const OpcodeArg arg[], 6275 const uint32_t par[]) 6276 { 6277 static void (* const helper[])(TCGv_i32 res, TCGv_env env, 6278 TCGv_i64 s, TCGv_i64 t) = { 6279 [COMPARE_UN] = gen_helper_un_d, 6280 [COMPARE_OEQ] = gen_helper_oeq_d, 6281 [COMPARE_UEQ] = gen_helper_ueq_d, 6282 [COMPARE_OLT] = gen_helper_olt_d, 6283 [COMPARE_ULT] = gen_helper_ult_d, 6284 [COMPARE_OLE] = gen_helper_ole_d, 6285 [COMPARE_ULE] = gen_helper_ule_d, 6286 }; 6287 TCGv_i32 zero = tcg_constant_i32(0); 6288 TCGv_i32 res = tcg_temp_new_i32(); 6289 TCGv_i32 set_br = tcg_temp_new_i32(); 6290 TCGv_i32 clr_br = tcg_temp_new_i32(); 6291 6292 tcg_gen_ori_i32(set_br, arg[0].in, 1 << arg[0].imm); 6293 tcg_gen_andi_i32(clr_br, arg[0].in, ~(1 << arg[0].imm)); 6294 6295 helper[par[0]](res, tcg_env, arg[1].in, arg[2].in); 6296 tcg_gen_movcond_i32(TCG_COND_NE, 6297 arg[0].out, res, zero, 6298 set_br, clr_br); 6299 } 6300 6301 static void translate_compare_s(DisasContext *dc, const OpcodeArg arg[], 6302 const uint32_t par[]) 6303 { 6304 static void (* const helper[])(TCGv_i32 res, TCGv_env env, 6305 TCGv_i32 s, TCGv_i32 t) = { 6306 [COMPARE_UN] = gen_helper_un_s, 6307 [COMPARE_OEQ] = gen_helper_oeq_s, 6308 [COMPARE_UEQ] = gen_helper_ueq_s, 6309 [COMPARE_OLT] = gen_helper_olt_s, 6310 [COMPARE_ULT] = gen_helper_ult_s, 6311 [COMPARE_OLE] = gen_helper_ole_s, 6312 [COMPARE_ULE] = gen_helper_ule_s, 6313 }; 6314 OpcodeArg arg32[3]; 6315 TCGv_i32 zero = tcg_constant_i32(0); 6316 TCGv_i32 res = tcg_temp_new_i32(); 6317 TCGv_i32 set_br = tcg_temp_new_i32(); 6318 TCGv_i32 clr_br = tcg_temp_new_i32(); 6319 6320 tcg_gen_ori_i32(set_br, arg[0].in, 1 << arg[0].imm); 6321 tcg_gen_andi_i32(clr_br, arg[0].in, ~(1 << arg[0].imm)); 6322 6323 get_f32_i2(arg, arg32, 1, 2); 6324 helper[par[0]](res, tcg_env, arg32[1].in, arg32[2].in); 6325 tcg_gen_movcond_i32(TCG_COND_NE, 6326 arg[0].out, res, zero, 6327 set_br, clr_br); 6328 put_f32_i2(arg, arg32, 1, 2); 6329 } 6330 6331 static void translate_const_d(DisasContext *dc, const OpcodeArg arg[], 6332 const uint32_t par[]) 6333 { 6334 static const uint64_t v[] = { 6335 UINT64_C(0x0000000000000000), 6336 UINT64_C(0x3ff0000000000000), 6337 UINT64_C(0x4000000000000000), 6338 UINT64_C(0x3fe0000000000000), 6339 }; 6340 6341 tcg_gen_movi_i64(arg[0].out, v[arg[1].imm % ARRAY_SIZE(v)]); 6342 if (arg[1].imm >= ARRAY_SIZE(v)) { 6343 qemu_log_mask(LOG_GUEST_ERROR, 6344 "const.d f%d, #%d, immediate value is reserved\n", 6345 arg[0].imm, arg[1].imm); 6346 } 6347 } 6348 6349 static void translate_const_s(DisasContext *dc, const OpcodeArg arg[], 6350 const uint32_t par[]) 6351 { 6352 static const uint32_t v[] = { 6353 0x00000000, 6354 0x3f800000, 6355 0x40000000, 6356 0x3f000000, 6357 }; 6358 6359 if (arg[0].num_bits == 32) { 6360 tcg_gen_movi_i32(arg[0].out, v[arg[1].imm % ARRAY_SIZE(v)]); 6361 } else { 6362 tcg_gen_movi_i64(arg[0].out, v[arg[1].imm % ARRAY_SIZE(v)]); 6363 } 6364 if (arg[1].imm >= ARRAY_SIZE(v)) { 6365 qemu_log_mask(LOG_GUEST_ERROR, 6366 "const.s f%d, #%d, immediate value is reserved\n", 6367 arg[0].imm, arg[1].imm); 6368 } 6369 } 6370 6371 static void translate_float_d(DisasContext *dc, const OpcodeArg arg[], 6372 const uint32_t par[]) 6373 { 6374 TCGv_i32 scale = tcg_constant_i32(-arg[2].imm); 6375 6376 if (par[0]) { 6377 gen_helper_uitof_d(arg[0].out, tcg_env, arg[1].in, scale); 6378 } else { 6379 gen_helper_itof_d(arg[0].out, tcg_env, arg[1].in, scale); 6380 } 6381 } 6382 6383 static void translate_float_s(DisasContext *dc, const OpcodeArg arg[], 6384 const uint32_t par[]) 6385 { 6386 TCGv_i32 scale = tcg_constant_i32(-arg[2].imm); 6387 OpcodeArg arg32[1]; 6388 6389 get_f32_o1(arg, arg32, 0); 6390 if (par[0]) { 6391 gen_helper_uitof_s(arg32[0].out, tcg_env, arg[1].in, scale); 6392 } else { 6393 gen_helper_itof_s(arg32[0].out, tcg_env, arg[1].in, scale); 6394 } 6395 put_f32_o1(arg, arg32, 0); 6396 } 6397 6398 static void translate_ftoi_d(DisasContext *dc, const OpcodeArg arg[], 6399 const uint32_t par[]) 6400 { 6401 TCGv_i32 rounding_mode = tcg_constant_i32(par[0]); 6402 TCGv_i32 scale = tcg_constant_i32(arg[2].imm); 6403 6404 if (par[1]) { 6405 gen_helper_ftoui_d(arg[0].out, tcg_env, arg[1].in, 6406 rounding_mode, scale); 6407 } else { 6408 gen_helper_ftoi_d(arg[0].out, tcg_env, arg[1].in, 6409 rounding_mode, scale); 6410 } 6411 } 6412 6413 static void translate_ftoi_s(DisasContext *dc, const OpcodeArg arg[], 6414 const uint32_t par[]) 6415 { 6416 TCGv_i32 rounding_mode = tcg_constant_i32(par[0]); 6417 TCGv_i32 scale = tcg_constant_i32(arg[2].imm); 6418 OpcodeArg arg32[2]; 6419 6420 get_f32_i1(arg, arg32, 1); 6421 if (par[1]) { 6422 gen_helper_ftoui_s(arg[0].out, tcg_env, arg32[1].in, 6423 rounding_mode, scale); 6424 } else { 6425 gen_helper_ftoi_s(arg[0].out, tcg_env, arg32[1].in, 6426 rounding_mode, scale); 6427 } 6428 put_f32_i1(arg, arg32, 1); 6429 } 6430 6431 static void translate_ldsti(DisasContext *dc, const OpcodeArg arg[], 6432 const uint32_t par[]) 6433 { 6434 TCGv_i32 addr = tcg_temp_new_i32(); 6435 MemOp mop; 6436 6437 tcg_gen_addi_i32(addr, arg[1].in, arg[2].imm); 6438 mop = gen_load_store_alignment(dc, MO_TEUL, addr); 6439 if (par[0]) { 6440 tcg_gen_qemu_st_tl(arg[0].in, addr, dc->cring, mop); 6441 } else { 6442 tcg_gen_qemu_ld_tl(arg[0].out, addr, dc->cring, mop); 6443 } 6444 if (par[1]) { 6445 tcg_gen_mov_i32(arg[1].out, addr); 6446 } 6447 } 6448 6449 static void translate_ldstx(DisasContext *dc, const OpcodeArg arg[], 6450 const uint32_t par[]) 6451 { 6452 TCGv_i32 addr = tcg_temp_new_i32(); 6453 MemOp mop; 6454 6455 tcg_gen_add_i32(addr, arg[1].in, arg[2].in); 6456 mop = gen_load_store_alignment(dc, MO_TEUL, addr); 6457 if (par[0]) { 6458 tcg_gen_qemu_st_tl(arg[0].in, addr, dc->cring, mop); 6459 } else { 6460 tcg_gen_qemu_ld_tl(arg[0].out, addr, dc->cring, mop); 6461 } 6462 if (par[1]) { 6463 tcg_gen_mov_i32(arg[1].out, addr); 6464 } 6465 } 6466 6467 static void translate_fpu2k_madd_s(DisasContext *dc, const OpcodeArg arg[], 6468 const uint32_t par[]) 6469 { 6470 gen_helper_fpu2k_madd_s(arg[0].out, tcg_env, 6471 arg[0].in, arg[1].in, arg[2].in); 6472 } 6473 6474 static void translate_mov_d(DisasContext *dc, const OpcodeArg arg[], 6475 const uint32_t par[]) 6476 { 6477 tcg_gen_mov_i64(arg[0].out, arg[1].in); 6478 } 6479 6480 static void translate_mov_s(DisasContext *dc, const OpcodeArg arg[], 6481 const uint32_t par[]) 6482 { 6483 if (arg[0].num_bits == 32) { 6484 tcg_gen_mov_i32(arg[0].out, arg[1].in); 6485 } else { 6486 tcg_gen_mov_i64(arg[0].out, arg[1].in); 6487 } 6488 } 6489 6490 static void translate_movcond_d(DisasContext *dc, const OpcodeArg arg[], 6491 const uint32_t par[]) 6492 { 6493 TCGv_i64 zero = tcg_constant_i64(0); 6494 TCGv_i64 arg2 = tcg_temp_new_i64(); 6495 6496 tcg_gen_ext_i32_i64(arg2, arg[2].in); 6497 tcg_gen_movcond_i64(par[0], arg[0].out, 6498 arg2, zero, 6499 arg[1].in, arg[0].in); 6500 } 6501 6502 static void translate_movcond_s(DisasContext *dc, const OpcodeArg arg[], 6503 const uint32_t par[]) 6504 { 6505 if (arg[0].num_bits == 32) { 6506 TCGv_i32 zero = tcg_constant_i32(0); 6507 6508 tcg_gen_movcond_i32(par[0], arg[0].out, 6509 arg[2].in, zero, 6510 arg[1].in, arg[0].in); 6511 } else { 6512 translate_movcond_d(dc, arg, par); 6513 } 6514 } 6515 6516 static void translate_movp_d(DisasContext *dc, const OpcodeArg arg[], 6517 const uint32_t par[]) 6518 { 6519 TCGv_i64 zero = tcg_constant_i64(0); 6520 TCGv_i32 tmp1 = tcg_temp_new_i32(); 6521 TCGv_i64 tmp2 = tcg_temp_new_i64(); 6522 6523 tcg_gen_andi_i32(tmp1, arg[2].in, 1 << arg[2].imm); 6524 tcg_gen_extu_i32_i64(tmp2, tmp1); 6525 tcg_gen_movcond_i64(par[0], 6526 arg[0].out, tmp2, zero, 6527 arg[1].in, arg[0].in); 6528 } 6529 6530 static void translate_movp_s(DisasContext *dc, const OpcodeArg arg[], 6531 const uint32_t par[]) 6532 { 6533 if (arg[0].num_bits == 32) { 6534 TCGv_i32 zero = tcg_constant_i32(0); 6535 TCGv_i32 tmp = tcg_temp_new_i32(); 6536 6537 tcg_gen_andi_i32(tmp, arg[2].in, 1 << arg[2].imm); 6538 tcg_gen_movcond_i32(par[0], 6539 arg[0].out, tmp, zero, 6540 arg[1].in, arg[0].in); 6541 } else { 6542 translate_movp_d(dc, arg, par); 6543 } 6544 } 6545 6546 static void translate_fpu2k_mul_s(DisasContext *dc, const OpcodeArg arg[], 6547 const uint32_t par[]) 6548 { 6549 gen_helper_fpu2k_mul_s(arg[0].out, tcg_env, 6550 arg[1].in, arg[2].in); 6551 } 6552 6553 static void translate_fpu2k_msub_s(DisasContext *dc, const OpcodeArg arg[], 6554 const uint32_t par[]) 6555 { 6556 gen_helper_fpu2k_msub_s(arg[0].out, tcg_env, 6557 arg[0].in, arg[1].in, arg[2].in); 6558 } 6559 6560 static void translate_neg_d(DisasContext *dc, const OpcodeArg arg[], 6561 const uint32_t par[]) 6562 { 6563 gen_helper_neg_d(arg[0].out, arg[1].in); 6564 } 6565 6566 static void translate_neg_s(DisasContext *dc, const OpcodeArg arg[], 6567 const uint32_t par[]) 6568 { 6569 OpcodeArg arg32[2]; 6570 6571 get_f32_o1_i1(arg, arg32, 0, 1); 6572 gen_helper_neg_s(arg32[0].out, arg32[1].in); 6573 put_f32_o1_i1(arg, arg32, 0, 1); 6574 } 6575 6576 static void translate_rfr_d(DisasContext *dc, const OpcodeArg arg[], 6577 const uint32_t par[]) 6578 { 6579 tcg_gen_extrh_i64_i32(arg[0].out, arg[1].in); 6580 } 6581 6582 static void translate_rfr_s(DisasContext *dc, const OpcodeArg arg[], 6583 const uint32_t par[]) 6584 { 6585 if (arg[1].num_bits == 32) { 6586 tcg_gen_mov_i32(arg[0].out, arg[1].in); 6587 } else { 6588 tcg_gen_extrl_i64_i32(arg[0].out, arg[1].in); 6589 } 6590 } 6591 6592 static void translate_fpu2k_sub_s(DisasContext *dc, const OpcodeArg arg[], 6593 const uint32_t par[]) 6594 { 6595 gen_helper_fpu2k_sub_s(arg[0].out, tcg_env, 6596 arg[1].in, arg[2].in); 6597 } 6598 6599 static void translate_wfr_d(DisasContext *dc, const OpcodeArg arg[], 6600 const uint32_t par[]) 6601 { 6602 tcg_gen_concat_i32_i64(arg[0].out, arg[2].in, arg[1].in); 6603 } 6604 6605 static void translate_wfr_s(DisasContext *dc, const OpcodeArg arg[], 6606 const uint32_t par[]) 6607 { 6608 if (arg[0].num_bits == 32) { 6609 tcg_gen_mov_i32(arg[0].out, arg[1].in); 6610 } else { 6611 tcg_gen_ext_i32_i64(arg[0].out, arg[1].in); 6612 } 6613 } 6614 6615 static void translate_wur_fpu2k_fcr(DisasContext *dc, const OpcodeArg arg[], 6616 const uint32_t par[]) 6617 { 6618 gen_helper_wur_fpu2k_fcr(tcg_env, arg[0].in); 6619 } 6620 6621 static void translate_wur_fpu2k_fsr(DisasContext *dc, const OpcodeArg arg[], 6622 const uint32_t par[]) 6623 { 6624 tcg_gen_andi_i32(cpu_UR[par[0]], arg[0].in, 0xffffff80); 6625 } 6626 6627 static const XtensaOpcodeOps fpu2000_ops[] = { 6628 { 6629 .name = "abs.s", 6630 .translate = translate_abs_s, 6631 .coprocessor = 0x1, 6632 }, { 6633 .name = "add.s", 6634 .translate = translate_fpu2k_add_s, 6635 .coprocessor = 0x1, 6636 }, { 6637 .name = "ceil.s", 6638 .translate = translate_ftoi_s, 6639 .par = (const uint32_t[]){float_round_up, false}, 6640 .coprocessor = 0x1, 6641 }, { 6642 .name = "float.s", 6643 .translate = translate_float_s, 6644 .par = (const uint32_t[]){false}, 6645 .coprocessor = 0x1, 6646 }, { 6647 .name = "floor.s", 6648 .translate = translate_ftoi_s, 6649 .par = (const uint32_t[]){float_round_down, false}, 6650 .coprocessor = 0x1, 6651 }, { 6652 .name = "lsi", 6653 .translate = translate_ldsti, 6654 .par = (const uint32_t[]){false, false}, 6655 .op_flags = XTENSA_OP_LOAD, 6656 .coprocessor = 0x1, 6657 }, { 6658 .name = "lsiu", 6659 .translate = translate_ldsti, 6660 .par = (const uint32_t[]){false, true}, 6661 .op_flags = XTENSA_OP_LOAD, 6662 .coprocessor = 0x1, 6663 }, { 6664 .name = "lsx", 6665 .translate = translate_ldstx, 6666 .par = (const uint32_t[]){false, false}, 6667 .op_flags = XTENSA_OP_LOAD, 6668 .coprocessor = 0x1, 6669 }, { 6670 .name = "lsxu", 6671 .translate = translate_ldstx, 6672 .par = (const uint32_t[]){false, true}, 6673 .op_flags = XTENSA_OP_LOAD, 6674 .coprocessor = 0x1, 6675 }, { 6676 .name = "madd.s", 6677 .translate = translate_fpu2k_madd_s, 6678 .coprocessor = 0x1, 6679 }, { 6680 .name = "mov.s", 6681 .translate = translate_mov_s, 6682 .coprocessor = 0x1, 6683 }, { 6684 .name = "moveqz.s", 6685 .translate = translate_movcond_s, 6686 .par = (const uint32_t[]){TCG_COND_EQ}, 6687 .coprocessor = 0x1, 6688 }, { 6689 .name = "movf.s", 6690 .translate = translate_movp_s, 6691 .par = (const uint32_t[]){TCG_COND_EQ}, 6692 .coprocessor = 0x1, 6693 }, { 6694 .name = "movgez.s", 6695 .translate = translate_movcond_s, 6696 .par = (const uint32_t[]){TCG_COND_GE}, 6697 .coprocessor = 0x1, 6698 }, { 6699 .name = "movltz.s", 6700 .translate = translate_movcond_s, 6701 .par = (const uint32_t[]){TCG_COND_LT}, 6702 .coprocessor = 0x1, 6703 }, { 6704 .name = "movnez.s", 6705 .translate = translate_movcond_s, 6706 .par = (const uint32_t[]){TCG_COND_NE}, 6707 .coprocessor = 0x1, 6708 }, { 6709 .name = "movt.s", 6710 .translate = translate_movp_s, 6711 .par = (const uint32_t[]){TCG_COND_NE}, 6712 .coprocessor = 0x1, 6713 }, { 6714 .name = "msub.s", 6715 .translate = translate_fpu2k_msub_s, 6716 .coprocessor = 0x1, 6717 }, { 6718 .name = "mul.s", 6719 .translate = translate_fpu2k_mul_s, 6720 .coprocessor = 0x1, 6721 }, { 6722 .name = "neg.s", 6723 .translate = translate_neg_s, 6724 .coprocessor = 0x1, 6725 }, { 6726 .name = "oeq.s", 6727 .translate = translate_compare_s, 6728 .par = (const uint32_t[]){COMPARE_OEQ}, 6729 .coprocessor = 0x1, 6730 }, { 6731 .name = "ole.s", 6732 .translate = translate_compare_s, 6733 .par = (const uint32_t[]){COMPARE_OLE}, 6734 .coprocessor = 0x1, 6735 }, { 6736 .name = "olt.s", 6737 .translate = translate_compare_s, 6738 .par = (const uint32_t[]){COMPARE_OLT}, 6739 .coprocessor = 0x1, 6740 }, { 6741 .name = "rfr", 6742 .translate = translate_rfr_s, 6743 .coprocessor = 0x1, 6744 }, { 6745 .name = "round.s", 6746 .translate = translate_ftoi_s, 6747 .par = (const uint32_t[]){float_round_nearest_even, false}, 6748 .coprocessor = 0x1, 6749 }, { 6750 .name = "rur.fcr", 6751 .translate = translate_rur, 6752 .par = (const uint32_t[]){FCR}, 6753 .coprocessor = 0x1, 6754 }, { 6755 .name = "rur.fsr", 6756 .translate = translate_rur, 6757 .par = (const uint32_t[]){FSR}, 6758 .coprocessor = 0x1, 6759 }, { 6760 .name = "ssi", 6761 .translate = translate_ldsti, 6762 .par = (const uint32_t[]){true, false}, 6763 .op_flags = XTENSA_OP_STORE, 6764 .coprocessor = 0x1, 6765 }, { 6766 .name = "ssiu", 6767 .translate = translate_ldsti, 6768 .par = (const uint32_t[]){true, true}, 6769 .op_flags = XTENSA_OP_STORE, 6770 .coprocessor = 0x1, 6771 }, { 6772 .name = "ssx", 6773 .translate = translate_ldstx, 6774 .par = (const uint32_t[]){true, false}, 6775 .op_flags = XTENSA_OP_STORE, 6776 .coprocessor = 0x1, 6777 }, { 6778 .name = "ssxu", 6779 .translate = translate_ldstx, 6780 .par = (const uint32_t[]){true, true}, 6781 .op_flags = XTENSA_OP_STORE, 6782 .coprocessor = 0x1, 6783 }, { 6784 .name = "sub.s", 6785 .translate = translate_fpu2k_sub_s, 6786 .coprocessor = 0x1, 6787 }, { 6788 .name = "trunc.s", 6789 .translate = translate_ftoi_s, 6790 .par = (const uint32_t[]){float_round_to_zero, false}, 6791 .coprocessor = 0x1, 6792 }, { 6793 .name = "ueq.s", 6794 .translate = translate_compare_s, 6795 .par = (const uint32_t[]){COMPARE_UEQ}, 6796 .coprocessor = 0x1, 6797 }, { 6798 .name = "ufloat.s", 6799 .translate = translate_float_s, 6800 .par = (const uint32_t[]){true}, 6801 .coprocessor = 0x1, 6802 }, { 6803 .name = "ule.s", 6804 .translate = translate_compare_s, 6805 .par = (const uint32_t[]){COMPARE_ULE}, 6806 .coprocessor = 0x1, 6807 }, { 6808 .name = "ult.s", 6809 .translate = translate_compare_s, 6810 .par = (const uint32_t[]){COMPARE_ULT}, 6811 .coprocessor = 0x1, 6812 }, { 6813 .name = "un.s", 6814 .translate = translate_compare_s, 6815 .par = (const uint32_t[]){COMPARE_UN}, 6816 .coprocessor = 0x1, 6817 }, { 6818 .name = "utrunc.s", 6819 .translate = translate_ftoi_s, 6820 .par = (const uint32_t[]){float_round_to_zero, true}, 6821 .coprocessor = 0x1, 6822 }, { 6823 .name = "wfr", 6824 .translate = translate_wfr_s, 6825 .coprocessor = 0x1, 6826 }, { 6827 .name = "wur.fcr", 6828 .translate = translate_wur_fpu2k_fcr, 6829 .par = (const uint32_t[]){FCR}, 6830 .coprocessor = 0x1, 6831 }, { 6832 .name = "wur.fsr", 6833 .translate = translate_wur_fpu2k_fsr, 6834 .par = (const uint32_t[]){FSR}, 6835 .coprocessor = 0x1, 6836 }, 6837 }; 6838 6839 const XtensaOpcodeTranslators xtensa_fpu2000_opcodes = { 6840 .num_opcodes = ARRAY_SIZE(fpu2000_ops), 6841 .opcode = fpu2000_ops, 6842 }; 6843 6844 static void translate_add_d(DisasContext *dc, const OpcodeArg arg[], 6845 const uint32_t par[]) 6846 { 6847 gen_helper_add_d(arg[0].out, tcg_env, arg[1].in, arg[2].in); 6848 } 6849 6850 static void translate_add_s(DisasContext *dc, const OpcodeArg arg[], 6851 const uint32_t par[]) 6852 { 6853 if (option_enabled(dc, XTENSA_OPTION_DFPU_SINGLE_ONLY)) { 6854 gen_helper_fpu2k_add_s(arg[0].out, tcg_env, 6855 arg[1].in, arg[2].in); 6856 } else { 6857 OpcodeArg arg32[3]; 6858 6859 get_f32_o1_i2(arg, arg32, 0, 1, 2); 6860 gen_helper_add_s(arg32[0].out, tcg_env, arg32[1].in, arg32[2].in); 6861 put_f32_o1_i2(arg, arg32, 0, 1, 2); 6862 } 6863 } 6864 6865 static void translate_cvtd_s(DisasContext *dc, const OpcodeArg arg[], 6866 const uint32_t par[]) 6867 { 6868 TCGv_i32 v = tcg_temp_new_i32(); 6869 6870 tcg_gen_extrl_i64_i32(v, arg[1].in); 6871 gen_helper_cvtd_s(arg[0].out, tcg_env, v); 6872 } 6873 6874 static void translate_cvts_d(DisasContext *dc, const OpcodeArg arg[], 6875 const uint32_t par[]) 6876 { 6877 TCGv_i32 v = tcg_temp_new_i32(); 6878 6879 gen_helper_cvts_d(v, tcg_env, arg[1].in); 6880 tcg_gen_extu_i32_i64(arg[0].out, v); 6881 } 6882 6883 static void translate_ldsti_d(DisasContext *dc, const OpcodeArg arg[], 6884 const uint32_t par[]) 6885 { 6886 TCGv_i32 addr; 6887 MemOp mop; 6888 6889 if (par[1]) { 6890 addr = tcg_temp_new_i32(); 6891 tcg_gen_addi_i32(addr, arg[1].in, arg[2].imm); 6892 } else { 6893 addr = arg[1].in; 6894 } 6895 mop = gen_load_store_alignment(dc, MO_TEUQ, addr); 6896 if (par[0]) { 6897 tcg_gen_qemu_st_i64(arg[0].in, addr, dc->cring, mop); 6898 } else { 6899 tcg_gen_qemu_ld_i64(arg[0].out, addr, dc->cring, mop); 6900 } 6901 if (par[2]) { 6902 if (par[1]) { 6903 tcg_gen_mov_i32(arg[1].out, addr); 6904 } else { 6905 tcg_gen_addi_i32(arg[1].out, arg[1].in, arg[2].imm); 6906 } 6907 } 6908 } 6909 6910 static void translate_ldsti_s(DisasContext *dc, const OpcodeArg arg[], 6911 const uint32_t par[]) 6912 { 6913 TCGv_i32 addr; 6914 OpcodeArg arg32[1]; 6915 MemOp mop; 6916 6917 if (par[1]) { 6918 addr = tcg_temp_new_i32(); 6919 tcg_gen_addi_i32(addr, arg[1].in, arg[2].imm); 6920 } else { 6921 addr = arg[1].in; 6922 } 6923 mop = gen_load_store_alignment(dc, MO_TEUL, addr); 6924 if (par[0]) { 6925 get_f32_i1(arg, arg32, 0); 6926 tcg_gen_qemu_st_tl(arg32[0].in, addr, dc->cring, mop); 6927 put_f32_i1(arg, arg32, 0); 6928 } else { 6929 get_f32_o1(arg, arg32, 0); 6930 tcg_gen_qemu_ld_tl(arg32[0].out, addr, dc->cring, mop); 6931 put_f32_o1(arg, arg32, 0); 6932 } 6933 if (par[2]) { 6934 if (par[1]) { 6935 tcg_gen_mov_i32(arg[1].out, addr); 6936 } else { 6937 tcg_gen_addi_i32(arg[1].out, arg[1].in, arg[2].imm); 6938 } 6939 } 6940 } 6941 6942 static void translate_ldstx_d(DisasContext *dc, const OpcodeArg arg[], 6943 const uint32_t par[]) 6944 { 6945 TCGv_i32 addr; 6946 MemOp mop; 6947 6948 if (par[1]) { 6949 addr = tcg_temp_new_i32(); 6950 tcg_gen_add_i32(addr, arg[1].in, arg[2].in); 6951 } else { 6952 addr = arg[1].in; 6953 } 6954 mop = gen_load_store_alignment(dc, MO_TEUQ, addr); 6955 if (par[0]) { 6956 tcg_gen_qemu_st_i64(arg[0].in, addr, dc->cring, mop); 6957 } else { 6958 tcg_gen_qemu_ld_i64(arg[0].out, addr, dc->cring, mop); 6959 } 6960 if (par[2]) { 6961 if (par[1]) { 6962 tcg_gen_mov_i32(arg[1].out, addr); 6963 } else { 6964 tcg_gen_add_i32(arg[1].out, arg[1].in, arg[2].in); 6965 } 6966 } 6967 } 6968 6969 static void translate_ldstx_s(DisasContext *dc, const OpcodeArg arg[], 6970 const uint32_t par[]) 6971 { 6972 TCGv_i32 addr; 6973 OpcodeArg arg32[1]; 6974 MemOp mop; 6975 6976 if (par[1]) { 6977 addr = tcg_temp_new_i32(); 6978 tcg_gen_add_i32(addr, arg[1].in, arg[2].in); 6979 } else { 6980 addr = arg[1].in; 6981 } 6982 mop = gen_load_store_alignment(dc, MO_TEUL, addr); 6983 if (par[0]) { 6984 get_f32_i1(arg, arg32, 0); 6985 tcg_gen_qemu_st_tl(arg32[0].in, addr, dc->cring, mop); 6986 put_f32_i1(arg, arg32, 0); 6987 } else { 6988 get_f32_o1(arg, arg32, 0); 6989 tcg_gen_qemu_ld_tl(arg32[0].out, addr, dc->cring, mop); 6990 put_f32_o1(arg, arg32, 0); 6991 } 6992 if (par[2]) { 6993 if (par[1]) { 6994 tcg_gen_mov_i32(arg[1].out, addr); 6995 } else { 6996 tcg_gen_add_i32(arg[1].out, arg[1].in, arg[2].in); 6997 } 6998 } 6999 } 7000 7001 static void translate_madd_d(DisasContext *dc, const OpcodeArg arg[], 7002 const uint32_t par[]) 7003 { 7004 gen_helper_madd_d(arg[0].out, tcg_env, 7005 arg[0].in, arg[1].in, arg[2].in); 7006 } 7007 7008 static void translate_madd_s(DisasContext *dc, const OpcodeArg arg[], 7009 const uint32_t par[]) 7010 { 7011 if (option_enabled(dc, XTENSA_OPTION_DFPU_SINGLE_ONLY)) { 7012 gen_helper_fpu2k_madd_s(arg[0].out, tcg_env, 7013 arg[0].in, arg[1].in, arg[2].in); 7014 } else { 7015 OpcodeArg arg32[3]; 7016 7017 get_f32_o1_i3(arg, arg32, 0, 0, 1, 2); 7018 gen_helper_madd_s(arg32[0].out, tcg_env, 7019 arg32[0].in, arg32[1].in, arg32[2].in); 7020 put_f32_o1_i3(arg, arg32, 0, 0, 1, 2); 7021 } 7022 } 7023 7024 static void translate_mul_d(DisasContext *dc, const OpcodeArg arg[], 7025 const uint32_t par[]) 7026 { 7027 gen_helper_mul_d(arg[0].out, tcg_env, arg[1].in, arg[2].in); 7028 } 7029 7030 static void translate_mul_s(DisasContext *dc, const OpcodeArg arg[], 7031 const uint32_t par[]) 7032 { 7033 if (option_enabled(dc, XTENSA_OPTION_DFPU_SINGLE_ONLY)) { 7034 gen_helper_fpu2k_mul_s(arg[0].out, tcg_env, 7035 arg[1].in, arg[2].in); 7036 } else { 7037 OpcodeArg arg32[3]; 7038 7039 get_f32_o1_i2(arg, arg32, 0, 1, 2); 7040 gen_helper_mul_s(arg32[0].out, tcg_env, arg32[1].in, arg32[2].in); 7041 put_f32_o1_i2(arg, arg32, 0, 1, 2); 7042 } 7043 } 7044 7045 static void translate_msub_d(DisasContext *dc, const OpcodeArg arg[], 7046 const uint32_t par[]) 7047 { 7048 gen_helper_msub_d(arg[0].out, tcg_env, 7049 arg[0].in, arg[1].in, arg[2].in); 7050 } 7051 7052 static void translate_msub_s(DisasContext *dc, const OpcodeArg arg[], 7053 const uint32_t par[]) 7054 { 7055 if (option_enabled(dc, XTENSA_OPTION_DFPU_SINGLE_ONLY)) { 7056 gen_helper_fpu2k_msub_s(arg[0].out, tcg_env, 7057 arg[0].in, arg[1].in, arg[2].in); 7058 } else { 7059 OpcodeArg arg32[3]; 7060 7061 get_f32_o1_i3(arg, arg32, 0, 0, 1, 2); 7062 gen_helper_msub_s(arg32[0].out, tcg_env, 7063 arg32[0].in, arg32[1].in, arg32[2].in); 7064 put_f32_o1_i3(arg, arg32, 0, 0, 1, 2); 7065 } 7066 } 7067 7068 static void translate_sub_d(DisasContext *dc, const OpcodeArg arg[], 7069 const uint32_t par[]) 7070 { 7071 gen_helper_sub_d(arg[0].out, tcg_env, arg[1].in, arg[2].in); 7072 } 7073 7074 static void translate_sub_s(DisasContext *dc, const OpcodeArg arg[], 7075 const uint32_t par[]) 7076 { 7077 if (option_enabled(dc, XTENSA_OPTION_DFPU_SINGLE_ONLY)) { 7078 gen_helper_fpu2k_sub_s(arg[0].out, tcg_env, 7079 arg[1].in, arg[2].in); 7080 } else { 7081 OpcodeArg arg32[3]; 7082 7083 get_f32_o1_i2(arg, arg32, 0, 1, 2); 7084 gen_helper_sub_s(arg32[0].out, tcg_env, arg32[1].in, arg32[2].in); 7085 put_f32_o1_i2(arg, arg32, 0, 1, 2); 7086 } 7087 } 7088 7089 static void translate_mkdadj_d(DisasContext *dc, const OpcodeArg arg[], 7090 const uint32_t par[]) 7091 { 7092 gen_helper_mkdadj_d(arg[0].out, tcg_env, arg[0].in, arg[1].in); 7093 } 7094 7095 static void translate_mkdadj_s(DisasContext *dc, const OpcodeArg arg[], 7096 const uint32_t par[]) 7097 { 7098 OpcodeArg arg32[2]; 7099 7100 get_f32_o1_i2(arg, arg32, 0, 0, 1); 7101 gen_helper_mkdadj_s(arg32[0].out, tcg_env, arg32[0].in, arg32[1].in); 7102 put_f32_o1_i2(arg, arg32, 0, 0, 1); 7103 } 7104 7105 static void translate_mksadj_d(DisasContext *dc, const OpcodeArg arg[], 7106 const uint32_t par[]) 7107 { 7108 gen_helper_mksadj_d(arg[0].out, tcg_env, arg[1].in); 7109 } 7110 7111 static void translate_mksadj_s(DisasContext *dc, const OpcodeArg arg[], 7112 const uint32_t par[]) 7113 { 7114 OpcodeArg arg32[2]; 7115 7116 get_f32_o1_i1(arg, arg32, 0, 1); 7117 gen_helper_mksadj_s(arg32[0].out, tcg_env, arg32[1].in); 7118 put_f32_o1_i1(arg, arg32, 0, 1); 7119 } 7120 7121 static void translate_wur_fpu_fcr(DisasContext *dc, const OpcodeArg arg[], 7122 const uint32_t par[]) 7123 { 7124 gen_helper_wur_fpu_fcr(tcg_env, arg[0].in); 7125 } 7126 7127 static void translate_rur_fpu_fsr(DisasContext *dc, const OpcodeArg arg[], 7128 const uint32_t par[]) 7129 { 7130 gen_helper_rur_fpu_fsr(arg[0].out, tcg_env); 7131 } 7132 7133 static void translate_wur_fpu_fsr(DisasContext *dc, const OpcodeArg arg[], 7134 const uint32_t par[]) 7135 { 7136 gen_helper_wur_fpu_fsr(tcg_env, arg[0].in); 7137 } 7138 7139 static const XtensaOpcodeOps fpu_ops[] = { 7140 { 7141 .name = "abs.d", 7142 .translate = translate_abs_d, 7143 .coprocessor = 0x1, 7144 }, { 7145 .name = "abs.s", 7146 .translate = translate_abs_s, 7147 .coprocessor = 0x1, 7148 }, { 7149 .name = "add.d", 7150 .translate = translate_add_d, 7151 .coprocessor = 0x1, 7152 }, { 7153 .name = "add.s", 7154 .translate = translate_add_s, 7155 .coprocessor = 0x1, 7156 }, { 7157 .name = "addexp.d", 7158 .translate = translate_nop, 7159 .coprocessor = 0x1, 7160 }, { 7161 .name = "addexp.s", 7162 .translate = translate_nop, 7163 .coprocessor = 0x1, 7164 }, { 7165 .name = "addexpm.d", 7166 .translate = translate_mov_s, 7167 .coprocessor = 0x1, 7168 }, { 7169 .name = "addexpm.s", 7170 .translate = translate_mov_s, 7171 .coprocessor = 0x1, 7172 }, { 7173 .name = "ceil.d", 7174 .translate = translate_ftoi_d, 7175 .par = (const uint32_t[]){float_round_up, false}, 7176 .coprocessor = 0x1, 7177 }, { 7178 .name = "ceil.s", 7179 .translate = translate_ftoi_s, 7180 .par = (const uint32_t[]){float_round_up, false}, 7181 .coprocessor = 0x1, 7182 }, { 7183 .name = "const.d", 7184 .translate = translate_const_d, 7185 .coprocessor = 0x1, 7186 }, { 7187 .name = "const.s", 7188 .translate = translate_const_s, 7189 .coprocessor = 0x1, 7190 }, { 7191 .name = "cvtd.s", 7192 .translate = translate_cvtd_s, 7193 .coprocessor = 0x1, 7194 }, { 7195 .name = "cvts.d", 7196 .translate = translate_cvts_d, 7197 .coprocessor = 0x1, 7198 }, { 7199 .name = "div0.d", 7200 .translate = translate_nop, 7201 .coprocessor = 0x1, 7202 }, { 7203 .name = "div0.s", 7204 .translate = translate_nop, 7205 .coprocessor = 0x1, 7206 }, { 7207 .name = "divn.d", 7208 .translate = translate_nop, 7209 .coprocessor = 0x1, 7210 }, { 7211 .name = "divn.s", 7212 .translate = translate_nop, 7213 .coprocessor = 0x1, 7214 }, { 7215 .name = "float.d", 7216 .translate = translate_float_d, 7217 .par = (const uint32_t[]){false}, 7218 .coprocessor = 0x1, 7219 }, { 7220 .name = "float.s", 7221 .translate = translate_float_s, 7222 .par = (const uint32_t[]){false}, 7223 .coprocessor = 0x1, 7224 }, { 7225 .name = "floor.d", 7226 .translate = translate_ftoi_d, 7227 .par = (const uint32_t[]){float_round_down, false}, 7228 .coprocessor = 0x1, 7229 }, { 7230 .name = "floor.s", 7231 .translate = translate_ftoi_s, 7232 .par = (const uint32_t[]){float_round_down, false}, 7233 .coprocessor = 0x1, 7234 }, { 7235 .name = "ldi", 7236 .translate = translate_ldsti_d, 7237 .par = (const uint32_t[]){false, true, false}, 7238 .op_flags = XTENSA_OP_LOAD, 7239 .coprocessor = 0x1, 7240 }, { 7241 .name = "ldip", 7242 .translate = translate_ldsti_d, 7243 .par = (const uint32_t[]){false, false, true}, 7244 .op_flags = XTENSA_OP_LOAD, 7245 .coprocessor = 0x1, 7246 }, { 7247 .name = "ldiu", 7248 .translate = translate_ldsti_d, 7249 .par = (const uint32_t[]){false, true, true}, 7250 .op_flags = XTENSA_OP_LOAD, 7251 .coprocessor = 0x1, 7252 }, { 7253 .name = "ldx", 7254 .translate = translate_ldstx_d, 7255 .par = (const uint32_t[]){false, true, false}, 7256 .op_flags = XTENSA_OP_LOAD, 7257 .coprocessor = 0x1, 7258 }, { 7259 .name = "ldxp", 7260 .translate = translate_ldstx_d, 7261 .par = (const uint32_t[]){false, false, true}, 7262 .op_flags = XTENSA_OP_LOAD, 7263 .coprocessor = 0x1, 7264 }, { 7265 .name = "ldxu", 7266 .translate = translate_ldstx_d, 7267 .par = (const uint32_t[]){false, true, true}, 7268 .op_flags = XTENSA_OP_LOAD, 7269 .coprocessor = 0x1, 7270 }, { 7271 .name = "lsi", 7272 .translate = translate_ldsti_s, 7273 .par = (const uint32_t[]){false, true, false}, 7274 .op_flags = XTENSA_OP_LOAD, 7275 .coprocessor = 0x1, 7276 }, { 7277 .name = "lsip", 7278 .translate = translate_ldsti_s, 7279 .par = (const uint32_t[]){false, false, true}, 7280 .op_flags = XTENSA_OP_LOAD, 7281 .coprocessor = 0x1, 7282 }, { 7283 .name = "lsiu", 7284 .translate = translate_ldsti_s, 7285 .par = (const uint32_t[]){false, true, true}, 7286 .op_flags = XTENSA_OP_LOAD, 7287 .coprocessor = 0x1, 7288 }, { 7289 .name = "lsx", 7290 .translate = translate_ldstx_s, 7291 .par = (const uint32_t[]){false, true, false}, 7292 .op_flags = XTENSA_OP_LOAD, 7293 .coprocessor = 0x1, 7294 }, { 7295 .name = "lsxp", 7296 .translate = translate_ldstx_s, 7297 .par = (const uint32_t[]){false, false, true}, 7298 .op_flags = XTENSA_OP_LOAD, 7299 .coprocessor = 0x1, 7300 }, { 7301 .name = "lsxu", 7302 .translate = translate_ldstx_s, 7303 .par = (const uint32_t[]){false, true, true}, 7304 .op_flags = XTENSA_OP_LOAD, 7305 .coprocessor = 0x1, 7306 }, { 7307 .name = "madd.d", 7308 .translate = translate_madd_d, 7309 .coprocessor = 0x1, 7310 }, { 7311 .name = "madd.s", 7312 .translate = translate_madd_s, 7313 .coprocessor = 0x1, 7314 }, { 7315 .name = "maddn.d", 7316 .translate = translate_nop, 7317 .coprocessor = 0x1, 7318 }, { 7319 .name = "maddn.s", 7320 .translate = translate_nop, 7321 .coprocessor = 0x1, 7322 }, { 7323 .name = "mkdadj.d", 7324 .translate = translate_mkdadj_d, 7325 .coprocessor = 0x1, 7326 }, { 7327 .name = "mkdadj.s", 7328 .translate = translate_mkdadj_s, 7329 .coprocessor = 0x1, 7330 }, { 7331 .name = "mksadj.d", 7332 .translate = translate_mksadj_d, 7333 .coprocessor = 0x1, 7334 }, { 7335 .name = "mksadj.s", 7336 .translate = translate_mksadj_s, 7337 .coprocessor = 0x1, 7338 }, { 7339 .name = "mov.d", 7340 .translate = translate_mov_d, 7341 .coprocessor = 0x1, 7342 }, { 7343 .name = "mov.s", 7344 .translate = translate_mov_s, 7345 .coprocessor = 0x1, 7346 }, { 7347 .name = "moveqz.d", 7348 .translate = translate_movcond_d, 7349 .par = (const uint32_t[]){TCG_COND_EQ}, 7350 .coprocessor = 0x1, 7351 }, { 7352 .name = "moveqz.s", 7353 .translate = translate_movcond_s, 7354 .par = (const uint32_t[]){TCG_COND_EQ}, 7355 .coprocessor = 0x1, 7356 }, { 7357 .name = "movf.d", 7358 .translate = translate_movp_d, 7359 .par = (const uint32_t[]){TCG_COND_EQ}, 7360 .coprocessor = 0x1, 7361 }, { 7362 .name = "movf.s", 7363 .translate = translate_movp_s, 7364 .par = (const uint32_t[]){TCG_COND_EQ}, 7365 .coprocessor = 0x1, 7366 }, { 7367 .name = "movgez.d", 7368 .translate = translate_movcond_d, 7369 .par = (const uint32_t[]){TCG_COND_GE}, 7370 .coprocessor = 0x1, 7371 }, { 7372 .name = "movgez.s", 7373 .translate = translate_movcond_s, 7374 .par = (const uint32_t[]){TCG_COND_GE}, 7375 .coprocessor = 0x1, 7376 }, { 7377 .name = "movltz.d", 7378 .translate = translate_movcond_d, 7379 .par = (const uint32_t[]){TCG_COND_LT}, 7380 .coprocessor = 0x1, 7381 }, { 7382 .name = "movltz.s", 7383 .translate = translate_movcond_s, 7384 .par = (const uint32_t[]){TCG_COND_LT}, 7385 .coprocessor = 0x1, 7386 }, { 7387 .name = "movnez.d", 7388 .translate = translate_movcond_d, 7389 .par = (const uint32_t[]){TCG_COND_NE}, 7390 .coprocessor = 0x1, 7391 }, { 7392 .name = "movnez.s", 7393 .translate = translate_movcond_s, 7394 .par = (const uint32_t[]){TCG_COND_NE}, 7395 .coprocessor = 0x1, 7396 }, { 7397 .name = "movt.d", 7398 .translate = translate_movp_d, 7399 .par = (const uint32_t[]){TCG_COND_NE}, 7400 .coprocessor = 0x1, 7401 }, { 7402 .name = "movt.s", 7403 .translate = translate_movp_s, 7404 .par = (const uint32_t[]){TCG_COND_NE}, 7405 .coprocessor = 0x1, 7406 }, { 7407 .name = "msub.d", 7408 .translate = translate_msub_d, 7409 .coprocessor = 0x1, 7410 }, { 7411 .name = "msub.s", 7412 .translate = translate_msub_s, 7413 .coprocessor = 0x1, 7414 }, { 7415 .name = "mul.d", 7416 .translate = translate_mul_d, 7417 .coprocessor = 0x1, 7418 }, { 7419 .name = "mul.s", 7420 .translate = translate_mul_s, 7421 .coprocessor = 0x1, 7422 }, { 7423 .name = "neg.d", 7424 .translate = translate_neg_d, 7425 .coprocessor = 0x1, 7426 }, { 7427 .name = "neg.s", 7428 .translate = translate_neg_s, 7429 .coprocessor = 0x1, 7430 }, { 7431 .name = "nexp01.d", 7432 .translate = translate_nop, 7433 .coprocessor = 0x1, 7434 }, { 7435 .name = "nexp01.s", 7436 .translate = translate_nop, 7437 .coprocessor = 0x1, 7438 }, { 7439 .name = "oeq.d", 7440 .translate = translate_compare_d, 7441 .par = (const uint32_t[]){COMPARE_OEQ}, 7442 .coprocessor = 0x1, 7443 }, { 7444 .name = "oeq.s", 7445 .translate = translate_compare_s, 7446 .par = (const uint32_t[]){COMPARE_OEQ}, 7447 .coprocessor = 0x1, 7448 }, { 7449 .name = "ole.d", 7450 .translate = translate_compare_d, 7451 .par = (const uint32_t[]){COMPARE_OLE}, 7452 .coprocessor = 0x1, 7453 }, { 7454 .name = "ole.s", 7455 .translate = translate_compare_s, 7456 .par = (const uint32_t[]){COMPARE_OLE}, 7457 .coprocessor = 0x1, 7458 }, { 7459 .name = "olt.d", 7460 .translate = translate_compare_d, 7461 .par = (const uint32_t[]){COMPARE_OLT}, 7462 .coprocessor = 0x1, 7463 }, { 7464 .name = "olt.s", 7465 .translate = translate_compare_s, 7466 .par = (const uint32_t[]){COMPARE_OLT}, 7467 .coprocessor = 0x1, 7468 }, { 7469 .name = "rfr", 7470 .translate = translate_rfr_s, 7471 .coprocessor = 0x1, 7472 }, { 7473 .name = "rfrd", 7474 .translate = translate_rfr_d, 7475 .coprocessor = 0x1, 7476 }, { 7477 .name = "round.d", 7478 .translate = translate_ftoi_d, 7479 .par = (const uint32_t[]){float_round_nearest_even, false}, 7480 .coprocessor = 0x1, 7481 }, { 7482 .name = "round.s", 7483 .translate = translate_ftoi_s, 7484 .par = (const uint32_t[]){float_round_nearest_even, false}, 7485 .coprocessor = 0x1, 7486 }, { 7487 .name = "rur.fcr", 7488 .translate = translate_rur, 7489 .par = (const uint32_t[]){FCR}, 7490 .coprocessor = 0x1, 7491 }, { 7492 .name = "rur.fsr", 7493 .translate = translate_rur_fpu_fsr, 7494 .coprocessor = 0x1, 7495 }, { 7496 .name = "sdi", 7497 .translate = translate_ldsti_d, 7498 .par = (const uint32_t[]){true, true, false}, 7499 .op_flags = XTENSA_OP_STORE, 7500 .coprocessor = 0x1, 7501 }, { 7502 .name = "sdip", 7503 .translate = translate_ldsti_d, 7504 .par = (const uint32_t[]){true, false, true}, 7505 .op_flags = XTENSA_OP_STORE, 7506 .coprocessor = 0x1, 7507 }, { 7508 .name = "sdiu", 7509 .translate = translate_ldsti_d, 7510 .par = (const uint32_t[]){true, true, true}, 7511 .op_flags = XTENSA_OP_STORE, 7512 .coprocessor = 0x1, 7513 }, { 7514 .name = "sdx", 7515 .translate = translate_ldstx_d, 7516 .par = (const uint32_t[]){true, true, false}, 7517 .op_flags = XTENSA_OP_STORE, 7518 .coprocessor = 0x1, 7519 }, { 7520 .name = "sdxp", 7521 .translate = translate_ldstx_d, 7522 .par = (const uint32_t[]){true, false, true}, 7523 .op_flags = XTENSA_OP_STORE, 7524 .coprocessor = 0x1, 7525 }, { 7526 .name = "sdxu", 7527 .translate = translate_ldstx_d, 7528 .par = (const uint32_t[]){true, true, true}, 7529 .op_flags = XTENSA_OP_STORE, 7530 .coprocessor = 0x1, 7531 }, { 7532 .name = "sqrt0.d", 7533 .translate = translate_nop, 7534 .coprocessor = 0x1, 7535 }, { 7536 .name = "sqrt0.s", 7537 .translate = translate_nop, 7538 .coprocessor = 0x1, 7539 }, { 7540 .name = "ssi", 7541 .translate = translate_ldsti_s, 7542 .par = (const uint32_t[]){true, true, false}, 7543 .op_flags = XTENSA_OP_STORE, 7544 .coprocessor = 0x1, 7545 }, { 7546 .name = "ssip", 7547 .translate = translate_ldsti_s, 7548 .par = (const uint32_t[]){true, false, true}, 7549 .op_flags = XTENSA_OP_STORE, 7550 .coprocessor = 0x1, 7551 }, { 7552 .name = "ssiu", 7553 .translate = translate_ldsti_s, 7554 .par = (const uint32_t[]){true, true, true}, 7555 .op_flags = XTENSA_OP_STORE, 7556 .coprocessor = 0x1, 7557 }, { 7558 .name = "ssx", 7559 .translate = translate_ldstx_s, 7560 .par = (const uint32_t[]){true, true, false}, 7561 .op_flags = XTENSA_OP_STORE, 7562 .coprocessor = 0x1, 7563 }, { 7564 .name = "ssxp", 7565 .translate = translate_ldstx_s, 7566 .par = (const uint32_t[]){true, false, true}, 7567 .op_flags = XTENSA_OP_STORE, 7568 .coprocessor = 0x1, 7569 }, { 7570 .name = "ssxu", 7571 .translate = translate_ldstx_s, 7572 .par = (const uint32_t[]){true, true, true}, 7573 .op_flags = XTENSA_OP_STORE, 7574 .coprocessor = 0x1, 7575 }, { 7576 .name = "sub.d", 7577 .translate = translate_sub_d, 7578 .coprocessor = 0x1, 7579 }, { 7580 .name = "sub.s", 7581 .translate = translate_sub_s, 7582 .coprocessor = 0x1, 7583 }, { 7584 .name = "trunc.d", 7585 .translate = translate_ftoi_d, 7586 .par = (const uint32_t[]){float_round_to_zero, false}, 7587 .coprocessor = 0x1, 7588 }, { 7589 .name = "trunc.s", 7590 .translate = translate_ftoi_s, 7591 .par = (const uint32_t[]){float_round_to_zero, false}, 7592 .coprocessor = 0x1, 7593 }, { 7594 .name = "ueq.d", 7595 .translate = translate_compare_d, 7596 .par = (const uint32_t[]){COMPARE_UEQ}, 7597 .coprocessor = 0x1, 7598 }, { 7599 .name = "ueq.s", 7600 .translate = translate_compare_s, 7601 .par = (const uint32_t[]){COMPARE_UEQ}, 7602 .coprocessor = 0x1, 7603 }, { 7604 .name = "ufloat.d", 7605 .translate = translate_float_d, 7606 .par = (const uint32_t[]){true}, 7607 .coprocessor = 0x1, 7608 }, { 7609 .name = "ufloat.s", 7610 .translate = translate_float_s, 7611 .par = (const uint32_t[]){true}, 7612 .coprocessor = 0x1, 7613 }, { 7614 .name = "ule.d", 7615 .translate = translate_compare_d, 7616 .par = (const uint32_t[]){COMPARE_ULE}, 7617 .coprocessor = 0x1, 7618 }, { 7619 .name = "ule.s", 7620 .translate = translate_compare_s, 7621 .par = (const uint32_t[]){COMPARE_ULE}, 7622 .coprocessor = 0x1, 7623 }, { 7624 .name = "ult.d", 7625 .translate = translate_compare_d, 7626 .par = (const uint32_t[]){COMPARE_ULT}, 7627 .coprocessor = 0x1, 7628 }, { 7629 .name = "ult.s", 7630 .translate = translate_compare_s, 7631 .par = (const uint32_t[]){COMPARE_ULT}, 7632 .coprocessor = 0x1, 7633 }, { 7634 .name = "un.d", 7635 .translate = translate_compare_d, 7636 .par = (const uint32_t[]){COMPARE_UN}, 7637 .coprocessor = 0x1, 7638 }, { 7639 .name = "un.s", 7640 .translate = translate_compare_s, 7641 .par = (const uint32_t[]){COMPARE_UN}, 7642 .coprocessor = 0x1, 7643 }, { 7644 .name = "utrunc.d", 7645 .translate = translate_ftoi_d, 7646 .par = (const uint32_t[]){float_round_to_zero, true}, 7647 .coprocessor = 0x1, 7648 }, { 7649 .name = "utrunc.s", 7650 .translate = translate_ftoi_s, 7651 .par = (const uint32_t[]){float_round_to_zero, true}, 7652 .coprocessor = 0x1, 7653 }, { 7654 .name = "wfr", 7655 .translate = translate_wfr_s, 7656 .coprocessor = 0x1, 7657 }, { 7658 .name = "wfrd", 7659 .translate = translate_wfr_d, 7660 .coprocessor = 0x1, 7661 }, { 7662 .name = "wur.fcr", 7663 .translate = translate_wur_fpu_fcr, 7664 .par = (const uint32_t[]){FCR}, 7665 .coprocessor = 0x1, 7666 }, { 7667 .name = "wur.fsr", 7668 .translate = translate_wur_fpu_fsr, 7669 .coprocessor = 0x1, 7670 }, 7671 }; 7672 7673 const XtensaOpcodeTranslators xtensa_fpu_opcodes = { 7674 .num_opcodes = ARRAY_SIZE(fpu_ops), 7675 .opcode = fpu_ops, 7676 }; 7677