Re: [PATCH 4/5] KVM: load|save_guest_segment_descriptor() should return X86EMUL_* values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <yoshikawa.takuya@xxxxxxxxxxxxx>
> ---
>  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);
>  }

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux