From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 05/13] KVM: SVM: Add intercept check for emulated cr accesses Date: Sun, 27 Mar 2011 11:45:32 +0200 Message-ID: <4D8F073C.7080407@redhat.com> References: <1301045356-25257-1-git-send-email-joerg.roedel@amd.com> <1301045356-25257-6-git-send-email-joerg.roedel@amd.com> <4D8DB3E6.4060202@redhat.com> <20110326110618.GB28219@8bytes.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Joerg Roedel , Marcelo Tosatti , kvm@vger.kernel.org To: Joerg Roedel Return-path: Received: from mx1.redhat.com ([209.132.183.28]:56522 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752851Ab1C0Jpm (ORCPT ); Sun, 27 Mar 2011 05:45:42 -0400 In-Reply-To: <20110326110618.GB28219@8bytes.org> Sender: kvm-owner@vger.kernel.org List-ID: On 03/26/2011 01:06 PM, Joerg Roedel wrote: > On Sat, Mar 26, 2011 at 11:37:42AM +0200, Avi Kivity wrote: > > On 03/25/2011 11:29 AM, Joerg Roedel wrote: > >> This patch adds all necessary intercept checks for > >> instructions that access the crX registers. > >> > >> > >> @@ -3871,11 +3871,89 @@ static void svm_fpu_deactivate(struct kvm_vcpu *vcpu) > >> update_cr0_intercept(svm); > >> } > >> > >> +#define POST_EX(exit) { .exit_code = (exit), \ > >> + .stage = x86_icpt_post_except, \ > >> + .valid = true } > >> + > >> +static struct __x86_intercept { > >> + u32 exit_code; > >> + enum x86_intercept_stage stage; > >> + bool valid; > > > > Isn't .valid always true, even in later patches? > > The rational here was that the arrary below may not be fully populated > in the future and the svm_check_intercept function needs a way to find > out if it retrieved a populated value. Checks for zero values don't work > because exit_code and stage could both be zero and valid. So I added an > extra field to check that. Of course, for some reason I had in my mind a full array with a search for the index, not a sparse array with direct access. -- error compiling committee.c: too many arguments to function