x86: signal_32: do save_i387_xstate() at get_sigframe()
authorHiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Thu, 6 Nov 2008 02:30:25 +0000 (18:30 -0800)
committerIngo Molnar <mingo@elte.hu>
Thu, 6 Nov 2008 07:01:59 +0000 (08:01 +0100)
Impact: cleanup

move calling save_i387_xstate() into get_sigframe() from setup_sigcontext()
like 64bit.

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/signal_32.c

index a0efc1b3c4c96898bac6c2f758c530c5ca99ac05..6a05c74b40845a2de0c56a4fbad7f2912f383d1a 100644 (file)
@@ -303,11 +303,7 @@ setup_sigcontext(struct sigcontext __user *sc, void __user *fpstate,
        err |= __put_user(regs->sp, &sc->sp_at_signal);
        err |= __put_user(regs->ss, (unsigned int __user *)&sc->ss);
 
-       tmp = save_i387_xstate(fpstate);
-       if (tmp < 0)
-               err = 1;
-       else
-               err |= __put_user(tmp ? fpstate : NULL, &sc->fpstate);
+       err |= __put_user(fpstate, &sc->fpstate);
 
        /* non-iBCS2 extensions.. */
        err |= __put_user(mask, &sc->oldmask);
@@ -350,6 +346,8 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size,
        if (used_math()) {
                sp = sp - sig_xstate_size;
                *fpstate = (struct _fpstate *) sp;
+               if (save_i387_xstate(*fpstate) < 0)
+                       return (void __user *)-1L;
        }
 
        sp -= frame_size;