x86: Add FS and GS base to HVM VCPU context
authorAravindh Puthiyaparambil <aravindh@virtuata.com>
Fri, 27 Apr 2012 15:57:55 +0000 (17:57 +0200)
committerAravindh Puthiyaparambil <aravindh@virtuata.com>
Fri, 27 Apr 2012 15:57:55 +0000 (17:57 +0200)
Add FS and GS base to the HVM VCPU context returned by
xc_vcpu_getcontext().

Signed-off-by: Aravindh Puthiyaparambil <aravindh@virtuata.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/domctl.c

index 168147fa986d55119581cf7c5b4d50bbe33662ac..a79f581e1902cd44dad5dbf5f2b4fc7dfe65db01 100644 (file)
@@ -1590,8 +1590,23 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
         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
     {