]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - arch/x86/include/asm/xsave.h
Merge branch 'x86-xsave-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[net-next-2.6.git] / arch / x86 / include / asm / xsave.h
index 06acdbd7570a571cccfa3db673837446b3d100cd..c6ce2452f10ce2dba165593d3492a9eb5056f4d3 100644 (file)
@@ -3,7 +3,8 @@
 
 #include <linux/types.h>
 #include <asm/processor.h>
-#include <asm/i387.h>
+
+#define XSTATE_CPUID           0x0000000d
 
 #define XSTATE_FP      0x1
 #define XSTATE_SSE     0x2
 
 extern unsigned int xstate_size;
 extern u64 pcntxt_mask;
-extern struct xsave_struct *init_xstate_buf;
 extern u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS];
 
-extern void xsave_cntxt_init(void);
 extern void xsave_init(void);
 extern void update_regset_xstate_info(unsigned int size, u64 xstate_mask);
 extern int init_fpu(struct task_struct *child);
@@ -127,12 +126,25 @@ static inline void xrstor_state(struct xsave_struct *fx, u64 mask)
                     :   "memory");
 }
 
+static inline void xsave_state(struct xsave_struct *fx, u64 mask)
+{
+       u32 lmask = mask;
+       u32 hmask = mask >> 32;
+
+       asm volatile(".byte " REX_PREFIX "0x0f,0xae,0x27\n\t"
+                    : : "D" (fx), "m" (*fx), "a" (lmask), "d" (hmask)
+                    :   "memory");
+}
+
 static inline void fpu_xsave(struct fpu *fpu)
 {
        /* This, however, we can work around by forcing the compiler to select
           an addressing mode that doesn't require extended registers. */
-       __asm__ __volatile__(".byte " REX_PREFIX "0x0f,0xae,0x27"
-                            : : "D" (&(fpu->state->xsave)),
-                                "a" (-1), "d"(-1) : "memory");
+       alternative_input(
+               ".byte " REX_PREFIX "0x0f,0xae,0x27",
+               ".byte " REX_PREFIX "0x0f,0xae,0x37",
+               X86_FEATURE_XSAVEOPT,
+               [fx] "D" (&fpu->state->xsave), "a" (-1), "d" (-1) :
+               "memory");
 }
 #endif