Commit f411e6cd authored by Takuya Yoshikawa's avatar Takuya Yoshikawa Committed by Avi Kivity

KVM: x86 emulator: Use opcode::execute for CLI/STI(FA/FB)

Signed-off-by: default avatarTakuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent d06e03ad
...@@ -2846,6 +2846,25 @@ static int em_jcxz(struct x86_emulate_ctxt *ctxt) ...@@ -2846,6 +2846,25 @@ static int em_jcxz(struct x86_emulate_ctxt *ctxt)
return X86EMUL_CONTINUE; return X86EMUL_CONTINUE;
} }
static int em_cli(struct x86_emulate_ctxt *ctxt)
{
if (emulator_bad_iopl(ctxt))
return emulate_gp(ctxt, 0);
ctxt->eflags &= ~X86_EFLAGS_IF;
return X86EMUL_CONTINUE;
}
static int em_sti(struct x86_emulate_ctxt *ctxt)
{
if (emulator_bad_iopl(ctxt))
return emulate_gp(ctxt, 0);
ctxt->interruptibility = KVM_X86_SHADOW_INT_STI;
ctxt->eflags |= X86_EFLAGS_IF;
return X86EMUL_CONTINUE;
}
static bool valid_cr(int nr) static bool valid_cr(int nr)
{ {
switch (nr) { switch (nr) {
...@@ -3276,7 +3295,8 @@ static struct opcode opcode_table[256] = { ...@@ -3276,7 +3295,8 @@ static struct opcode opcode_table[256] = {
DI(ImplicitOps | Priv, hlt), D(ImplicitOps), DI(ImplicitOps | Priv, hlt), D(ImplicitOps),
G(ByteOp, group3), G(0, group3), G(ByteOp, group3), G(0, group3),
/* 0xF8 - 0xFF */ /* 0xF8 - 0xFF */
D(ImplicitOps), D(ImplicitOps), D(ImplicitOps), D(ImplicitOps), D(ImplicitOps), D(ImplicitOps),
I(ImplicitOps, em_cli), I(ImplicitOps, em_sti),
D(ImplicitOps), D(ImplicitOps), G(0, group4), G(0, group5), D(ImplicitOps), D(ImplicitOps), G(0, group4), G(0, group5),
}; };
...@@ -4049,22 +4069,6 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) ...@@ -4049,22 +4069,6 @@ int x86_emulate_insn(struct x86_emulate_ctxt *ctxt)
case 0xf9: /* stc */ case 0xf9: /* stc */
ctxt->eflags |= EFLG_CF; ctxt->eflags |= EFLG_CF;
break; break;
case 0xfa: /* cli */
if (emulator_bad_iopl(ctxt)) {
rc = emulate_gp(ctxt, 0);
goto done;
} else
ctxt->eflags &= ~X86_EFLAGS_IF;
break;
case 0xfb: /* sti */
if (emulator_bad_iopl(ctxt)) {
rc = emulate_gp(ctxt, 0);
goto done;
} else {
ctxt->interruptibility = KVM_X86_SHADOW_INT_STI;
ctxt->eflags |= X86_EFLAGS_IF;
}
break;
case 0xfc: /* cld */ case 0xfc: /* cld */
ctxt->eflags &= ~EFLG_DF; ctxt->eflags &= ~EFLG_DF;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment