From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: [PATCH 4/9] [SVM] skip_emulated_instruction() decode an instruction if size is not known Date: Tue, 5 May 2009 11:14:30 +0300 Message-ID: <1241511275-2261-4-git-send-email-gleb@redhat.com> References: <1241511275-2261-1-git-send-email-gleb@redhat.com> Cc: kvm@vger.kernel.org, Gleb Natapov To: avi@redhat.com Return-path: Received: from mx2.redhat.com ([66.187.237.31]:39534 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752588AbZEEIOi (ORCPT ); Tue, 5 May 2009 04:14:38 -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 n458Ec6I029563 for ; Tue, 5 May 2009 04:14:38 -0400 In-Reply-To: <1241511275-2261-1-git-send-email-gleb@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Signed-off-by: Gleb Natapov --- arch/x86/kvm/svm.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index c1ef2b9..14cdfce 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -207,7 +207,9 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu) struct vcpu_svm *svm = to_svm(vcpu); if (!svm->next_rip) { - printk(KERN_DEBUG "%s: NOP\n", __func__); + if (emulate_instruction(vcpu, vcpu->run, 0, 0, EMULTYPE_SKIP) != + EMULATE_DONE) + printk(KERN_DEBUG "%s: NOP\n", __func__); return; } if (svm->next_rip - kvm_rip_read(vcpu) > MAX_INST_SIZE) @@ -1836,11 +1838,8 @@ static int task_switch_interception(struct vcpu_svm *svm, if (reason != TASK_SWITCH_GATE || int_type == SVM_EXITINTINFO_TYPE_SOFT || (int_type == SVM_EXITINTINFO_TYPE_EXEPT && - (int_vec == OF_VECTOR || int_vec == BP_VECTOR))) { - if (emulate_instruction(&svm->vcpu, kvm_run, 0, 0, - EMULTYPE_SKIP) != EMULATE_DONE) - return 0; - } + (int_vec == OF_VECTOR || int_vec == BP_VECTOR))) + skip_emulated_instruction(&svm->vcpu); return kvm_task_switch(&svm->vcpu, tss_selector, reason); } -- 1.6.2.1