Skip to contentSkip to conversation

xsave: extend xsave/xrstor support to all (64) features

PATCH New Wei Huang 1 participant 1 message Dec 22, 2010

lore
Share & tools
lore

Wei Huang

author
#0 lore raw

PATCH 1/2 xsave: extend xsave/xrstor support to all (64) features

This patch fixes 64bit xsave_feature support for set_xcr0(). It also turns on bit 62 for AMD lightweight profiling (LWP). The spec of LWP is available at http://developer.amd.com/cpu/lwp/Pages/default.aspx.

exporting patch:
# HG changeset patch
# User Wei Huang <[email protected]>
# Date 1293045835 21600
# Branch lwp2
# Node ID f963fa2d256d6af97e8b079191657bf55555e416 # Parent 77e98097afc63c774b329343788f71495a7e5934 Add LWP (bit 62) to XSTATE_MASK definition

xen/arch/x86/i387.c +1 -1
diff -r 77e98097afc6 -r f963fa2d256d xen/arch/x86/i387.c
@@ -187,7 +187,7 @@
      * Set CR4_OSXSAVE and run "cpuid" to get xsave_cntxt_size.
      */
     set_in_cr4(X86_CR4_OSXSAVE);
-    set_xcr0(eax & XCNTXT_MASK);
+    set_xcr0((((u64)edx << 32) | eax) & XCNTXT_MASK);
     cpuid_count(XSTATE_CPUID, 0, &eax, &ebx, &ecx, &edx);
 
     if ( cpu == 0 )
xen/include/asm-x86/i387.h +5 -4
diff -r 77e98097afc6 -r f963fa2d256d xen/include/asm-x86/i387.h
@@ -22,11 +22,12 @@
 int xsave_alloc_save_area(struct vcpu *v);
 void xsave_free_save_area(struct vcpu *v);
 
-#define XSTATE_FP       (1 << 0)
-#define XSTATE_SSE      (1 << 1)
-#define XSTATE_YMM      (1 << 2)
+#define XSTATE_FP       (1ULL << 0)
+#define XSTATE_SSE      (1ULL << 1)
+#define XSTATE_YMM      (1ULL << 2)
+#define XSTATE_LWP      (1ULL << 62) /* AMD lightweight profiling */
 #define XSTATE_FP_SSE   (XSTATE_FP | XSTATE_SSE)
-#define XCNTXT_MASK     (XSTATE_FP | XSTATE_SSE | XSTATE_YMM)
+#define XCNTXT_MASK     (XSTATE_FP | XSTATE_SSE | XSTATE_YMM | XSTATE_LWP)
 #define XSTATE_YMM_OFFSET  (512 + 64)
 #define XSTATE_YMM_SIZE    256
 #define XSAVEOPT        (1 << 0)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel