All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen: Add GS base to HVM VCPU context
@ 2012-04-21  0:58 Aravindh Puthiyaparambil
  2012-04-23  7:41 ` Jan Beulich
  0 siblings, 1 reply; 7+ messages in thread
From: Aravindh Puthiyaparambil @ 2012-04-21  0:58 UTC (permalink / raw)
  To: xen-devel

Add GS base to the HVM VCPU context returned by xc_vcpu_getcontext()

Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>

diff -r e62ab14d44af -r babbb3e0f4d3 xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c	Fri Apr 20 11:36:02 2012 -0700
+++ b/xen/arch/x86/domctl.c	Fri Apr 20 17:55:49 2012 -0700
@@ -1592,6 +1592,12 @@ void arch_get_info_guest(struct vcpu *v,
         c.nat->user_regs.fs = sreg.sel;
         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
     }
     else
     {

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] xen: Add GS base to HVM VCPU context
  2012-04-21  0:58 [PATCH] xen: Add GS base to HVM VCPU context Aravindh Puthiyaparambil
@ 2012-04-23  7:41 ` Jan Beulich
  2012-04-23  7:47   ` Aravindh Puthiyaparambil
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2012-04-23  7:41 UTC (permalink / raw)
  To: Aravindh Puthiyaparambil; +Cc: xen-devel

>>> On 21.04.12 at 02:58, Aravindh Puthiyaparambil <aravindh@virtuata.com> wrote:
> Add GS base to the HVM VCPU context returned by xc_vcpu_getcontext()
> 
> Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
> 
> diff -r e62ab14d44af -r babbb3e0f4d3 xen/arch/x86/domctl.c
> --- a/xen/arch/x86/domctl.c	Fri Apr 20 11:36:02 2012 -0700
> +++ b/xen/arch/x86/domctl.c	Fri Apr 20 17:55:49 2012 -0700
> @@ -1592,6 +1592,12 @@ void arch_get_info_guest(struct vcpu *v,
>          c.nat->user_regs.fs = sreg.sel;
>          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

If you do anything like this, do it completely please (i.e. fill all three
base address fields instead of just one).

Jan

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] xen: Add GS base to HVM VCPU context
  2012-04-23  7:41 ` Jan Beulich
@ 2012-04-23  7:47   ` Aravindh Puthiyaparambil
  2012-04-23  7:53     ` Jan Beulich
  0 siblings, 1 reply; 7+ messages in thread
From: Aravindh Puthiyaparambil @ 2012-04-23  7:47 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1398 bytes --]

