sh: Apply the sleazy FPU changes for SH-2A FPU as well.
authorPaul Mundt <lethal@linux-sh.org>
Tue, 24 Nov 2009 08:56:17 +0000 (17:56 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Tue, 24 Nov 2009 08:56:17 +0000 (17:56 +0900)
This plugs in the fpu_counter manipulation for the SH-2A side also.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/kernel/cpu/sh2a/fpu.c

index 13817ee49d52b1cea2affb62b229ba0002d68fb0..d395ce5740e7dff1cd66c3f786e592a0ba9c97b2 100644 (file)
@@ -608,18 +608,18 @@ BUILD_TRAP_HANDLER(fpu_error)
        force_sig(SIGFPE, tsk);
 }
 
-BUILD_TRAP_HANDLER(fpu_state_restore)
+void fpu_state_restore(struct pt_regs *regs)
 {
        struct task_struct *tsk = current;
-       TRAP_HANDLER_DECL;
 
        grab_fpu(regs);
-       if (!user_mode(regs)) {
+       if (unlikely(!user_mode(regs))) {
                printk(KERN_ERR "BUG: FPU is used in kernel mode.\n");
+               BUG();
                return;
        }
 
-       if (used_math()) {
+       if (likely(used_math())) {
                /* Using the FPU again.  */
                restore_fpu(tsk);
        } else  {
@@ -628,4 +628,12 @@ BUILD_TRAP_HANDLER(fpu_state_restore)
                set_used_math();
        }
        task_thread_info(tsk)->status |= TS_USEDFPU;
+       tsk->fpu_counter++;
+}
+
+BUILD_TRAP_HANDLER(fpu_state_restore)
+{
+       TRAP_HANDLER_DECL;
+
+       fpu_state_restore(regs);
 }