From patchwork Sun Apr 12 07:26:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 17784 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3C7R2NK023604 for ; Sun, 12 Apr 2009 07:27:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757842AbZDLH0l (ORCPT ); Sun, 12 Apr 2009 03:26:41 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759253AbZDLH0k (ORCPT ); Sun, 12 Apr 2009 03:26:40 -0400 Received: from mx2.redhat.com ([66.187.237.31]:34861 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757822AbZDLH0k (ORCPT ); Sun, 12 Apr 2009 03:26:40 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n3C7QdDQ024493 for ; Sun, 12 Apr 2009 03:26:39 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n3C7Qf2A010878; Sun, 12 Apr 2009 03:26:41 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n3C7QdPU022567; Sun, 12 Apr 2009 03:26:39 -0400 Received: from trex.usersys.redhat.com (localhost [127.0.0.1]) by dhcp-1-237.tlv.redhat.com (Postfix) with ESMTP id 61E1518D41C; Sun, 12 Apr 2009 10:26:38 +0300 (IDT) From: Gleb Natapov Subject: [PATCH v2 09/10] Add new mode of instruction emulation: skip. To: avi@redhat.com Cc: kvm@vger.kernel.org Date: Sun, 12 Apr 2009 10:26:38 +0300 Message-ID: <20090412072638.5828.43761.stgit@trex.usersys.redhat.com> In-Reply-To: <20090412072555.5828.46351.stgit@trex.usersys.redhat.com> References: <20090412072555.5828.46351.stgit@trex.usersys.redhat.com> User-Agent: StGIT/0.14.2 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org In the new mode instruction is decoded, but not executed. The EIP is moved to point after the instruction. Signed-off-by: Gleb Natapov --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/x86.c | 5 +++++ 2 files changed, 6 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 3fc4623..e672ca5 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -565,6 +565,7 @@ enum emulation_result { #define EMULTYPE_NO_DECODE (1 << 0) #define EMULTYPE_TRAP_UD (1 << 1) +#define EMULTYPE_SKIP (1 << 2) int emulate_instruction(struct kvm_vcpu *vcpu, struct kvm_run *run, unsigned long cr2, u16 error_code, int emulation_type); void kvm_report_emulation_failure(struct kvm_vcpu *cvpu, const char *context); diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 0bb4131..52c7a29 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -2412,6 +2412,11 @@ int emulate_instruction(struct kvm_vcpu *vcpu, } } + if (emulation_type & EMULTYPE_SKIP) { + kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.decode.eip); + return EMULATE_DONE; + } + r = x86_emulate_insn(&vcpu->arch.emulate_ctxt, &emulate_ops); if (vcpu->arch.pio.string)