[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 07/13] tcg/i386: implement goto_ptr op
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [PATCH v2 07/13] tcg/i386: implement goto_ptr op |
Date: |
Tue, 25 Apr 2017 03:53:53 -0400 |
Signed-off-by: Emilio G. Cota <address@hidden>
---
tcg/i386/tcg-target.h | 2 +-
tcg/i386/tcg-target.inc.c | 13 +++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h
index 59d9835..73a15f7 100644
--- a/tcg/i386/tcg-target.h
+++ b/tcg/i386/tcg-target.h
@@ -107,7 +107,7 @@ extern bool have_popcnt;
#define TCG_TARGET_HAS_muls2_i32 1
#define TCG_TARGET_HAS_muluh_i32 0
#define TCG_TARGET_HAS_mulsh_i32 0
-#define TCG_TARGET_HAS_goto_ptr 0
+#define TCG_TARGET_HAS_goto_ptr 1
#if TCG_TARGET_REG_BITS == 64
#define TCG_TARGET_HAS_extrl_i64_i32 0
diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c
index 5918008..f6fb03e 100644
--- a/tcg/i386/tcg-target.inc.c
+++ b/tcg/i386/tcg-target.inc.c
@@ -1906,6 +1906,14 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode
opc,
}
s->tb_jmp_reset_offset[a0] = tcg_current_code_size(s);
break;
+ case INDEX_op_goto_ptr:
+ /* save target address into new register */
+ tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_EDX, a0);
+ /* set return value to 0 */
+ tgen_arithr(s, ARITH_XOR, TCG_REG_EAX, TCG_REG_EAX);
+ /* jmp to the target address (could be epilogue) */
+ tcg_out_modrm(s, OPC_GRP5, EXT5_JMPN_Ev, TCG_REG_EDX);
+ break;
case INDEX_op_br:
tcg_out_jxx(s, JCC_JMP, arg_label(a0), 0);
break;
@@ -2277,6 +2285,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode
opc,
static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op)
{
+ static const TCGTargetOpDef ri = { .args_ct_str = { "ri" } };
static const TCGTargetOpDef ri_r = { .args_ct_str = { "ri", "r" } };
static const TCGTargetOpDef re_r = { .args_ct_str = { "re", "r" } };
static const TCGTargetOpDef qi_r = { .args_ct_str = { "qi", "r" } };
@@ -2324,6 +2333,9 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode
op)
case INDEX_op_st_i64:
return &re_r;
+ case INDEX_op_goto_ptr:
+ return &ri;
+
case INDEX_op_add_i32:
case INDEX_op_add_i64:
return &r_r_re;
@@ -2569,6 +2581,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
/* TB epilogue */
tb_ret_addr = s->code_ptr;
+ s->code_gen_epilogue = s->code_ptr;
tcg_out_addi(s, TCG_REG_CALL_STACK, stack_addend);
--
2.7.4
- [Qemu-devel] [PATCH v2 00/13] TCG optimizations for 2.10, Emilio G. Cota, 2017/04/25
- [Qemu-devel] [PATCH v2 03/13] tcg: enforce 64-byte alignment of TCGContext, Emilio G. Cota, 2017/04/25
- [Qemu-devel] [PATCH v2 01/13] exec-all: add tb_from_jmp_cache, Emilio G. Cota, 2017/04/25
- [Qemu-devel] [PATCH v2 07/13] tcg/i386: implement goto_ptr op,
Emilio G. Cota <=
- [Qemu-devel] [PATCH v2 02/13] exec-all: inline tb_from_jmp_cache, Emilio G. Cota, 2017/04/25
- [Qemu-devel] [PATCH v2 08/13] target/arm: optimize cross-page block chaining in softmmu, Emilio G. Cota, 2017/04/25
- [Qemu-devel] [PATCH v2 11/13] target/i386: optimize cross-page direct jumps in softmmu, Emilio G. Cota, 2017/04/25
- [Qemu-devel] [PATCH v2 05/13] tcg-runtime: add lookup_tb_ptr helper, Emilio G. Cota, 2017/04/25