On Apr 23, 2012 12:41 AM, "Jan Beulich" <JBeulich@suse.com> wrote:
>
> >>> On 21.04.12 at 02:58, Aravindh Puthiyaparambil <aravindh@virtuata.com>
wrote:
> > Add GS base to the HVM VCPU context returned by xc_vcpu_getcontext()
> >
> > Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
> >
> > diff -r e62ab14d44af -r babbb3e0f4d3 xen/arch/x86/domctl.c
> > --- a/xen/arch/x86/domctl.c   Fri Apr 20 11:36:02 2012 -0700
> > +++ b/xen/arch/x86/domctl.c   Fri Apr 20 17:55:49 2012 -0700
> > @@ -1592,6 +1592,12 @@ void arch_get_info_guest(struct vcpu *v,
> >          c.nat->user_regs.fs = sreg.sel;
> >          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
>
> If you do anything like this, do it completely please (i.e. fill all three
> base address fields instead of just one).
>

Sure. I was not sure if it was ok to add fields to the vcpu context
structure which is why I didn't do it across the board. I will do so and
resubmit.

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

[-- Attachment #1.2: Type: text/html, Size: 2108 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] 7+ messages in thread

* Re: [PATCH] xen: Add GS base to HVM VCPU context
  2012-04-23  7:47   ` Aravindh Puthiyaparambil
@ 2012-04-23  7:53     ` Jan Beulich
  2012-04-23 19:11       ` Aravindh Puthiyaparambil
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2012-04-23  7:53 UTC (permalink / raw)
  To: Aravindh Puthiyaparambil; +Cc: xen-devel

>>> On 23.04.12 at 09:47, Aravindh Puthiyaparambil <aravindh@virtuata.com> wrote:
> On Apr 23, 2012 12:41 AM, "Jan Beulich" <JBeulich@suse.com> wrote:
>>
>> >>> On 21.04.12 at 02:58, Aravindh Puthiyaparambil <aravindh@virtuata.com>
> wrote:
>> > Add GS base to the HVM VCPU context returned by xc_vcpu_getcontext()
>> >
>> > Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
>> >
>> > diff -r e62ab14d44af -r babbb3e0f4d3 xen/arch/x86/domctl.c
>> > --- a/xen/arch/x86/domctl.c   Fri Apr 20 11:36:02 2012 -0700
>> > +++ b/xen/arch/x86/domctl.c   Fri Apr 20 17:55:49 2012 -0700
>> > @@ -1592,6 +1592,12 @@ void arch_get_info_guest(struct vcpu *v,
>> >          c.nat->user_regs.fs = sreg.sel;
>> >          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
>>
>> If you do anything like this, do it completely please (i.e. fill all three
>> base address fields instead of just one).
>>
> 
> Sure. I was not sure if it was ok to add fields to the vcpu context
> structure which is why I didn't do it across the board. I will do so and
> resubmit.

I don't see what fields you would need to add.

Jan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] xen: Add GS base to HVM VCPU context
  2012-04-23  7:53     ` Jan Beulich
@ 2012-04-23 19:11       ` Aravindh Puthiyaparambil
  2012-04-23 21:04         ` Keir Fraser
  0 siblings, 1 reply; 7+ messages in thread
From: Aravindh Puthiyaparambil @ 2012-04-23 19:11 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel

On Mon, Apr 23, 2012 at 12:53 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>> On 23.04.12 at 09:47, Aravindh Puthiyaparambil <aravindh@virtuata.com> wrote:
>> On Apr 23, 2012 12:41 AM, "Jan Beulich" <JBeulich@suse.com> wrote:
>>>
>>> >>> On 21.04.12 at 02:58, Aravindh Puthiyaparambil <aravindh@virtuata.com>
>> wrote:
>>> > Add GS base to the HVM VCPU context returned by xc_vcpu_getcontext()
>>> >
>>> > Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
>>> >
>>> > diff -r e62ab14d44af -r babbb3e0f4d3 xen/arch/x86/domctl.c
>>> > --- a/xen/arch/x86/domctl.c   Fri Apr 20 11:36:02 2012 -0700
>>> > +++ b/xen/arch/x86/domctl.c   Fri Apr 20 17:55:49 2012 -0700
>>> > @@ -1592,6 +1592,12 @@ void arch_get_info_guest(struct vcpu *v,
>>> >          c.nat->user_regs.fs = sreg.sel;
>>> >          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
>>>
>>> If you do anything like this, do it completely please (i.e. fill all three
>>> base address fields instead of just one).
>>>
>>
>> Sure. I was not sure if it was ok to add fields to the vcpu context
>> structure which is why I didn't do it across the board. I will do so and
>> resubmit.
>
> I don't see what fields you would need to add.

Don't I need to add ss_base, cs_base, es_base, ds_base to
vcpu_guest_context? I am assuming both 32-bit and 64-bit cases.

Aravindh

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] xen: Add GS base to HVM VCPU context
  2012-04-23 19:11       ` Aravindh Puthiyaparambil
@ 2012-04-23 21:04         ` Keir Fraser
  2012-04-23 22:11           ` Aravindh Puthiyaparambil
  0 siblings, 1 reply; 7+ messages in thread
From: Keir Fraser @ 2012-04-23 21:04 UTC (permalink / raw)
  To: Aravindh Puthiyaparambil, Jan Beulich; +Cc: xen-devel

On 23/04/2012 20:11, "Aravindh Puthiyaparambil" <aravindh@virtuata.com>
wrote:

>>>>> +#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
>>>> 
>>>> If you do anything like this, do it completely please (i.e. fill all three
>>>> base address fields instead of just one).
>>>> 
>>> 
>>> Sure. I was not sure if it was ok to add fields to the vcpu context
>>> structure which is why I didn't do it across the board. I will do so and
>>> resubmit.
>> 
>> I don't see what fields you would need to add.
> 
> Don't I need to add ss_base, cs_base, es_base, ds_base to
> vcpu_guest_context? I am assuming both 32-bit and 64-bit cases.

Only the existing (x86_64-only) fs_base, gs_base_kernel, gs_base_user fields
need be filled in. All other base addresses are zero in 64-bit mode, and in
32-bit mode the base addresses are obtained from the GDT/LDT when the
segment register is loaded, and so do not need to be stored in the
vcpu_context.

 -- Keir

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] xen: Add GS base to HVM VCPU context
  2012-04-23 21:04         ` Keir Fraser
@ 2012-04-23 22:11           ` Aravindh Puthiyaparambil
  0 siblings, 0 replies; 7+ messages in thread
From: Aravindh Puthiyaparambil @ 2012-04-23 22:11 UTC (permalink / raw)
  To: Keir Fraser; +Cc: Jan Beulich, xen-devel

On Mon, Apr 23, 2012 at 2:04 PM, Keir Fraser <keir.xen@gmail.com> wrote:
> On 23/04/2012 20:11, "Aravindh Puthiyaparambil" <aravindh@virtuata.com>
> wrote:
>
>>>>>> +#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
>>>>>
>>>>> If you do anything like this, do it completely please (i.e. fill all three
>>>>> base address fields instead of just one).
>>>>>
>>>>
>>>> Sure. I was not sure if it was ok to add fields to the vcpu context
>>>> structure which is why I didn't do it across the board. I will do so and
>>>> resubmit.
>>>
>>> I don't see what fields you would need to add.
>>
>> Don't I need to add ss_base, cs_base, es_base, ds_base to
>> vcpu_guest_context? I am assuming both 32-bit and 64-bit cases.
>
> Only the existing (x86_64-only) fs_base, gs_base_kernel, gs_base_user fields
> need be filled in. All other base addresses are zero in 64-bit mode, and in
> 32-bit mode the base addresses are obtained from the GDT/LDT when the
> segment register is loaded, and so do not need to be stored in the
> vcpu_context.

Understood. I will resubmit with fs_based filled in.

Aravindh

>  -- Keir
>
>> Aravindh
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@lists.xen.org
>> http://lists.xen.org/xen-devel
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-04-23 22:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-21  0:58 [PATCH] xen: Add GS base to HVM VCPU context Aravindh Puthiyaparambil
2012-04-23  7:41 ` Jan Beulich
2012-04-23  7:47   ` Aravindh Puthiyaparambil
2012-04-23  7:53     ` Jan Beulich
2012-04-23 19:11       ` Aravindh Puthiyaparambil
2012-04-23 21:04         ` Keir Fraser
2012-04-23 22:11           ` Aravindh Puthiyaparambil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.