aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--exec-all.h54
-rw-r--r--target-i386/op.c4
-rw-r--r--target-i386/translate.c14
3 files changed, 26 insertions, 46 deletions
diff --git a/exec-all.h b/exec-all.h
index a9522b692f..66d4f887d3 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -322,7 +322,7 @@ TranslationBlock *tb_find_pc(unsigned long pc_ptr);
#if defined(__powerpc__)
/* we patch the jump instruction directly */
-#define JUMP_TB(opname, tbparam, n, eip)\
+#define GOTO_TB(opname, tbparam, n)\
do {\
asm volatile (ASM_DATA_SECTION\
ASM_NAME(__op_label) #n "." ASM_NAME(opname) ":\n"\
@@ -330,20 +330,12 @@ do {\
ASM_PREVIOUS_SECTION \
"b " ASM_NAME(__op_jmp) #n "\n"\
"1:\n");\
- T0 = (long)(tbparam) + (n);\
- EIP = (int32_t)eip;\
- EXIT_TB();\
-} while (0)
-
-#define JUMP_TB2(opname, tbparam, n)\
-do {\
- asm volatile ("b " ASM_NAME(__op_jmp) #n "\n");\
} while (0)
#elif defined(__i386__) && defined(USE_DIRECT_JUMP)
/* we patch the jump instruction directly */
-#define GOTO_TB(opname, n)\
+#define GOTO_TB(opname, tbparam, n)\
do {\
asm volatile (".section .data\n"\
ASM_NAME(__op_label) #n "." ASM_NAME(opname) ":\n"\
@@ -353,48 +345,30 @@ do {\
"1:\n");\
} while (0)
-#define JUMP_TB(opname, tbparam, n, eip)\
-do {\
- asm volatile (".section .data\n"\
- ASM_NAME(__op_label) #n "." ASM_NAME(opname) ":\n"\
- ".long 1f\n"\
- ASM_PREVIOUS_SECTION \
- "jmp " ASM_NAME(__op_jmp) #n "\n"\
- "1:\n");\
- T0 = (long)(tbparam) + (n);\
- EIP = (int32_t)eip;\
- EXIT_TB();\
-} while (0)
-
-#define JUMP_TB2(opname, tbparam, n)\
-do {\
- asm volatile ("jmp " ASM_NAME(__op_jmp) #n "\n");\
-} while (0)
-
#else
/* jump to next block operations (more portable code, does not need
cache flushing, but slower because of indirect jump) */
-#define JUMP_TB(opname, tbparam, n, eip)\
+#define GOTO_TB(opname, tbparam, n)\
do {\
- static void __attribute__((unused)) *__op_label ## n = &&label ## n;\
static void __attribute__((unused)) *dummy ## n = &&dummy_label ## n;\
+ static void __attribute__((unused)) *__op_label ## n = &&label ## n;\
goto *(void *)(((TranslationBlock *)tbparam)->tb_next[n]);\
-label ## n:\
- T0 = (long)(tbparam) + (n);\
- EIP = (int32_t)eip;\
-dummy_label ## n:\
- EXIT_TB();\
+label ## n: ;\
+dummy_label ## n: ;\
} while (0)
-/* second jump to same destination 'n' */
-#define JUMP_TB2(opname, tbparam, n)\
+#endif
+
+/* XXX: will be suppressed */
+#define JUMP_TB(opname, tbparam, n, eip)\
do {\
- goto *(void *)(((TranslationBlock *)tbparam)->tb_next[n - 2]);\
+ GOTO_TB(opname, tbparam, n);\
+ T0 = (long)(tbparam) + (n);\
+ EIP = (int32_t)eip;\
+ EXIT_TB();\
} while (0)
-#endif
-
extern CPUWriteMemoryFunc *io_mem_write[IO_MEM_NB_ENTRIES][4];
extern CPUReadMemoryFunc *io_mem_read[IO_MEM_NB_ENTRIES][4];
extern void *io_mem_opaque[IO_MEM_NB_ENTRIES];
diff --git a/target-i386/op.c b/target-i386/op.c
index 10098256d4..ab7501e939 100644
--- a/target-i386/op.c
+++ b/target-i386/op.c
@@ -1262,12 +1262,12 @@ void OPPROTO op_clts(void)
void OPPROTO op_goto_tb0(void)
{
- GOTO_TB(op_goto_tb0, 0);
+ GOTO_TB(op_goto_tb0, PARAM1, 0);
}
void OPPROTO op_goto_tb1(void)
{
- GOTO_TB(op_goto_tb1, 1);
+ GOTO_TB(op_goto_tb1, PARAM1, 1);
}
void OPPROTO op_jmp_label(void)
diff --git a/target-i386/translate.c b/target-i386/translate.c
index adcdaed5c4..bd141ffeb9 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -61,6 +61,12 @@ static uint32_t *gen_opparam_ptr;
static int x86_64_hregs;
#endif
+#ifdef USE_DIRECT_JUMP
+#define TBPARAM(x)
+#else
+#define TBPARAM(x) (long)(x)
+#endif
+
typedef struct DisasContext {
/* current insn context */
int override; /* -1 if no override */
@@ -1782,13 +1788,13 @@ static inline void gen_jcc(DisasContext *s, int b,
l1 = gen_new_label();
func(l1);
- gen_op_goto_tb0();
+ gen_op_goto_tb0(TBPARAM(tb));
gen_jmp_im(next_eip);
gen_op_movl_T0_im((long)tb + 0);
gen_op_exit_tb();
gen_set_label(l1);
- gen_op_goto_tb1();
+ gen_op_goto_tb1(TBPARAM(tb));
gen_jmp_im(val);
gen_op_movl_T0_im((long)tb + 1);
gen_op_exit_tb();
@@ -2179,9 +2185,9 @@ static void gen_jmp_tb(DisasContext *s, target_ulong eip, int tb_num)
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
if (tb_num)
- gen_op_goto_tb1();
+ gen_op_goto_tb1(TBPARAM(tb));
else
- gen_op_goto_tb0();
+ gen_op_goto_tb0(TBPARAM(tb));
gen_jmp_im(eip);
gen_op_movl_T0_im((long)tb + tb_num);
gen_op_exit_tb();