mirror of https://github.com/xemu-project/xemu.git
target/i386: Introduce DISAS_JUMP
Drop the unused dest argument to gen_jr(). Remove most of the calls to gen_jr, and use DISAS_JUMP. Remove some unused loads of eip for lcall and ljmp. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20221001140935.465607-14-richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
122e6d7b4a
commit
faf9ea5fa5
|
@ -135,6 +135,7 @@ typedef struct DisasContext {
|
|||
#define DISAS_EOB_ONLY DISAS_TARGET_0
|
||||
#define DISAS_EOB_NEXT DISAS_TARGET_1
|
||||
#define DISAS_EOB_INHIBIT_IRQ DISAS_TARGET_2
|
||||
#define DISAS_JUMP DISAS_TARGET_3
|
||||
|
||||
/* The environment in which user-only runs is constrained. */
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
|
@ -222,7 +223,7 @@ STUB_HELPER(wrmsr, TCGv_env env)
|
|||
#endif
|
||||
|
||||
static void gen_eob(DisasContext *s);
|
||||
static void gen_jr(DisasContext *s, TCGv dest);
|
||||
static void gen_jr(DisasContext *s);
|
||||
static void gen_jmp(DisasContext *s, target_ulong eip);
|
||||
static void gen_jmp_tb(DisasContext *s, target_ulong eip, int tb_num);
|
||||
static void gen_op(DisasContext *s1, int op, MemOp ot, int d);
|
||||
|
@ -2385,7 +2386,7 @@ static void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip)
|
|||
} else {
|
||||
/* jump to another page */
|
||||
gen_jmp_im(s, eip);
|
||||
gen_jr(s, s->tmp0);
|
||||
gen_jr(s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2754,7 +2755,7 @@ static void gen_eob(DisasContext *s)
|
|||
}
|
||||
|
||||
/* Jump to register */
|
||||
static void gen_jr(DisasContext *s, TCGv dest)
|
||||
static void gen_jr(DisasContext *s)
|
||||
{
|
||||
do_gen_eob_worker(s, false, false, true);
|
||||
}
|
||||
|
@ -5328,7 +5329,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
|
|||
gen_push_v(s, s->T1);
|
||||
gen_op_jmp_v(s->T0);
|
||||
gen_bnd_jmp(s);
|
||||
gen_jr(s, s->T0);
|
||||
s->base.is_jmp = DISAS_JUMP;
|
||||
break;
|
||||
case 3: /* lcall Ev */
|
||||
if (mod == 3) {
|
||||
|
@ -5349,8 +5350,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
|
|||
tcg_const_i32(dflag - 1),
|
||||
tcg_const_i32(s->pc - s->cs_base));
|
||||
}
|
||||
tcg_gen_ld_tl(s->tmp4, cpu_env, offsetof(CPUX86State, eip));
|
||||
gen_jr(s, s->tmp4);
|
||||
s->base.is_jmp = DISAS_JUMP;
|
||||
break;
|
||||
case 4: /* jmp Ev */
|
||||
if (dflag == MO_16) {
|
||||
|
@ -5358,7 +5358,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
|
|||
}
|
||||
gen_op_jmp_v(s->T0);
|
||||
gen_bnd_jmp(s);
|
||||
gen_jr(s, s->T0);
|
||||
s->base.is_jmp = DISAS_JUMP;
|
||||
break;
|
||||
case 5: /* ljmp Ev */
|
||||
if (mod == 3) {
|
||||
|
@ -5376,8 +5376,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
|
|||
gen_op_movl_seg_T0_vm(s, R_CS);
|
||||
gen_op_jmp_v(s->T1);
|
||||
}
|
||||
tcg_gen_ld_tl(s->tmp4, cpu_env, offsetof(CPUX86State, eip));
|
||||
gen_jr(s, s->tmp4);
|
||||
s->base.is_jmp = DISAS_JUMP;
|
||||
break;
|
||||
case 6: /* push Ev */
|
||||
gen_push_v(s, s->T0);
|
||||
|
@ -6808,7 +6807,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
|
|||
/* Note that gen_pop_T0 uses a zero-extending load. */
|
||||
gen_op_jmp_v(s->T0);
|
||||
gen_bnd_jmp(s);
|
||||
gen_jr(s, s->T0);
|
||||
s->base.is_jmp = DISAS_JUMP;
|
||||
break;
|
||||
case 0xc3: /* ret */
|
||||
ot = gen_pop_T0(s);
|
||||
|
@ -6816,7 +6815,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
|
|||
/* Note that gen_pop_T0 uses a zero-extending load. */
|
||||
gen_op_jmp_v(s->T0);
|
||||
gen_bnd_jmp(s);
|
||||
gen_jr(s, s->T0);
|
||||
s->base.is_jmp = DISAS_JUMP;
|
||||
break;
|
||||
case 0xca: /* lret im */
|
||||
val = x86_ldsw_code(env, s);
|
||||
|
@ -8846,6 +8845,9 @@ static void i386_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
|
|||
gen_update_eip_cur(dc);
|
||||
gen_eob_inhibit_irq(dc, true);
|
||||
break;
|
||||
case DISAS_JUMP:
|
||||
gen_jr(dc);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue