mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-07-07 12:00:39 +00:00
tcg/mips: implement goto_ptr
Backports commit 5786e0683c4f8170dd05a550814b8809d8ae6d86 from qemu
This commit is contained in:
parent
1d6c4f1a42
commit
0e9d3d1943
|
@ -130,7 +130,7 @@ extern bool use_mips32r2_instructions;
|
||||||
#define TCG_TARGET_HAS_muluh_i32 1
|
#define TCG_TARGET_HAS_muluh_i32 1
|
||||||
#define TCG_TARGET_HAS_mulsh_i32 1
|
#define TCG_TARGET_HAS_mulsh_i32 1
|
||||||
#define TCG_TARGET_HAS_bswap32_i32 1
|
#define TCG_TARGET_HAS_bswap32_i32 1
|
||||||
#define TCG_TARGET_HAS_goto_ptr 0
|
#define TCG_TARGET_HAS_goto_ptr 1
|
||||||
|
|
||||||
#if TCG_TARGET_REG_BITS == 64
|
#if TCG_TARGET_REG_BITS == 64
|
||||||
#define TCG_TARGET_HAS_add2_i32 0
|
#define TCG_TARGET_HAS_add2_i32 0
|
||||||
|
|
|
@ -1761,6 +1761,11 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
|
||||||
tcg_out_nop(s);
|
tcg_out_nop(s);
|
||||||
s->tb_jmp_reset_offset[a0] = tcg_current_code_size(s);
|
s->tb_jmp_reset_offset[a0] = tcg_current_code_size(s);
|
||||||
break;
|
break;
|
||||||
|
case INDEX_op_goto_ptr:
|
||||||
|
/* jmp to the given host address (could be epilogue) */
|
||||||
|
tcg_out_opc_reg(s, OPC_JR, 0, a0, 0);
|
||||||
|
tcg_out_nop(s);
|
||||||
|
break;
|
||||||
case INDEX_op_br:
|
case INDEX_op_br:
|
||||||
tcg_out_brcond(s, TCG_COND_EQ, TCG_REG_ZERO, TCG_REG_ZERO,
|
tcg_out_brcond(s, TCG_COND_EQ, TCG_REG_ZERO, TCG_REG_ZERO,
|
||||||
arg_label(s, a0));
|
arg_label(s, a0));
|
||||||
|
@ -2175,6 +2180,7 @@ static const TCGTargetOpDef mips_op_defs[] = {
|
||||||
{ INDEX_op_exit_tb, { } },
|
{ INDEX_op_exit_tb, { } },
|
||||||
{ INDEX_op_goto_tb, { } },
|
{ INDEX_op_goto_tb, { } },
|
||||||
{ INDEX_op_br, { } },
|
{ INDEX_op_br, { } },
|
||||||
|
{ INDEX_op_goto_ptr, { "r" } },
|
||||||
|
|
||||||
{ INDEX_op_ld8u_i32, { "r", "r" } },
|
{ INDEX_op_ld8u_i32, { "r", "r" } },
|
||||||
{ INDEX_op_ld8s_i32, { "r", "r" } },
|
{ INDEX_op_ld8s_i32, { "r", "r" } },
|
||||||
|
@ -2466,6 +2472,13 @@ static void tcg_target_qemu_prologue(TCGContext *s)
|
||||||
/* delay slot */
|
/* delay slot */
|
||||||
tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]);
|
tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return path for goto_ptr. Set return value to 0, a-la exit_tb,
|
||||||
|
* and fall through to the rest of the epilogue.
|
||||||
|
*/
|
||||||
|
s->code_gen_epilogue = s->code_ptr;
|
||||||
|
tcg_out_mov(s, TCG_TYPE_REG, TCG_REG_V0, TCG_REG_ZERO);
|
||||||
|
|
||||||
/* TB epilogue */
|
/* TB epilogue */
|
||||||
tb_ret_addr = s->code_ptr;
|
tb_ret_addr = s->code_ptr;
|
||||||
for (i = 0; i < ARRAY_SIZE(tcg_target_callee_save_regs); i++) {
|
for (i = 0; i < ARRAY_SIZE(tcg_target_callee_save_regs); i++) {
|
||||||
|
|
Loading…
Reference in a new issue