]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - arch/x86/include/asm/xsave.h
Merge branches 'x86-cleanups-for-linus', 'x86-vmware-for-linus', 'x86-mtrr-for-linus...
[karo-tx-linux.git] / arch / x86 / include / asm / xsave.h
index 2c4390cae22883014816647319fb6569d6867c2c..06acdbd7570a571cccfa3db673837446b3d100cd 100644 (file)
 
 #define FXSAVE_SIZE    512
 
+#define XSAVE_HDR_SIZE     64
+#define XSAVE_HDR_OFFSET    FXSAVE_SIZE
+
+#define XSAVE_YMM_SIZE     256
+#define XSAVE_YMM_OFFSET    (XSAVE_HDR_SIZE + XSAVE_HDR_OFFSET)
+
 /*
  * These are the features that the OS can handle currently.
  */
@@ -59,6 +65,16 @@ static inline int fpu_xrstor_checking(struct fpu *fpu)
 static inline int xsave_user(struct xsave_struct __user *buf)
 {
        int err;
+
+       /*
+        * Clear the xsave header first, so that reserved fields are
+        * initialized to zero.
+        */
+       err = __clear_user(&buf->xsave_hdr,
+                          sizeof(struct xsave_hdr_struct));
+       if (unlikely(err))
+               return -EFAULT;
+
        __asm__ __volatile__("1: .byte " REX_PREFIX "0x0f,0xae,0x27\n"
                             "2:\n"
                             ".section .fixup,\"ax\"\n"