From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 3/5] kvm/svm: enhance mov DR intercept handler Date: Tue, 07 Dec 2010 15:25:22 +0200 Message-ID: <4CFE35C2.3050301@redhat.com> References: <1291719586-22533-1-git-send-email-andre.przywara@amd.com> <1291719586-22533-4-git-send-email-andre.przywara@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, mtosatti@redhat.com To: Andre Przywara Return-path: Received: from mx1.redhat.com ([209.132.183.28]:40927 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753416Ab0LGNZ1 (ORCPT ); Tue, 7 Dec 2010 08:25:27 -0500 In-Reply-To: <1291719586-22533-4-git-send-email-andre.przywara@amd.com> Sender: kvm-owner@vger.kernel.org List-ID: On 12/07/2010 12:59 PM, Andre Przywara wrote: > Newer SVM implementations provide the GPR number in the VMCB, so > that the emulation path is no longer necesarry to handle debug > register access intercepts. Implement the handling in svm.c and > use it when the info is provided. > > > > +static int dr_interception(struct vcpu_svm *svm) > +{ > + int reg, dr; > + unsigned long val; > + > + if (!boot_cpu_has(SVM_FEATURE_DECODE_ASSIST)) > + return emulate_on_interception(svm); > + > + reg = svm->vmcb->control.exit_info_1& SVM_EXITINFO_REG_MASK; > + dr = svm->vmcb->control.exit_code - SVM_EXIT_READ_DR0; > + > + if (dr> 15) { /* mov to DRn */ > + val = kvm_register_read(&svm->vcpu, reg); > + kvm_set_dr(&svm->vcpu, dr - 16, val); > + } else { > + kvm_get_dr(&svm->vcpu, dr,&val); > + kvm_register_write(&svm->vcpu, reg, val); > + } > + > + skip_emulated_instruction(&svm->vcpu); > + return 1; > +} Again, need to handle faults. -- error compiling committee.c: too many arguments to function