mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
target/i386: Simplify POPF
Compute the eflags write mask separately, leaving one call to the helper. Use tcg_constant_i32. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
3b10fd8f09
commit
3e7da311d7
1 changed files with 11 additions and 44 deletions
|
@ -5226,52 +5226,19 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
|
||||||
case 0x9d: /* popf */
|
case 0x9d: /* popf */
|
||||||
gen_svm_check_intercept(s, SVM_EXIT_POPF);
|
gen_svm_check_intercept(s, SVM_EXIT_POPF);
|
||||||
if (check_vm86_iopl(s)) {
|
if (check_vm86_iopl(s)) {
|
||||||
ot = gen_pop_T0(s);
|
int mask = TF_MASK | AC_MASK | ID_MASK | NT_MASK;
|
||||||
|
|
||||||
if (CPL(s) == 0) {
|
if (CPL(s) == 0) {
|
||||||
if (dflag != MO_16) {
|
mask |= IF_MASK | IOPL_MASK;
|
||||||
gen_helper_write_eflags(cpu_env, s->T0,
|
} else if (CPL(s) <= IOPL(s)) {
|
||||||
tcg_const_i32((TF_MASK | AC_MASK |
|
mask |= IF_MASK;
|
||||||
ID_MASK | NT_MASK |
|
|
||||||
IF_MASK |
|
|
||||||
IOPL_MASK)));
|
|
||||||
} else {
|
|
||||||
gen_helper_write_eflags(cpu_env, s->T0,
|
|
||||||
tcg_const_i32((TF_MASK | AC_MASK |
|
|
||||||
ID_MASK | NT_MASK |
|
|
||||||
IF_MASK | IOPL_MASK)
|
|
||||||
& 0xffff));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (CPL(s) <= IOPL(s)) {
|
|
||||||
if (dflag != MO_16) {
|
|
||||||
gen_helper_write_eflags(cpu_env, s->T0,
|
|
||||||
tcg_const_i32((TF_MASK |
|
|
||||||
AC_MASK |
|
|
||||||
ID_MASK |
|
|
||||||
NT_MASK |
|
|
||||||
IF_MASK)));
|
|
||||||
} else {
|
|
||||||
gen_helper_write_eflags(cpu_env, s->T0,
|
|
||||||
tcg_const_i32((TF_MASK |
|
|
||||||
AC_MASK |
|
|
||||||
ID_MASK |
|
|
||||||
NT_MASK |
|
|
||||||
IF_MASK)
|
|
||||||
& 0xffff));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (dflag != MO_16) {
|
|
||||||
gen_helper_write_eflags(cpu_env, s->T0,
|
|
||||||
tcg_const_i32((TF_MASK | AC_MASK |
|
|
||||||
ID_MASK | NT_MASK)));
|
|
||||||
} else {
|
|
||||||
gen_helper_write_eflags(cpu_env, s->T0,
|
|
||||||
tcg_const_i32((TF_MASK | AC_MASK |
|
|
||||||
ID_MASK | NT_MASK)
|
|
||||||
& 0xffff));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (dflag == MO_16) {
|
||||||
|
mask &= 0xffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
ot = gen_pop_T0(s);
|
||||||
|
gen_helper_write_eflags(cpu_env, s->T0, tcg_constant_i32(mask));
|
||||||
gen_pop_update(s, ot);
|
gen_pop_update(s, ot);
|
||||||
set_cc_op(s, CC_OP_EFLAGS);
|
set_cc_op(s, CC_OP_EFLAGS);
|
||||||
/* abort translation because TF/AC flag may change */
|
/* abort translation because TF/AC flag may change */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue