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

Re: [Xen-devel] [PATCH] [v2] xen: Add FS and GS base to HVM VCPU context



>>> On 24.04.12 at 01:16, Aravindh Puthiyaparambil <aravindh@xxxxxxxxxxxx> 
>>> wrote:
> Add FS and GS base to the HVM VCPU context returned by xc_vcpu_getcontext()
> 
> Signed-off-by: Aravindh Puthiyaparambil <aravindh@xxxxxxxxxxxx>
> 
> diff -r 6ef297a3761f -r f7a1633867bf xen/arch/x86/domctl.c
> --- a/xen/arch/x86/domctl.c   Mon Apr 23 15:16:34 2012 -0700
> +++ b/xen/arch/x86/domctl.c   Mon Apr 23 16:12:50 2012 -0700
> @@ -1590,8 +1590,17 @@ void arch_get_info_guest(struct vcpu *v,
>          c.nat->user_regs.es = sreg.sel;
>          hvm_get_segment_register(v, x86_seg_fs, &sreg);
>          c.nat->user_regs.fs = sreg.sel;
> +#ifdef __x86_64__
> +        c.nat->fs_base = sreg.base;
> +#endif
>          hvm_get_segment_register(v, x86_seg_gs, &sreg);
>          c.nat->user_regs.gs = sreg.sel;
> +#ifdef __x86_64__
> +        if ( ring_0(&c.nat->user_regs) )
> +            c.nat->gs_base_kernel = sreg.base;
> +        else
> +            c.nat->gs_base_user = sreg.base;
> +#endif

Which still leaves one of gs_base_* unfilled in all cases. You'll need
to get ahold of vmcb->kerngsbase (AMD/SVM) or
v->arch.hvm_vmx.shadow_gs (Intel/VMX). You could either
introduce a new wrapper, or expose {svm,vmx}_save_cpu_state()
as a new function table entry, or pay the price of calling
->save_cpu_ctxt(). But you will need to pay extra attention to
the case of the subject vCPU being current.

>      }
>      else
>      {
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx 
> http://lists.xen.org/xen-devel 




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.