#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"\
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"\
"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];
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 */
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();
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();