* [PATCH 1 of 2] xen/hvm: Add get_shadow_gs_base() wrapper function
@ 2012-04-25 18:38 Aravindh Puthiyaparambil
2012-04-25 18:38 ` [PATCH 2 of 2] [v3] xen/x86: Add FS and GS base to HVM VCPU context Aravindh Puthiyaparambil
0 siblings, 1 reply; 5+ messages in thread
From: Aravindh Puthiyaparambil @ 2012-04-25 18:38 UTC (permalink / raw)
To: xen-devel; +Cc: keir, JBeulich
Add a wrapper function to the HVM function table that returns the shadow GS base.
Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
diff -r 6ef297a3761f -r be41f3b599d9 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c Mon Apr 23 15:16:34 2012 -0700
+++ b/xen/arch/x86/hvm/svm/svm.c Wed Apr 25 11:35:29 2012 -0700
@@ -645,6 +645,13 @@ static void svm_set_segment_register(str
svm_vmload(vmcb);
}
+static unsigned long svm_get_shadow_gs_base(struct vcpu *v)
+{
+ struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
+
+ return vmcb->kerngsbase;
+}
+
static int svm_set_guest_pat(struct vcpu *v, u64 gpat)
{
struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
@@ -1983,6 +1990,7 @@ static struct hvm_function_table __read_
.guest_x86_mode = svm_guest_x86_mode,
.get_segment_register = svm_get_segment_register,
.set_segment_register = svm_set_segment_register,
+ .get_shadow_gs_base = svm_get_shadow_gs_base,
.update_host_cr3 = svm_update_host_cr3,
.update_guest_cr = svm_update_guest_cr,
.update_guest_efer = svm_update_guest_efer,
diff -r 6ef297a3761f -r be41f3b599d9 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c Mon Apr 23 15:16:34 2012 -0700
+++ b/xen/arch/x86/hvm/vmx/vmx.c Wed Apr 25 11:35:29 2012 -0700
@@ -942,6 +942,15 @@ static void vmx_set_segment_register(str
vmx_vmcs_exit(v);
}
+static unsigned long vmx_get_shadow_gs_base(struct vcpu *v)
+{
+#ifdef __x86_64__
+ return v->arch.hvm_vmx.shadow_gs;
+#else
+ return 0;
+#endif
+}
+
static int vmx_set_guest_pat(struct vcpu *v, u64 gpat)
{
if ( !cpu_has_vmx_pat || !paging_mode_hap(v->domain) )
@@ -1522,6 +1531,7 @@ static struct hvm_function_table __read_
.guest_x86_mode = vmx_guest_x86_mode,
.get_segment_register = vmx_get_segment_register,
.set_segment_register = vmx_set_segment_register,
+ .get_shadow_gs_base = vmx_get_shadow_gs_base,
.update_host_cr3 = vmx_update_host_cr3,
.update_guest_cr = vmx_update_guest_cr,
.update_guest_efer = vmx_update_guest_efer,
diff -r 6ef297a3761f -r be41f3b599d9 xen/include/asm-x86/hvm/hvm.h
--- a/xen/include/asm-x86/hvm/hvm.h Mon Apr 23 15:16:34 2012 -0700
+++ b/xen/include/asm-x86/hvm/hvm.h Wed Apr 25 11:35:29 2012 -0700
@@ -106,6 +106,7 @@ struct hvm_function_table {
struct segment_register *reg);
void (*set_segment_register)(struct vcpu *v, enum x86_segment seg,
struct segment_register *reg);
+ unsigned long (*get_shadow_gs_base)(struct vcpu *v);
/*
* Re-set the value of CR3 that Xen runs on when handling VM exits.
@@ -305,6 +306,11 @@ hvm_set_segment_register(struct vcpu *v,
hvm_funcs.set_segment_register(v, seg, reg);
}
+static inline unsigned long hvm_get_shadow_gs_base(struct vcpu *v)
+{
+ return hvm_funcs.get_shadow_gs_base(v);
+}
+
#define is_viridian_domain(_d) \
(is_hvm_domain(_d) && ((_d)->arch.hvm_domain.params[HVM_PARAM_VIRIDIAN]))
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2 of 2] [v3] xen/x86: Add FS and GS base to HVM VCPU context
2012-04-25 18:38 [PATCH 1 of 2] xen/hvm: Add get_shadow_gs_base() wrapper function Aravindh Puthiyaparambil
@ 2012-04-25 18:38 ` Aravindh Puthiyaparambil
2012-04-27 12:49 ` Jan Beulich
0 siblings, 1 reply; 5+ messages in thread
From: Aravindh Puthiyaparambil @ 2012-04-25 18:38 UTC (permalink / raw)
To: xen-devel; +Cc: keir, JBeulich
Add FS and GS base to the HVM VCPU context returned by xc_vcpu_getcontext()
Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
diff -r be41f3b599d9 -r 1f39b9fe704f xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c Wed Apr 25 11:35:29 2012 -0700
+++ b/xen/arch/x86/domctl.c Wed Apr 25 11:35:43 2012 -0700
@@ -1590,8 +1590,23 @@ 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;
+ c.nat->gs_base_user = hvm_get_shadow_gs_base(v);
+ }
+ else
+ {
+ c.nat->gs_base_user = sreg.base;
+ c.nat->gs_base_kernel = hvm_get_shadow_gs_base(v);
+ }
+#endif
}
else
{
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2 of 2] [v3] xen/x86: Add FS and GS base to HVM VCPU context
2012-04-25 18:38 ` [PATCH 2 of 2] [v3] xen/x86: Add FS and GS base to HVM VCPU context Aravindh Puthiyaparambil
@ 2012-04-27 12:49 ` Jan Beulich
2012-04-27 15:02 ` Keir Fraser
0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2012-04-27 12:49 UTC (permalink / raw)
To: Aravindh Puthiyaparambil; +Cc: keir, xen-devel
>>> On 25.04.12 at 20:38, Aravindh Puthiyaparambil <aravindh@virtuata.com> wrote:
> Add FS and GS base to the HVM VCPU context returned by xc_vcpu_getcontext()
Given that we're in feature freeze right now - is this actually fixing some
shortcoming somewhere? Otherwise it may need to wait until 4.2 is out.
Jan
> Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
>
> diff -r be41f3b599d9 -r 1f39b9fe704f xen/arch/x86/domctl.c
> --- a/xen/arch/x86/domctl.c Wed Apr 25 11:35:29 2012 -0700
> +++ b/xen/arch/x86/domctl.c Wed Apr 25 11:35:43 2012 -0700
> @@ -1590,8 +1590,23 @@ 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;
> + c.nat->gs_base_user = hvm_get_shadow_gs_base(v);
> + }
> + else
> + {
> + c.nat->gs_base_user = sreg.base;
> + c.nat->gs_base_kernel = hvm_get_shadow_gs_base(v);
> + }
> +#endif
> }
> else
> {
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2 of 2] [v3] xen/x86: Add FS and GS base to HVM VCPU context
2012-04-27 12:49 ` Jan Beulich
@ 2012-04-27 15:02 ` Keir Fraser
2012-04-27 15:23 ` Aravindh Puthiyaparambil
0 siblings, 1 reply; 5+ messages in thread
From: Keir Fraser @ 2012-04-27 15:02 UTC (permalink / raw)
To: Jan Beulich, Aravindh Puthiyaparambil; +Cc: xen-devel
On 27/04/2012 13:49, "Jan Beulich" <JBeulich@suse.com> wrote:
>>>> On 25.04.12 at 20:38, Aravindh Puthiyaparambil <aravindh@virtuata.com>
>>>> wrote:
>> Add FS and GS base to the HVM VCPU context returned by xc_vcpu_getcontext()
>
> Given that we're in feature freeze right now - is this actually fixing some
> shortcoming somewhere? Otherwise it may need to wait until 4.2 is out.
I think we can make a judgement call on this one that it is obviously safe
to check it in. Even if the patch is buggy, it's only filling in data fields
with garbage, which were uninitialised garbage in the first place.
-- Keir
> Jan
>
>> Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
>>
>> diff -r be41f3b599d9 -r 1f39b9fe704f xen/arch/x86/domctl.c
>> --- a/xen/arch/x86/domctl.c Wed Apr 25 11:35:29 2012 -0700
>> +++ b/xen/arch/x86/domctl.c Wed Apr 25 11:35:43 2012 -0700
>> @@ -1590,8 +1590,23 @@ 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;
>> + c.nat->gs_base_user = hvm_get_shadow_gs_base(v);
>> + }
>> + else
>> + {
>> + c.nat->gs_base_user = sreg.base;
>> + c.nat->gs_base_kernel = hvm_get_shadow_gs_base(v);
>> + }
>> +#endif
>> }
>> else
>> {
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2 of 2] [v3] xen/x86: Add FS and GS base to HVM VCPU context
2012-04-27 15:02 ` Keir Fraser
@ 2012-04-27 15:23 ` Aravindh Puthiyaparambil
0 siblings, 0 replies; 5+ messages in thread
From: Aravindh Puthiyaparambil @ 2012-04-27 15:23 UTC (permalink / raw)
To: Keir Fraser; +Cc: Jan Beulich, xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 1971 bytes --]
On Apr 27, 2012 8:02 AM, "Keir Fraser" <keir@xen.org> wrote:
>
> On 27/04/2012 13:49, "Jan Beulich" <JBeulich@suse.com> wrote:
>
> >>>> On 25.04.12 at 20:38, Aravindh Puthiyaparambil <aravindh@virtuata.com
>
> >>>> wrote:
> >> Add FS and GS base to the HVM VCPU context returned by
xc_vcpu_getcontext()
> >
> > Given that we're in feature freeze right now - is this actually fixing
some
> > shortcoming somewhere? Otherwise it may need to wait until 4.2 is out.
>
> I think we can make a judgement call on this one that it is obviously safe
> to check it in. Even if the patch is buggy, it's only filling in data
fields
> with garbage, which were uninitialised garbage in the first place.
>
It will be helpful if this can make it into 4.2. It does provide useful
info for Windows guests.
Thanks,
Aravindh
> -- Keir
>
> > Jan
> >
> >> Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
> >>
> >> diff -r be41f3b599d9 -r 1f39b9fe704f xen/arch/x86/domctl.c
> >> --- a/xen/arch/x86/domctl.c Wed Apr 25 11:35:29 2012 -0700
> >> +++ b/xen/arch/x86/domctl.c Wed Apr 25 11:35:43 2012 -0700
> >> @@ -1590,8 +1590,23 @@ 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;
> >> + c.nat->gs_base_user = hvm_get_shadow_gs_base(v);
> >> + }
> >> + else
> >> + {
> >> + c.nat->gs_base_user = sreg.base;
> >> + c.nat->gs_base_kernel = hvm_get_shadow_gs_base(v);
> >> + }
> >> +#endif
> >> }
> >> else
> >> {
> >
> >
> >
>
>
[-- Attachment #1.2: Type: text/html, Size: 2973 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-04-27 15:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-25 18:38 [PATCH 1 of 2] xen/hvm: Add get_shadow_gs_base() wrapper function Aravindh Puthiyaparambil
2012-04-25 18:38 ` [PATCH 2 of 2] [v3] xen/x86: Add FS and GS base to HVM VCPU context Aravindh Puthiyaparambil
2012-04-27 12:49 ` Jan Beulich
2012-04-27 15:02 ` Keir Fraser
2012-04-27 15:23 ` Aravindh Puthiyaparambil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).