x86, fpu: Unify signal handling code paths for x86 and x86_64 kernels
[cascardo/linux.git] / arch / x86 / include / asm / xsave.h
index 8a1b6f9..c1d989a 100644 (file)
@@ -38,13 +38,9 @@ extern u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS];
 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);
-extern int check_for_xstate(struct i387_fxsave_struct __user *buf,
-                           void __user *fpstate,
-                           struct _fpx_sw_bytes *sw);
 
-static inline int fpu_xrstor_checking(struct fpu *fpu)
+static inline int fpu_xrstor_checking(struct xsave_struct *fx)
 {
-       struct xsave_struct *fx = &fpu->state->xsave;
        int err;
 
        asm volatile("1: .byte " REX_PREFIX "0x0f,0xae,0x2f\n\t"
@@ -69,8 +65,7 @@ static inline int xsave_user(struct xsave_struct __user *buf)
         * Clear the xsave header first, so that reserved fields are
         * initialized to zero.
         */
-       err = __clear_user(&buf->xsave_hdr,
-                          sizeof(struct xsave_hdr_struct));
+       err = __clear_user(&buf->xsave_hdr, sizeof(buf->xsave_hdr));
        if (unlikely(err))
                return -EFAULT;
 
@@ -84,9 +79,6 @@ static inline int xsave_user(struct xsave_struct __user *buf)
                             : [err] "=r" (err)
                             : "D" (buf), "a" (-1), "d" (-1), "0" (0)
                             : "memory");
-       if (unlikely(err) && __clear_user(buf, xstate_size))
-               err = -EFAULT;
-       /* No need to clear here because the caller clears USED_MATH */
        return err;
 }