From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH 4/5] KVM: load|save_guest_segment_descriptor() should return X86EMUL_* values Date: Fri, 29 Jan 2010 19:30:23 -0200 Message-ID: <20100129213023.GD18360@amt.cnet> References: <20100128225114.7a28762c.yoshikawa.takuya@oss.ntt.co.jp> <20100128230130.3d24a46e.yoshikawa.takuya@oss.ntt.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: avi@redhat.com, kvm@vger.kernel.org To: Takuya Yoshikawa Return-path: Received: from mx1.redhat.com ([209.132.183.28]:25650 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752764Ab0A2VkR (ORCPT ); Fri, 29 Jan 2010 16:40:17 -0500 Content-Disposition: inline In-Reply-To: <20100128230130.3d24a46e.yoshikawa.takuya@oss.ntt.co.jp> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Jan 28, 2010 at 11:01:30PM +0900, Takuya Yoshikawa wrote: > These two functions should return X86EMUL_* values. > > Signed-off-by: Takuya Yoshikawa > --- > arch/x86/kvm/x86.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) I think it would be best to improve the return values here (as documented in kvm_emulate.h). > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index ac8672f..78b8ddb 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -4663,7 +4663,7 @@ static int load_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, > > if (dtable.limit < index * 8 + 7) { > kvm_queue_exception_e(vcpu, GP_VECTOR, selector & 0xfffc); > - return 1; > + return X86EMUL_UNHANDLEABLE; > } This should be X86EMUL_PROPAGATE_FAULT so the #GP is injected (and error not propagated to caller). > return kvm_read_guest_virt(dtable.base + index*8, seg_desc, sizeof(*seg_desc), vcpu); > } > @@ -4678,7 +4678,7 @@ static int save_guest_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, > get_segment_descriptor_dtable(vcpu, selector, &dtable); > > if (dtable.limit < index * 8 + 7) > - return 1; > + return X86EMUL_UNHANDLEABLE; > return kvm_write_guest_virt(dtable.base + index*8, seg_desc, sizeof(*seg_desc), vcpu); > }