2 * Tiny Code Interpreter for QEMU
4 * Copyright (c) 2009, 2011, 2016 Stefan Weil
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "qemu/osdep.h"
21 #include "exec/cpu_ldst.h"
22 #include "tcg/tcg-op.h"
23 #include "tcg/tcg-ldst.h"
28 * Enable TCI assertions only when debugging TCG (and without NDEBUG defined).
29 * Without assertions, the interpreter runs much faster.
31 #if defined(CONFIG_DEBUG_TCG)
32 # define tci_assert(cond) assert(cond)
34 # define tci_assert(cond) ((void)(cond))
37 __thread
uintptr_t tci_tb_ptr
;
39 static void tci_write_reg64(tcg_target_ulong
*regs
, uint32_t high_index
,
40 uint32_t low_index
, uint64_t value
)
42 regs
[low_index
] = (uint32_t)value
;
43 regs
[high_index
] = value
>> 32;
46 /* Create a 64 bit value from two 32 bit values. */
47 static uint64_t tci_uint64(uint32_t high
, uint32_t low
)
49 return ((uint64_t)high
<< 32) + low
;
53 * Load sets of arguments all at once. The naming convention is:
54 * tci_args_<arguments>
55 * where arguments is a sequence of
57 * b = immediate (bit position)
58 * c = condition (TCGCond)
59 * i = immediate (uint32_t)
60 * I = immediate (tcg_target_ulong)
61 * l = label or pointer
62 * m = immediate (MemOpIdx)
63 * n = immediate (call return length)
65 * s = signed ldst offset
68 static void tci_args_l(uint32_t insn
, const void *tb_ptr
, void **l0
)
70 int diff
= sextract32(insn
, 12, 20);
71 *l0
= diff
? (void *)tb_ptr
+ diff
: NULL
;
74 static void tci_args_r(uint32_t insn
, TCGReg
*r0
)
76 *r0
= extract32(insn
, 8, 4);
79 static void tci_args_nl(uint32_t insn
, const void *tb_ptr
,
80 uint8_t *n0
, void **l1
)
82 *n0
= extract32(insn
, 8, 4);
83 *l1
= sextract32(insn
, 12, 20) + (void *)tb_ptr
;
86 static void tci_args_rl(uint32_t insn
, const void *tb_ptr
,
87 TCGReg
*r0
, void **l1
)
89 *r0
= extract32(insn
, 8, 4);
90 *l1
= sextract32(insn
, 12, 20) + (void *)tb_ptr
;
93 static void tci_args_rr(uint32_t insn
, TCGReg
*r0
, TCGReg
*r1
)
95 *r0
= extract32(insn
, 8, 4);
96 *r1
= extract32(insn
, 12, 4);
99 static void tci_args_ri(uint32_t insn
, TCGReg
*r0
, tcg_target_ulong
*i1
)
101 *r0
= extract32(insn
, 8, 4);
102 *i1
= sextract32(insn
, 12, 20);
105 static void tci_args_rrm(uint32_t insn
, TCGReg
*r0
,
106 TCGReg
*r1
, MemOpIdx
*m2
)
108 *r0
= extract32(insn
, 8, 4);
109 *r1
= extract32(insn
, 12, 4);
110 *m2
= extract32(insn
, 20, 12);
113 static void tci_args_rrr(uint32_t insn
, TCGReg
*r0
, TCGReg
*r1
, TCGReg
*r2
)
115 *r0
= extract32(insn
, 8, 4);
116 *r1
= extract32(insn
, 12, 4);
117 *r2
= extract32(insn
, 16, 4);
120 static void tci_args_rrs(uint32_t insn
, TCGReg
*r0
, TCGReg
*r1
, int32_t *i2
)
122 *r0
= extract32(insn
, 8, 4);
123 *r1
= extract32(insn
, 12, 4);
124 *i2
= sextract32(insn
, 16, 16);
127 static void tci_args_rrbb(uint32_t insn
, TCGReg
*r0
, TCGReg
*r1
,
128 uint8_t *i2
, uint8_t *i3
)
130 *r0
= extract32(insn
, 8, 4);
131 *r1
= extract32(insn
, 12, 4);
132 *i2
= extract32(insn
, 16, 6);
133 *i3
= extract32(insn
, 22, 6);
136 static void tci_args_rrrc(uint32_t insn
,
137 TCGReg
*r0
, TCGReg
*r1
, TCGReg
*r2
, TCGCond
*c3
)
139 *r0
= extract32(insn
, 8, 4);
140 *r1
= extract32(insn
, 12, 4);
141 *r2
= extract32(insn
, 16, 4);
142 *c3
= extract32(insn
, 20, 4);
145 static void tci_args_rrrm(uint32_t insn
,
146 TCGReg
*r0
, TCGReg
*r1
, TCGReg
*r2
, MemOpIdx
*m3
)
148 *r0
= extract32(insn
, 8, 4);
149 *r1
= extract32(insn
, 12, 4);
150 *r2
= extract32(insn
, 16, 4);
151 *m3
= extract32(insn
, 20, 12);
154 static void tci_args_rrrbb(uint32_t insn
, TCGReg
*r0
, TCGReg
*r1
,
155 TCGReg
*r2
, uint8_t *i3
, uint8_t *i4
)
157 *r0
= extract32(insn
, 8, 4);
158 *r1
= extract32(insn
, 12, 4);
159 *r2
= extract32(insn
, 16, 4);
160 *i3
= extract32(insn
, 20, 6);
161 *i4
= extract32(insn
, 26, 6);
164 static void tci_args_rrrrr(uint32_t insn
, TCGReg
*r0
, TCGReg
*r1
,
165 TCGReg
*r2
, TCGReg
*r3
, TCGReg
*r4
)
167 *r0
= extract32(insn
, 8, 4);
168 *r1
= extract32(insn
, 12, 4);
169 *r2
= extract32(insn
, 16, 4);
170 *r3
= extract32(insn
, 20, 4);
171 *r4
= extract32(insn
, 24, 4);
174 static void tci_args_rrrr(uint32_t insn
,
175 TCGReg
*r0
, TCGReg
*r1
, TCGReg
*r2
, TCGReg
*r3
)
177 *r0
= extract32(insn
, 8, 4);
178 *r1
= extract32(insn
, 12, 4);
179 *r2
= extract32(insn
, 16, 4);
180 *r3
= extract32(insn
, 20, 4);
183 static void tci_args_rrrrrc(uint32_t insn
, TCGReg
*r0
, TCGReg
*r1
,
184 TCGReg
*r2
, TCGReg
*r3
, TCGReg
*r4
, TCGCond
*c5
)
186 *r0
= extract32(insn
, 8, 4);
187 *r1
= extract32(insn
, 12, 4);
188 *r2
= extract32(insn
, 16, 4);
189 *r3
= extract32(insn
, 20, 4);
190 *r4
= extract32(insn
, 24, 4);
191 *c5
= extract32(insn
, 28, 4);
194 static void tci_args_rrrrrr(uint32_t insn
, TCGReg
*r0
, TCGReg
*r1
,
195 TCGReg
*r2
, TCGReg
*r3
, TCGReg
*r4
, TCGReg
*r5
)
197 *r0
= extract32(insn
, 8, 4);
198 *r1
= extract32(insn
, 12, 4);
199 *r2
= extract32(insn
, 16, 4);
200 *r3
= extract32(insn
, 20, 4);
201 *r4
= extract32(insn
, 24, 4);
202 *r5
= extract32(insn
, 28, 4);
205 static bool tci_compare32(uint32_t u0
, uint32_t u1
, TCGCond condition
)
242 g_assert_not_reached();
247 static bool tci_compare64(uint64_t u0
, uint64_t u1
, TCGCond condition
)
284 g_assert_not_reached();
289 static uint64_t tci_qemu_ld(CPUArchState
*env
, target_ulong taddr
,
290 MemOpIdx oi
, const void *tb_ptr
)
292 MemOp mop
= get_memop(oi
);
293 uintptr_t ra
= (uintptr_t)tb_ptr
;
295 #ifdef CONFIG_SOFTMMU
296 switch (mop
& (MO_BSWAP
| MO_SSIZE
)) {
298 return helper_ret_ldub_mmu(env
, taddr
, oi
, ra
);
300 return helper_ret_ldsb_mmu(env
, taddr
, oi
, ra
);
302 return helper_le_lduw_mmu(env
, taddr
, oi
, ra
);
304 return helper_le_ldsw_mmu(env
, taddr
, oi
, ra
);
306 return helper_le_ldul_mmu(env
, taddr
, oi
, ra
);
308 return helper_le_ldsl_mmu(env
, taddr
, oi
, ra
);
310 return helper_le_ldq_mmu(env
, taddr
, oi
, ra
);
312 return helper_be_lduw_mmu(env
, taddr
, oi
, ra
);
314 return helper_be_ldsw_mmu(env
, taddr
, oi
, ra
);
316 return helper_be_ldul_mmu(env
, taddr
, oi
, ra
);
318 return helper_be_ldsl_mmu(env
, taddr
, oi
, ra
);
320 return helper_be_ldq_mmu(env
, taddr
, oi
, ra
);
322 g_assert_not_reached();
325 void *haddr
= g2h(env_cpu(env
), taddr
);
326 unsigned a_mask
= (1u << get_alignment_bits(mop
)) - 1;
329 set_helper_retaddr(ra
);
330 if (taddr
& a_mask
) {
331 helper_unaligned_ld(env
, taddr
);
333 switch (mop
& (MO_BSWAP
| MO_SSIZE
)) {
341 ret
= lduw_le_p(haddr
);
344 ret
= ldsw_le_p(haddr
);
347 ret
= (uint32_t)ldl_le_p(haddr
);
350 ret
= (int32_t)ldl_le_p(haddr
);
353 ret
= ldq_le_p(haddr
);
356 ret
= lduw_be_p(haddr
);
359 ret
= ldsw_be_p(haddr
);
362 ret
= (uint32_t)ldl_be_p(haddr
);
365 ret
= (int32_t)ldl_be_p(haddr
);
368 ret
= ldq_be_p(haddr
);
371 g_assert_not_reached();
373 clear_helper_retaddr();
378 static void tci_qemu_st(CPUArchState
*env
, target_ulong taddr
, uint64_t val
,
379 MemOpIdx oi
, const void *tb_ptr
)
381 MemOp mop
= get_memop(oi
);
382 uintptr_t ra
= (uintptr_t)tb_ptr
;
384 #ifdef CONFIG_SOFTMMU
385 switch (mop
& (MO_BSWAP
| MO_SIZE
)) {
387 helper_ret_stb_mmu(env
, taddr
, val
, oi
, ra
);
390 helper_le_stw_mmu(env
, taddr
, val
, oi
, ra
);
393 helper_le_stl_mmu(env
, taddr
, val
, oi
, ra
);
396 helper_le_stq_mmu(env
, taddr
, val
, oi
, ra
);
399 helper_be_stw_mmu(env
, taddr
, val
, oi
, ra
);
402 helper_be_stl_mmu(env
, taddr
, val
, oi
, ra
);
405 helper_be_stq_mmu(env
, taddr
, val
, oi
, ra
);
408 g_assert_not_reached();
411 void *haddr
= g2h(env_cpu(env
), taddr
);
412 unsigned a_mask
= (1u << get_alignment_bits(mop
)) - 1;
414 set_helper_retaddr(ra
);
415 if (taddr
& a_mask
) {
416 helper_unaligned_st(env
, taddr
);
418 switch (mop
& (MO_BSWAP
| MO_SIZE
)) {
423 stw_le_p(haddr
, val
);
426 stl_le_p(haddr
, val
);
429 stq_le_p(haddr
, val
);
432 stw_be_p(haddr
, val
);
435 stl_be_p(haddr
, val
);
438 stq_be_p(haddr
, val
);
441 g_assert_not_reached();
443 clear_helper_retaddr();
447 #if TCG_TARGET_REG_BITS == 64
448 # define CASE_32_64(x) \
449 case glue(glue(INDEX_op_, x), _i64): \
450 case glue(glue(INDEX_op_, x), _i32):
451 # define CASE_64(x) \
452 case glue(glue(INDEX_op_, x), _i64):
454 # define CASE_32_64(x) \
455 case glue(glue(INDEX_op_, x), _i32):
459 /* Interpret pseudo code in tb. */
461 * Disable CFI checks.
462 * One possible operation in the pseudo code is a call to binary code.
463 * Therefore, disable CFI checks in the interpreter function
465 uintptr_t QEMU_DISABLE_CFI
tcg_qemu_tb_exec(CPUArchState
*env
,
466 const void *v_tb_ptr
)
468 const uint32_t *tb_ptr
= v_tb_ptr
;
469 tcg_target_ulong regs
[TCG_TARGET_NB_REGS
];
470 uint64_t stack
[(TCG_STATIC_CALL_ARGS_SIZE
+ TCG_STATIC_FRAME_SIZE
)
473 regs
[TCG_AREG0
] = (tcg_target_ulong
)env
;
474 regs
[TCG_REG_CALL_STACK
] = (uintptr_t)stack
;
480 TCGReg r0
, r1
, r2
, r3
, r4
, r5
;
493 opc
= extract32(insn
, 0, 8);
498 void *call_slots
[MAX_CALL_IARGS
];
503 tci_args_nl(insn
, tb_ptr
, &len
, &ptr
);
504 func
= ((void **)ptr
)[0];
505 cif
= ((void **)ptr
)[1];
508 for (i
= s
= 0; i
< n
; ++i
) {
509 ffi_type
*t
= cif
->arg_types
[i
];
510 call_slots
[i
] = &stack
[s
];
511 s
+= DIV_ROUND_UP(t
->size
, 8);
514 /* Helper functions may need to access the "return address" */
515 tci_tb_ptr
= (uintptr_t)tb_ptr
;
516 ffi_call(cif
, func
, stack
, call_slots
);
522 case 1: /* uint32_t */
524 * The result winds up "left-aligned" in the stack[0] slot.
525 * Note that libffi has an odd special case in that it will
526 * always widen an integral result to ffi_arg.
528 if (sizeof(ffi_arg
) == 8) {
529 regs
[TCG_REG_R0
] = (uint32_t)stack
[0];
531 regs
[TCG_REG_R0
] = *(uint32_t *)stack
;
534 case 2: /* uint64_t */
536 * For TCG_TARGET_REG_BITS == 32, the register pair
537 * must stay in host memory order.
539 memcpy(®s
[TCG_REG_R0
], stack
, 8);
542 memcpy(®s
[TCG_REG_R0
], stack
, 16);
545 g_assert_not_reached();
550 tci_args_l(insn
, tb_ptr
, &ptr
);
553 case INDEX_op_setcond_i32
:
554 tci_args_rrrc(insn
, &r0
, &r1
, &r2
, &condition
);
555 regs
[r0
] = tci_compare32(regs
[r1
], regs
[r2
], condition
);
557 case INDEX_op_movcond_i32
:
558 tci_args_rrrrrc(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &condition
);
559 tmp32
= tci_compare32(regs
[r1
], regs
[r2
], condition
);
560 regs
[r0
] = regs
[tmp32
? r3
: r4
];
562 #if TCG_TARGET_REG_BITS == 32
563 case INDEX_op_setcond2_i32
:
564 tci_args_rrrrrc(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &condition
);
565 T1
= tci_uint64(regs
[r2
], regs
[r1
]);
566 T2
= tci_uint64(regs
[r4
], regs
[r3
]);
567 regs
[r0
] = tci_compare64(T1
, T2
, condition
);
569 #elif TCG_TARGET_REG_BITS == 64
570 case INDEX_op_setcond_i64
:
571 tci_args_rrrc(insn
, &r0
, &r1
, &r2
, &condition
);
572 regs
[r0
] = tci_compare64(regs
[r1
], regs
[r2
], condition
);
574 case INDEX_op_movcond_i64
:
575 tci_args_rrrrrc(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &condition
);
576 tmp32
= tci_compare64(regs
[r1
], regs
[r2
], condition
);
577 regs
[r0
] = regs
[tmp32
? r3
: r4
];
581 tci_args_rr(insn
, &r0
, &r1
);
584 case INDEX_op_tci_movi
:
585 tci_args_ri(insn
, &r0
, &t1
);
588 case INDEX_op_tci_movl
:
589 tci_args_rl(insn
, tb_ptr
, &r0
, &ptr
);
590 regs
[r0
] = *(tcg_target_ulong
*)ptr
;
593 /* Load/store operations (32 bit). */
596 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
597 ptr
= (void *)(regs
[r1
] + ofs
);
598 regs
[r0
] = *(uint8_t *)ptr
;
601 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
602 ptr
= (void *)(regs
[r1
] + ofs
);
603 regs
[r0
] = *(int8_t *)ptr
;
606 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
607 ptr
= (void *)(regs
[r1
] + ofs
);
608 regs
[r0
] = *(uint16_t *)ptr
;
611 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
612 ptr
= (void *)(regs
[r1
] + ofs
);
613 regs
[r0
] = *(int16_t *)ptr
;
615 case INDEX_op_ld_i32
:
617 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
618 ptr
= (void *)(regs
[r1
] + ofs
);
619 regs
[r0
] = *(uint32_t *)ptr
;
622 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
623 ptr
= (void *)(regs
[r1
] + ofs
);
624 *(uint8_t *)ptr
= regs
[r0
];
627 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
628 ptr
= (void *)(regs
[r1
] + ofs
);
629 *(uint16_t *)ptr
= regs
[r0
];
631 case INDEX_op_st_i32
:
633 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
634 ptr
= (void *)(regs
[r1
] + ofs
);
635 *(uint32_t *)ptr
= regs
[r0
];
638 /* Arithmetic operations (mixed 32/64 bit). */
641 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
642 regs
[r0
] = regs
[r1
] + regs
[r2
];
645 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
646 regs
[r0
] = regs
[r1
] - regs
[r2
];
649 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
650 regs
[r0
] = regs
[r1
] * regs
[r2
];
653 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
654 regs
[r0
] = regs
[r1
] & regs
[r2
];
657 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
658 regs
[r0
] = regs
[r1
] | regs
[r2
];
661 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
662 regs
[r0
] = regs
[r1
] ^ regs
[r2
];
664 #if TCG_TARGET_HAS_andc_i32 || TCG_TARGET_HAS_andc_i64
666 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
667 regs
[r0
] = regs
[r1
] & ~regs
[r2
];
670 #if TCG_TARGET_HAS_orc_i32 || TCG_TARGET_HAS_orc_i64
672 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
673 regs
[r0
] = regs
[r1
] | ~regs
[r2
];
676 #if TCG_TARGET_HAS_eqv_i32 || TCG_TARGET_HAS_eqv_i64
678 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
679 regs
[r0
] = ~(regs
[r1
] ^ regs
[r2
]);
682 #if TCG_TARGET_HAS_nand_i32 || TCG_TARGET_HAS_nand_i64
684 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
685 regs
[r0
] = ~(regs
[r1
] & regs
[r2
]);
688 #if TCG_TARGET_HAS_nor_i32 || TCG_TARGET_HAS_nor_i64
690 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
691 regs
[r0
] = ~(regs
[r1
] | regs
[r2
]);
695 /* Arithmetic operations (32 bit). */
697 case INDEX_op_div_i32
:
698 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
699 regs
[r0
] = (int32_t)regs
[r1
] / (int32_t)regs
[r2
];
701 case INDEX_op_divu_i32
:
702 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
703 regs
[r0
] = (uint32_t)regs
[r1
] / (uint32_t)regs
[r2
];
705 case INDEX_op_rem_i32
:
706 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
707 regs
[r0
] = (int32_t)regs
[r1
] % (int32_t)regs
[r2
];
709 case INDEX_op_remu_i32
:
710 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
711 regs
[r0
] = (uint32_t)regs
[r1
] % (uint32_t)regs
[r2
];
713 #if TCG_TARGET_HAS_clz_i32
714 case INDEX_op_clz_i32
:
715 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
717 regs
[r0
] = tmp32
? clz32(tmp32
) : regs
[r2
];
720 #if TCG_TARGET_HAS_ctz_i32
721 case INDEX_op_ctz_i32
:
722 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
724 regs
[r0
] = tmp32
? ctz32(tmp32
) : regs
[r2
];
727 #if TCG_TARGET_HAS_ctpop_i32
728 case INDEX_op_ctpop_i32
:
729 tci_args_rr(insn
, &r0
, &r1
);
730 regs
[r0
] = ctpop32(regs
[r1
]);
734 /* Shift/rotate operations (32 bit). */
736 case INDEX_op_shl_i32
:
737 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
738 regs
[r0
] = (uint32_t)regs
[r1
] << (regs
[r2
] & 31);
740 case INDEX_op_shr_i32
:
741 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
742 regs
[r0
] = (uint32_t)regs
[r1
] >> (regs
[r2
] & 31);
744 case INDEX_op_sar_i32
:
745 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
746 regs
[r0
] = (int32_t)regs
[r1
] >> (regs
[r2
] & 31);
748 #if TCG_TARGET_HAS_rot_i32
749 case INDEX_op_rotl_i32
:
750 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
751 regs
[r0
] = rol32(regs
[r1
], regs
[r2
] & 31);
753 case INDEX_op_rotr_i32
:
754 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
755 regs
[r0
] = ror32(regs
[r1
], regs
[r2
] & 31);
758 #if TCG_TARGET_HAS_deposit_i32
759 case INDEX_op_deposit_i32
:
760 tci_args_rrrbb(insn
, &r0
, &r1
, &r2
, &pos
, &len
);
761 regs
[r0
] = deposit32(regs
[r1
], pos
, len
, regs
[r2
]);
764 #if TCG_TARGET_HAS_extract_i32
765 case INDEX_op_extract_i32
:
766 tci_args_rrbb(insn
, &r0
, &r1
, &pos
, &len
);
767 regs
[r0
] = extract32(regs
[r1
], pos
, len
);
770 #if TCG_TARGET_HAS_sextract_i32
771 case INDEX_op_sextract_i32
:
772 tci_args_rrbb(insn
, &r0
, &r1
, &pos
, &len
);
773 regs
[r0
] = sextract32(regs
[r1
], pos
, len
);
776 case INDEX_op_brcond_i32
:
777 tci_args_rl(insn
, tb_ptr
, &r0
, &ptr
);
778 if ((uint32_t)regs
[r0
]) {
782 #if TCG_TARGET_REG_BITS == 32 || TCG_TARGET_HAS_add2_i32
783 case INDEX_op_add2_i32
:
784 tci_args_rrrrrr(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &r5
);
785 T1
= tci_uint64(regs
[r3
], regs
[r2
]);
786 T2
= tci_uint64(regs
[r5
], regs
[r4
]);
787 tci_write_reg64(regs
, r1
, r0
, T1
+ T2
);
790 #if TCG_TARGET_REG_BITS == 32 || TCG_TARGET_HAS_sub2_i32
791 case INDEX_op_sub2_i32
:
792 tci_args_rrrrrr(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &r5
);
793 T1
= tci_uint64(regs
[r3
], regs
[r2
]);
794 T2
= tci_uint64(regs
[r5
], regs
[r4
]);
795 tci_write_reg64(regs
, r1
, r0
, T1
- T2
);
798 #if TCG_TARGET_HAS_mulu2_i32
799 case INDEX_op_mulu2_i32
:
800 tci_args_rrrr(insn
, &r0
, &r1
, &r2
, &r3
);
801 tmp64
= (uint64_t)(uint32_t)regs
[r2
] * (uint32_t)regs
[r3
];
802 tci_write_reg64(regs
, r1
, r0
, tmp64
);
805 #if TCG_TARGET_HAS_muls2_i32
806 case INDEX_op_muls2_i32
:
807 tci_args_rrrr(insn
, &r0
, &r1
, &r2
, &r3
);
808 tmp64
= (int64_t)(int32_t)regs
[r2
] * (int32_t)regs
[r3
];
809 tci_write_reg64(regs
, r1
, r0
, tmp64
);
812 #if TCG_TARGET_HAS_ext8s_i32 || TCG_TARGET_HAS_ext8s_i64
814 tci_args_rr(insn
, &r0
, &r1
);
815 regs
[r0
] = (int8_t)regs
[r1
];
818 #if TCG_TARGET_HAS_ext16s_i32 || TCG_TARGET_HAS_ext16s_i64 || \
819 TCG_TARGET_HAS_bswap16_i32 || TCG_TARGET_HAS_bswap16_i64
821 tci_args_rr(insn
, &r0
, &r1
);
822 regs
[r0
] = (int16_t)regs
[r1
];
825 #if TCG_TARGET_HAS_ext8u_i32 || TCG_TARGET_HAS_ext8u_i64
827 tci_args_rr(insn
, &r0
, &r1
);
828 regs
[r0
] = (uint8_t)regs
[r1
];
831 #if TCG_TARGET_HAS_ext16u_i32 || TCG_TARGET_HAS_ext16u_i64
833 tci_args_rr(insn
, &r0
, &r1
);
834 regs
[r0
] = (uint16_t)regs
[r1
];
837 #if TCG_TARGET_HAS_bswap16_i32 || TCG_TARGET_HAS_bswap16_i64
839 tci_args_rr(insn
, &r0
, &r1
);
840 regs
[r0
] = bswap16(regs
[r1
]);
843 #if TCG_TARGET_HAS_bswap32_i32 || TCG_TARGET_HAS_bswap32_i64
845 tci_args_rr(insn
, &r0
, &r1
);
846 regs
[r0
] = bswap32(regs
[r1
]);
849 #if TCG_TARGET_HAS_not_i32 || TCG_TARGET_HAS_not_i64
851 tci_args_rr(insn
, &r0
, &r1
);
852 regs
[r0
] = ~regs
[r1
];
855 #if TCG_TARGET_HAS_neg_i32 || TCG_TARGET_HAS_neg_i64
857 tci_args_rr(insn
, &r0
, &r1
);
858 regs
[r0
] = -regs
[r1
];
861 #if TCG_TARGET_REG_BITS == 64
862 /* Load/store operations (64 bit). */
864 case INDEX_op_ld32s_i64
:
865 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
866 ptr
= (void *)(regs
[r1
] + ofs
);
867 regs
[r0
] = *(int32_t *)ptr
;
869 case INDEX_op_ld_i64
:
870 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
871 ptr
= (void *)(regs
[r1
] + ofs
);
872 regs
[r0
] = *(uint64_t *)ptr
;
874 case INDEX_op_st_i64
:
875 tci_args_rrs(insn
, &r0
, &r1
, &ofs
);
876 ptr
= (void *)(regs
[r1
] + ofs
);
877 *(uint64_t *)ptr
= regs
[r0
];
880 /* Arithmetic operations (64 bit). */
882 case INDEX_op_div_i64
:
883 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
884 regs
[r0
] = (int64_t)regs
[r1
] / (int64_t)regs
[r2
];
886 case INDEX_op_divu_i64
:
887 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
888 regs
[r0
] = (uint64_t)regs
[r1
] / (uint64_t)regs
[r2
];
890 case INDEX_op_rem_i64
:
891 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
892 regs
[r0
] = (int64_t)regs
[r1
] % (int64_t)regs
[r2
];
894 case INDEX_op_remu_i64
:
895 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
896 regs
[r0
] = (uint64_t)regs
[r1
] % (uint64_t)regs
[r2
];
898 #if TCG_TARGET_HAS_clz_i64
899 case INDEX_op_clz_i64
:
900 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
901 regs
[r0
] = regs
[r1
] ? clz64(regs
[r1
]) : regs
[r2
];
904 #if TCG_TARGET_HAS_ctz_i64
905 case INDEX_op_ctz_i64
:
906 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
907 regs
[r0
] = regs
[r1
] ? ctz64(regs
[r1
]) : regs
[r2
];
910 #if TCG_TARGET_HAS_ctpop_i64
911 case INDEX_op_ctpop_i64
:
912 tci_args_rr(insn
, &r0
, &r1
);
913 regs
[r0
] = ctpop64(regs
[r1
]);
916 #if TCG_TARGET_HAS_mulu2_i64
917 case INDEX_op_mulu2_i64
:
918 tci_args_rrrr(insn
, &r0
, &r1
, &r2
, &r3
);
919 mulu64(®s
[r0
], ®s
[r1
], regs
[r2
], regs
[r3
]);
922 #if TCG_TARGET_HAS_muls2_i64
923 case INDEX_op_muls2_i64
:
924 tci_args_rrrr(insn
, &r0
, &r1
, &r2
, &r3
);
925 muls64(®s
[r0
], ®s
[r1
], regs
[r2
], regs
[r3
]);
928 #if TCG_TARGET_HAS_add2_i64
929 case INDEX_op_add2_i64
:
930 tci_args_rrrrrr(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &r5
);
931 T1
= regs
[r2
] + regs
[r4
];
932 T2
= regs
[r3
] + regs
[r5
] + (T1
< regs
[r2
]);
937 #if TCG_TARGET_HAS_add2_i64
938 case INDEX_op_sub2_i64
:
939 tci_args_rrrrrr(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &r5
);
940 T1
= regs
[r2
] - regs
[r4
];
941 T2
= regs
[r3
] - regs
[r5
] - (regs
[r2
] < regs
[r4
]);
947 /* Shift/rotate operations (64 bit). */
949 case INDEX_op_shl_i64
:
950 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
951 regs
[r0
] = regs
[r1
] << (regs
[r2
] & 63);
953 case INDEX_op_shr_i64
:
954 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
955 regs
[r0
] = regs
[r1
] >> (regs
[r2
] & 63);
957 case INDEX_op_sar_i64
:
958 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
959 regs
[r0
] = (int64_t)regs
[r1
] >> (regs
[r2
] & 63);
961 #if TCG_TARGET_HAS_rot_i64
962 case INDEX_op_rotl_i64
:
963 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
964 regs
[r0
] = rol64(regs
[r1
], regs
[r2
] & 63);
966 case INDEX_op_rotr_i64
:
967 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
968 regs
[r0
] = ror64(regs
[r1
], regs
[r2
] & 63);
971 #if TCG_TARGET_HAS_deposit_i64
972 case INDEX_op_deposit_i64
:
973 tci_args_rrrbb(insn
, &r0
, &r1
, &r2
, &pos
, &len
);
974 regs
[r0
] = deposit64(regs
[r1
], pos
, len
, regs
[r2
]);
977 #if TCG_TARGET_HAS_extract_i64
978 case INDEX_op_extract_i64
:
979 tci_args_rrbb(insn
, &r0
, &r1
, &pos
, &len
);
980 regs
[r0
] = extract64(regs
[r1
], pos
, len
);
983 #if TCG_TARGET_HAS_sextract_i64
984 case INDEX_op_sextract_i64
:
985 tci_args_rrbb(insn
, &r0
, &r1
, &pos
, &len
);
986 regs
[r0
] = sextract64(regs
[r1
], pos
, len
);
989 case INDEX_op_brcond_i64
:
990 tci_args_rl(insn
, tb_ptr
, &r0
, &ptr
);
995 case INDEX_op_ext32s_i64
:
996 case INDEX_op_ext_i32_i64
:
997 tci_args_rr(insn
, &r0
, &r1
);
998 regs
[r0
] = (int32_t)regs
[r1
];
1000 case INDEX_op_ext32u_i64
:
1001 case INDEX_op_extu_i32_i64
:
1002 tci_args_rr(insn
, &r0
, &r1
);
1003 regs
[r0
] = (uint32_t)regs
[r1
];
1005 #if TCG_TARGET_HAS_bswap64_i64
1006 case INDEX_op_bswap64_i64
:
1007 tci_args_rr(insn
, &r0
, &r1
);
1008 regs
[r0
] = bswap64(regs
[r1
]);
1011 #endif /* TCG_TARGET_REG_BITS == 64 */
1013 /* QEMU specific operations. */
1015 case INDEX_op_exit_tb
:
1016 tci_args_l(insn
, tb_ptr
, &ptr
);
1017 return (uintptr_t)ptr
;
1019 case INDEX_op_goto_tb
:
1020 tci_args_l(insn
, tb_ptr
, &ptr
);
1021 tb_ptr
= *(void **)ptr
;
1024 case INDEX_op_goto_ptr
:
1025 tci_args_r(insn
, &r0
);
1026 ptr
= (void *)regs
[r0
];
1033 case INDEX_op_qemu_ld_i32
:
1034 if (TARGET_LONG_BITS
<= TCG_TARGET_REG_BITS
) {
1035 tci_args_rrm(insn
, &r0
, &r1
, &oi
);
1038 tci_args_rrrm(insn
, &r0
, &r1
, &r2
, &oi
);
1039 taddr
= tci_uint64(regs
[r2
], regs
[r1
]);
1041 tmp32
= tci_qemu_ld(env
, taddr
, oi
, tb_ptr
);
1045 case INDEX_op_qemu_ld_i64
:
1046 if (TCG_TARGET_REG_BITS
== 64) {
1047 tci_args_rrm(insn
, &r0
, &r1
, &oi
);
1049 } else if (TARGET_LONG_BITS
<= TCG_TARGET_REG_BITS
) {
1050 tci_args_rrrm(insn
, &r0
, &r1
, &r2
, &oi
);
1053 tci_args_rrrrr(insn
, &r0
, &r1
, &r2
, &r3
, &r4
);
1054 taddr
= tci_uint64(regs
[r3
], regs
[r2
]);
1057 tmp64
= tci_qemu_ld(env
, taddr
, oi
, tb_ptr
);
1058 if (TCG_TARGET_REG_BITS
== 32) {
1059 tci_write_reg64(regs
, r1
, r0
, tmp64
);
1065 case INDEX_op_qemu_st_i32
:
1066 if (TARGET_LONG_BITS
<= TCG_TARGET_REG_BITS
) {
1067 tci_args_rrm(insn
, &r0
, &r1
, &oi
);
1070 tci_args_rrrm(insn
, &r0
, &r1
, &r2
, &oi
);
1071 taddr
= tci_uint64(regs
[r2
], regs
[r1
]);
1074 tci_qemu_st(env
, taddr
, tmp32
, oi
, tb_ptr
);
1077 case INDEX_op_qemu_st_i64
:
1078 if (TCG_TARGET_REG_BITS
== 64) {
1079 tci_args_rrm(insn
, &r0
, &r1
, &oi
);
1083 if (TARGET_LONG_BITS
<= TCG_TARGET_REG_BITS
) {
1084 tci_args_rrrm(insn
, &r0
, &r1
, &r2
, &oi
);
1087 tci_args_rrrrr(insn
, &r0
, &r1
, &r2
, &r3
, &r4
);
1088 taddr
= tci_uint64(regs
[r3
], regs
[r2
]);
1091 tmp64
= tci_uint64(regs
[r1
], regs
[r0
]);
1093 tci_qemu_st(env
, taddr
, tmp64
, oi
, tb_ptr
);
1097 /* Ensure ordering for all kinds */
1101 g_assert_not_reached();
1107 * Disassembler that matches the interpreter
1110 static const char *str_r(TCGReg r
)
1112 static const char regs
[TCG_TARGET_NB_REGS
][4] = {
1113 "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
1114 "r8", "r9", "r10", "r11", "r12", "r13", "env", "sp"
1117 QEMU_BUILD_BUG_ON(TCG_AREG0
!= TCG_REG_R14
);
1118 QEMU_BUILD_BUG_ON(TCG_REG_CALL_STACK
!= TCG_REG_R15
);
1120 assert((unsigned)r
< TCG_TARGET_NB_REGS
);
1124 static const char *str_c(TCGCond c
)
1126 static const char cond
[16][8] = {
1127 [TCG_COND_NEVER
] = "never",
1128 [TCG_COND_ALWAYS
] = "always",
1129 [TCG_COND_EQ
] = "eq",
1130 [TCG_COND_NE
] = "ne",
1131 [TCG_COND_LT
] = "lt",
1132 [TCG_COND_GE
] = "ge",
1133 [TCG_COND_LE
] = "le",
1134 [TCG_COND_GT
] = "gt",
1135 [TCG_COND_LTU
] = "ltu",
1136 [TCG_COND_GEU
] = "geu",
1137 [TCG_COND_LEU
] = "leu",
1138 [TCG_COND_GTU
] = "gtu",
1141 assert((unsigned)c
< ARRAY_SIZE(cond
));
1142 assert(cond
[c
][0] != 0);
1146 /* Disassemble TCI bytecode. */
1147 int print_insn_tci(bfd_vma addr
, disassemble_info
*info
)
1149 const uint32_t *tb_ptr
= (const void *)(uintptr_t)addr
;
1150 const TCGOpDef
*def
;
1151 const char *op_name
;
1154 TCGReg r0
, r1
, r2
, r3
, r4
, r5
;
1155 tcg_target_ulong i1
;
1162 /* TCI is always the host, so we don't need to load indirect. */
1165 info
->fprintf_func(info
->stream
, "%08x ", insn
);
1167 op
= extract32(insn
, 0, 8);
1168 def
= &tcg_op_defs
[op
];
1169 op_name
= def
->name
;
1173 case INDEX_op_exit_tb
:
1174 case INDEX_op_goto_tb
:
1175 tci_args_l(insn
, tb_ptr
, &ptr
);
1176 info
->fprintf_func(info
->stream
, "%-12s %p", op_name
, ptr
);
1179 case INDEX_op_goto_ptr
:
1180 tci_args_r(insn
, &r0
);
1181 info
->fprintf_func(info
->stream
, "%-12s %s", op_name
, str_r(r0
));
1185 tci_args_nl(insn
, tb_ptr
, &len
, &ptr
);
1186 info
->fprintf_func(info
->stream
, "%-12s %d, %p", op_name
, len
, ptr
);
1189 case INDEX_op_brcond_i32
:
1190 case INDEX_op_brcond_i64
:
1191 tci_args_rl(insn
, tb_ptr
, &r0
, &ptr
);
1192 info
->fprintf_func(info
->stream
, "%-12s %s, 0, ne, %p",
1193 op_name
, str_r(r0
), ptr
);
1196 case INDEX_op_setcond_i32
:
1197 case INDEX_op_setcond_i64
:
1198 tci_args_rrrc(insn
, &r0
, &r1
, &r2
, &c
);
1199 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %s, %s",
1200 op_name
, str_r(r0
), str_r(r1
), str_r(r2
), str_c(c
));
1203 case INDEX_op_tci_movi
:
1204 tci_args_ri(insn
, &r0
, &i1
);
1205 info
->fprintf_func(info
->stream
, "%-12s %s, 0x%" TCG_PRIlx
,
1206 op_name
, str_r(r0
), i1
);
1209 case INDEX_op_tci_movl
:
1210 tci_args_rl(insn
, tb_ptr
, &r0
, &ptr
);
1211 info
->fprintf_func(info
->stream
, "%-12s %s, %p",
1212 op_name
, str_r(r0
), ptr
);
1215 case INDEX_op_ld8u_i32
:
1216 case INDEX_op_ld8u_i64
:
1217 case INDEX_op_ld8s_i32
:
1218 case INDEX_op_ld8s_i64
:
1219 case INDEX_op_ld16u_i32
:
1220 case INDEX_op_ld16u_i64
:
1221 case INDEX_op_ld16s_i32
:
1222 case INDEX_op_ld16s_i64
:
1223 case INDEX_op_ld32u_i64
:
1224 case INDEX_op_ld32s_i64
:
1225 case INDEX_op_ld_i32
:
1226 case INDEX_op_ld_i64
:
1227 case INDEX_op_st8_i32
:
1228 case INDEX_op_st8_i64
:
1229 case INDEX_op_st16_i32
:
1230 case INDEX_op_st16_i64
:
1231 case INDEX_op_st32_i64
:
1232 case INDEX_op_st_i32
:
1233 case INDEX_op_st_i64
:
1234 tci_args_rrs(insn
, &r0
, &r1
, &s2
);
1235 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %d",
1236 op_name
, str_r(r0
), str_r(r1
), s2
);
1239 case INDEX_op_mov_i32
:
1240 case INDEX_op_mov_i64
:
1241 case INDEX_op_ext8s_i32
:
1242 case INDEX_op_ext8s_i64
:
1243 case INDEX_op_ext8u_i32
:
1244 case INDEX_op_ext8u_i64
:
1245 case INDEX_op_ext16s_i32
:
1246 case INDEX_op_ext16s_i64
:
1247 case INDEX_op_ext16u_i32
:
1248 case INDEX_op_ext32s_i64
:
1249 case INDEX_op_ext32u_i64
:
1250 case INDEX_op_ext_i32_i64
:
1251 case INDEX_op_extu_i32_i64
:
1252 case INDEX_op_bswap16_i32
:
1253 case INDEX_op_bswap16_i64
:
1254 case INDEX_op_bswap32_i32
:
1255 case INDEX_op_bswap32_i64
:
1256 case INDEX_op_bswap64_i64
:
1257 case INDEX_op_not_i32
:
1258 case INDEX_op_not_i64
:
1259 case INDEX_op_neg_i32
:
1260 case INDEX_op_neg_i64
:
1261 case INDEX_op_ctpop_i32
:
1262 case INDEX_op_ctpop_i64
:
1263 tci_args_rr(insn
, &r0
, &r1
);
1264 info
->fprintf_func(info
->stream
, "%-12s %s, %s",
1265 op_name
, str_r(r0
), str_r(r1
));
1268 case INDEX_op_add_i32
:
1269 case INDEX_op_add_i64
:
1270 case INDEX_op_sub_i32
:
1271 case INDEX_op_sub_i64
:
1272 case INDEX_op_mul_i32
:
1273 case INDEX_op_mul_i64
:
1274 case INDEX_op_and_i32
:
1275 case INDEX_op_and_i64
:
1276 case INDEX_op_or_i32
:
1277 case INDEX_op_or_i64
:
1278 case INDEX_op_xor_i32
:
1279 case INDEX_op_xor_i64
:
1280 case INDEX_op_andc_i32
:
1281 case INDEX_op_andc_i64
:
1282 case INDEX_op_orc_i32
:
1283 case INDEX_op_orc_i64
:
1284 case INDEX_op_eqv_i32
:
1285 case INDEX_op_eqv_i64
:
1286 case INDEX_op_nand_i32
:
1287 case INDEX_op_nand_i64
:
1288 case INDEX_op_nor_i32
:
1289 case INDEX_op_nor_i64
:
1290 case INDEX_op_div_i32
:
1291 case INDEX_op_div_i64
:
1292 case INDEX_op_rem_i32
:
1293 case INDEX_op_rem_i64
:
1294 case INDEX_op_divu_i32
:
1295 case INDEX_op_divu_i64
:
1296 case INDEX_op_remu_i32
:
1297 case INDEX_op_remu_i64
:
1298 case INDEX_op_shl_i32
:
1299 case INDEX_op_shl_i64
:
1300 case INDEX_op_shr_i32
:
1301 case INDEX_op_shr_i64
:
1302 case INDEX_op_sar_i32
:
1303 case INDEX_op_sar_i64
:
1304 case INDEX_op_rotl_i32
:
1305 case INDEX_op_rotl_i64
:
1306 case INDEX_op_rotr_i32
:
1307 case INDEX_op_rotr_i64
:
1308 case INDEX_op_clz_i32
:
1309 case INDEX_op_clz_i64
:
1310 case INDEX_op_ctz_i32
:
1311 case INDEX_op_ctz_i64
:
1312 tci_args_rrr(insn
, &r0
, &r1
, &r2
);
1313 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %s",
1314 op_name
, str_r(r0
), str_r(r1
), str_r(r2
));
1317 case INDEX_op_deposit_i32
:
1318 case INDEX_op_deposit_i64
:
1319 tci_args_rrrbb(insn
, &r0
, &r1
, &r2
, &pos
, &len
);
1320 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %s, %d, %d",
1321 op_name
, str_r(r0
), str_r(r1
), str_r(r2
), pos
, len
);
1324 case INDEX_op_extract_i32
:
1325 case INDEX_op_extract_i64
:
1326 case INDEX_op_sextract_i32
:
1327 case INDEX_op_sextract_i64
:
1328 tci_args_rrbb(insn
, &r0
, &r1
, &pos
, &len
);
1329 info
->fprintf_func(info
->stream
, "%-12s %s,%s,%d,%d",
1330 op_name
, str_r(r0
), str_r(r1
), pos
, len
);
1333 case INDEX_op_movcond_i32
:
1334 case INDEX_op_movcond_i64
:
1335 case INDEX_op_setcond2_i32
:
1336 tci_args_rrrrrc(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &c
);
1337 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %s, %s, %s, %s",
1338 op_name
, str_r(r0
), str_r(r1
), str_r(r2
),
1339 str_r(r3
), str_r(r4
), str_c(c
));
1342 case INDEX_op_mulu2_i32
:
1343 case INDEX_op_mulu2_i64
:
1344 case INDEX_op_muls2_i32
:
1345 case INDEX_op_muls2_i64
:
1346 tci_args_rrrr(insn
, &r0
, &r1
, &r2
, &r3
);
1347 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %s, %s",
1348 op_name
, str_r(r0
), str_r(r1
),
1349 str_r(r2
), str_r(r3
));
1352 case INDEX_op_add2_i32
:
1353 case INDEX_op_add2_i64
:
1354 case INDEX_op_sub2_i32
:
1355 case INDEX_op_sub2_i64
:
1356 tci_args_rrrrrr(insn
, &r0
, &r1
, &r2
, &r3
, &r4
, &r5
);
1357 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %s, %s, %s, %s",
1358 op_name
, str_r(r0
), str_r(r1
), str_r(r2
),
1359 str_r(r3
), str_r(r4
), str_r(r5
));
1362 case INDEX_op_qemu_ld_i64
:
1363 case INDEX_op_qemu_st_i64
:
1364 len
= DIV_ROUND_UP(64, TCG_TARGET_REG_BITS
);
1366 case INDEX_op_qemu_ld_i32
:
1367 case INDEX_op_qemu_st_i32
:
1370 len
+= DIV_ROUND_UP(TARGET_LONG_BITS
, TCG_TARGET_REG_BITS
);
1373 tci_args_rrm(insn
, &r0
, &r1
, &oi
);
1374 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %x",
1375 op_name
, str_r(r0
), str_r(r1
), oi
);
1378 tci_args_rrrm(insn
, &r0
, &r1
, &r2
, &oi
);
1379 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %s, %x",
1380 op_name
, str_r(r0
), str_r(r1
), str_r(r2
), oi
);
1383 tci_args_rrrrr(insn
, &r0
, &r1
, &r2
, &r3
, &r4
);
1384 info
->fprintf_func(info
->stream
, "%-12s %s, %s, %s, %s, %s",
1385 op_name
, str_r(r0
), str_r(r1
),
1386 str_r(r2
), str_r(r3
), str_r(r4
));
1389 g_assert_not_reached();
1394 /* tcg_out_nop_fill uses zeros */
1396 info
->fprintf_func(info
->stream
, "align");
1402 info
->fprintf_func(info
->stream
, "illegal opcode %d", op
);
1406 return sizeof(insn
);