From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Yongjun Subject: [PATCH 6/6] KVM: x86 emulator: fix cli/sti instruction emulation Date: Tue, 06 Jul 2010 16:54:19 +0800 Message-ID: <4C32EF3B.5090708@cn.fujitsu.com> References: <4C32EE01.5050408@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Avi Kivity , Marcelo Tosatti Return-path: Received: from cn.fujitsu.com ([222.73.24.84]:64130 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753281Ab0GFI4Q (ORCPT ); Tue, 6 Jul 2010 04:56:16 -0400 In-Reply-To: <4C32EE01.5050408@cn.fujitsu.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 --- arch/x86/kvm/emulate.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index d4526f2..99fa1c7 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -2979,17 +2979,19 @@ special_insn: 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. */ -- 1.7.0.4