]> 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 0ae6b9961985e46580671b31962fda841646064d..c6ce2452f10ce2dba165593d3492a9eb5056f4d3 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.
  */
@@ -58,6 +64,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"