From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: [PATCH 05/13] KVM: SVM: Add intercept check for emulated cr accesses Date: Sat, 26 Mar 2011 12:06:18 +0100 Message-ID: <20110326110618.GB28219@8bytes.org> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Joerg Roedel , Marcelo Tosatti , kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from 8bytes.org ([88.198.83.132]:44492 "EHLO 8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752150Ab1CZLGU (ORCPT ); Sat, 26 Mar 2011 07:06:20 -0400 Content-Disposition: inline In-Reply-To: <4D8DB3E6.4060202@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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. I''ll fix the other things you pointed out in the next version. Regards, Joerg