Skip to content

Commit

Permalink
KVM: x86 emulator: fix cli/sti instruction emulation
Browse files Browse the repository at this point in the history
If IOPL check fail, the cli/sti emulate GP and then we should
skip writeback since the default write OP is OP_REG.

Signed-off-by: Wei Yongjun <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>
  • Loading branch information
Wei Yongjun authored and avikivity committed Aug 2, 2010
1 parent b16b2b7 commit 07cbc6c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions arch/x86/kvm/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -2979,17 +2979,19 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
c->dst.type = OP_NONE; /* Disable writeback. */
break;
case 0xfa: /* cli */
if (emulator_bad_iopl(ctxt, ops))
if (emulator_bad_iopl(ctxt, ops)) {
emulate_gp(ctxt, 0);
else {
goto done;
} else {
ctxt->eflags &= ~X86_EFLAGS_IF;
c->dst.type = OP_NONE; /* Disable writeback. */
}
break;
case 0xfb: /* sti */
if (emulator_bad_iopl(ctxt, ops))
if (emulator_bad_iopl(ctxt, ops)) {
emulate_gp(ctxt, 0);
else {
goto done;
} else {
ctxt->interruptibility = KVM_X86_SHADOW_INT_STI;
ctxt->eflags |= X86_EFLAGS_IF;
c->dst.type = OP_NONE; /* Disable writeback. */
Expand Down

0 comments on commit 07cbc6c

Please sign in to comment.