[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 15/26] tci: Define TCG_TARGET_INSN_UNIT_SIZE
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PULL 15/26] tci: Define TCG_TARGET_INSN_UNIT_SIZE |
Date: |
Mon, 12 May 2014 16:31:03 -0700 |
And use tcg pointer differencing functions as appropriate.
Reviewed-by: Peter Maydell <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
---
tcg/tci/tcg-target.c | 19 +++++++++++++------
tcg/tci/tcg-target.h | 1 +
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/tcg/tci/tcg-target.c b/tcg/tci/tcg-target.c
index 47c0b85..6123f9f 100644
--- a/tcg/tci/tcg-target.c
+++ b/tcg/tci/tcg-target.c
@@ -371,14 +371,18 @@ static const char *const
tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
};
#endif
-static void patch_reloc(uint8_t *code_ptr, int type,
+static void patch_reloc(tcg_insn_unit *code_ptr, int type,
intptr_t value, intptr_t addend)
{
/* tcg_out_reloc always uses the same type, addend. */
assert(type == sizeof(tcg_target_long));
assert(addend == 0);
assert(value != 0);
- *(tcg_target_long *)code_ptr = value;
+ if (TCG_TARGET_REG_BITS == 32) {
+ tcg_patch32(code_ptr, value);
+ } else {
+ tcg_patch64(code_ptr, value);
+ }
}
/* Parse target specific constraints. */
@@ -413,8 +417,11 @@ void tci_disas(uint8_t opc)
/* Write value (native size). */
static void tcg_out_i(TCGContext *s, tcg_target_ulong v)
{
- *(tcg_target_ulong *)s->code_ptr = v;
- s->code_ptr += sizeof(tcg_target_ulong);
+ if (TCG_TARGET_REG_BITS == 32) {
+ tcg_out32(s, v);
+ } else {
+ tcg_out64(s, v);
+ }
}
/* Write opcode. */
@@ -557,14 +564,14 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc,
const TCGArg *args,
if (s->tb_jmp_offset) {
/* Direct jump method. */
assert(args[0] < ARRAY_SIZE(s->tb_jmp_offset));
- s->tb_jmp_offset[args[0]] = s->code_ptr - s->code_buf;
+ s->tb_jmp_offset[args[0]] = tcg_current_code_size(s);
tcg_out32(s, 0);
} else {
/* Indirect jump method. */
TODO();
}
assert(args[0] < ARRAY_SIZE(s->tb_next_offset));
- s->tb_next_offset[args[0]] = s->code_ptr - s->code_buf;
+ s->tb_next_offset[args[0]] = tcg_current_code_size(s);
break;
case INDEX_op_br:
tci_out_label(s, args[0]);
diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h
index 37719e8..0be5acd 100644
--- a/tcg/tci/tcg-target.h
+++ b/tcg/tci/tcg-target.h
@@ -43,6 +43,7 @@
#include "config-host.h"
#define TCG_TARGET_INTERPRETER 1
+#define TCG_TARGET_INSN_UNIT_SIZE 1
#if UINTPTR_MAX == UINT32_MAX
# define TCG_TARGET_REG_BITS 32
--
1.9.0
- [Qemu-devel] [PULL 20/26] tcg-ppc64: Rename tcg_out_calli to tcg_out_call, (continued)
- [Qemu-devel] [PULL 20/26] tcg-ppc64: Rename tcg_out_calli to tcg_out_call, Richard Henderson, 2014/05/12
- [Qemu-devel] [PULL 21/26] tcg-sparc: Create tcg_out_call, Richard Henderson, 2014/05/12
- [Qemu-devel] [PULL 22/26] tcg-mips: Split out tcg_out_call, Richard Henderson, 2014/05/12
- [Qemu-devel] [PULL 24/26] tcg: Make call address a constant parameter, Richard Henderson, 2014/05/12
- [Qemu-devel] [PULL 23/26] tci: Create tcg_out_call, Richard Henderson, 2014/05/12
- [Qemu-devel] [PULL 25/26] tcg: Use tcg_target_available_regs in tcg_reg_alloc_mov, Richard Henderson, 2014/05/12
- [Qemu-devel] [PULL 26/26] tcg: Remove unreachable code in tcg_out_op and op_defs, Richard Henderson, 2014/05/12
- [Qemu-devel] [PULL 12/26] tcg-s390: Define TCG_TARGET_INSN_UNIT_SIZE, Richard Henderson, 2014/05/12
- [Qemu-devel] [PULL 16/26] tcg: Require TCG_TARGET_INSN_UNIT_SIZE, Richard Henderson, 2014/05/12
- [Qemu-devel] [PULL 14/26] tcg-mips: Define TCG_TARGET_INSN_UNIT_SIZE, Richard Henderson, 2014/05/12
- [Qemu-devel] [PULL 15/26] tci: Define TCG_TARGET_INSN_UNIT_SIZE,
Richard Henderson <=
- [Qemu-devel] [PULL 13/26] tcg-ia64: Define TCG_TARGET_INSN_UNIT_SIZE, Richard Henderson, 2014/05/12
- Re: [Qemu-devel] [PULL 00/26] tcg updates, Peter Maydell, 2014/05/13