target/i386: Remove cur_eip argument to gen_exception
All callers pass s->base.pc_next - s->cs_base, which we can just as well compute within the function. Note the special case of EXCP_VSYSCALL in which s->cs_base wasn't subtracted, but cs_base is always zero in 64-bit mode, when vsyscall is used. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20221001140935.465607-4-richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
f66c8e8cd9
commit
522365508e
@ -1332,10 +1332,10 @@ static void gen_helper_fp_arith_STN_ST0(int op, int opreg)
|
||||
}
|
||||
}
|
||||
|
||||
static void gen_exception(DisasContext *s, int trapno, target_ulong cur_eip)
|
||||
static void gen_exception(DisasContext *s, int trapno)
|
||||
{
|
||||
gen_update_cc_op(s);
|
||||
gen_jmp_im(s, cur_eip);
|
||||
gen_jmp_im(s, s->base.pc_next - s->cs_base);
|
||||
gen_helper_raise_exception(cpu_env, tcg_const_i32(trapno));
|
||||
s->base.is_jmp = DISAS_NORETURN;
|
||||
}
|
||||
@ -1344,13 +1344,13 @@ static void gen_exception(DisasContext *s, int trapno, target_ulong cur_eip)
|
||||
the instruction is known, but it isn't allowed in the current cpu mode. */
|
||||
static void gen_illegal_opcode(DisasContext *s)
|
||||
{
|
||||
gen_exception(s, EXCP06_ILLOP, s->base.pc_next - s->cs_base);
|
||||
gen_exception(s, EXCP06_ILLOP);
|
||||
}
|
||||
|
||||
/* Generate #GP for the current instruction. */
|
||||
static void gen_exception_gpf(DisasContext *s)
|
||||
{
|
||||
gen_exception(s, EXCP0D_GPF, s->base.pc_next - s->cs_base);
|
||||
gen_exception(s, EXCP0D_GPF);
|
||||
}
|
||||
|
||||
/* Check for cpl == 0; if not, raise #GP and return false. */
|
||||
@ -3267,7 +3267,7 @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b)
|
||||
}
|
||||
/* simple MMX/SSE operation */
|
||||
if (s->flags & HF_TS_MASK) {
|
||||
gen_exception(s, EXCP07_PREX, s->base.pc_next - s->cs_base);
|
||||
gen_exception(s, EXCP07_PREX);
|
||||
return;
|
||||
}
|
||||
if (s->flags & HF_EM_MASK) {
|
||||
@ -6077,7 +6077,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
|
||||
if (s->flags & (HF_EM_MASK | HF_TS_MASK)) {
|
||||
/* if CR0.EM or CR0.TS are set, generate an FPU exception */
|
||||
/* XXX: what to do if illegal op ? */
|
||||
gen_exception(s, EXCP07_PREX, s->base.pc_next - s->cs_base);
|
||||
gen_exception(s, EXCP07_PREX);
|
||||
break;
|
||||
}
|
||||
modrm = x86_ldub_code(env, s);
|
||||
@ -7302,7 +7302,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
|
||||
goto illegal_op;
|
||||
val = x86_ldub_code(env, s);
|
||||
if (val == 0) {
|
||||
gen_exception(s, EXCP00_DIVZ, s->base.pc_next - s->cs_base);
|
||||
gen_exception(s, EXCP00_DIVZ);
|
||||
} else {
|
||||
gen_helper_aam(cpu_env, tcg_const_i32(val));
|
||||
set_cc_op(s, CC_OP_LOGICB);
|
||||
@ -7336,7 +7336,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
|
||||
case 0x9b: /* fwait */
|
||||
if ((s->flags & (HF_MP_MASK | HF_TS_MASK)) ==
|
||||
(HF_MP_MASK | HF_TS_MASK)) {
|
||||
gen_exception(s, EXCP07_PREX, s->base.pc_next - s->cs_base);
|
||||
gen_exception(s, EXCP07_PREX);
|
||||
} else {
|
||||
gen_helper_fwait(cpu_env);
|
||||
}
|
||||
@ -8393,7 +8393,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
|
||||
goto illegal_op;
|
||||
}
|
||||
if ((s->flags & HF_EM_MASK) || (s->flags & HF_TS_MASK)) {
|
||||
gen_exception(s, EXCP07_PREX, s->base.pc_next - s->cs_base);
|
||||
gen_exception(s, EXCP07_PREX);
|
||||
break;
|
||||
}
|
||||
gen_lea_modrm(env, s, modrm);
|
||||
@ -8406,7 +8406,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
|
||||
goto illegal_op;
|
||||
}
|
||||
if ((s->flags & HF_EM_MASK) || (s->flags & HF_TS_MASK)) {
|
||||
gen_exception(s, EXCP07_PREX, s->base.pc_next - s->cs_base);
|
||||
gen_exception(s, EXCP07_PREX);
|
||||
break;
|
||||
}
|
||||
gen_lea_modrm(env, s, modrm);
|
||||
@ -8418,7 +8418,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
|
||||
goto illegal_op;
|
||||
}
|
||||
if (s->flags & HF_TS_MASK) {
|
||||
gen_exception(s, EXCP07_PREX, s->base.pc_next - s->cs_base);
|
||||
gen_exception(s, EXCP07_PREX);
|
||||
break;
|
||||
}
|
||||
gen_lea_modrm(env, s, modrm);
|
||||
@ -8431,7 +8431,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
|
||||
goto illegal_op;
|
||||
}
|
||||
if (s->flags & HF_TS_MASK) {
|
||||
gen_exception(s, EXCP07_PREX, s->base.pc_next - s->cs_base);
|
||||
gen_exception(s, EXCP07_PREX);
|
||||
break;
|
||||
}
|
||||
gen_helper_update_mxcsr(cpu_env);
|
||||
@ -8822,7 +8822,7 @@ static void i386_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
|
||||
* Detect entry into the vsyscall page and invoke the syscall.
|
||||
*/
|
||||
if ((dc->base.pc_next & TARGET_PAGE_MASK) == TARGET_VSYSCALL_PAGE) {
|
||||
gen_exception(dc, EXCP_VSYSCALL, dc->base.pc_next);
|
||||
gen_exception(dc, EXCP_VSYSCALL);
|
||||
dc->base.pc_next = dc->pc + 1;
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user