aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/cpu
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/kernel/cpu')
-rw-r--r--arch/sh/kernel/cpu/sh4/fpu.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/arch/sh/kernel/cpu/sh4/fpu.c b/arch/sh/kernel/cpu/sh4/fpu.c
index e3ea5411da6d..d79226fa59d1 100644
--- a/arch/sh/kernel/cpu/sh4/fpu.c
+++ b/arch/sh/kernel/cpu/sh4/fpu.c
@@ -483,18 +483,18 @@ BUILD_TRAP_HANDLER(fpu_error)
483 force_sig(SIGFPE, tsk); 483 force_sig(SIGFPE, tsk);
484} 484}
485 485
486BUILD_TRAP_HANDLER(fpu_state_restore) 486void fpu_state_restore(struct pt_regs *regs)
487{ 487{
488 struct task_struct *tsk = current; 488 struct task_struct *tsk = current;
489 TRAP_HANDLER_DECL;
490 489
491 grab_fpu(regs); 490 grab_fpu(regs);
492 if (!user_mode(regs)) { 491 if (unlikely(!user_mode(regs))) {
493 printk(KERN_ERR "BUG: FPU is used in kernel mode.\n"); 492 printk(KERN_ERR "BUG: FPU is used in kernel mode.\n");
493 BUG();
494 return; 494 return;
495 } 495 }
496 496
497 if (used_math()) { 497 if (likely(used_math())) {
498 /* Using the FPU again. */ 498 /* Using the FPU again. */
499 restore_fpu(tsk); 499 restore_fpu(tsk);
500 } else { 500 } else {
@@ -503,4 +503,12 @@ BUILD_TRAP_HANDLER(fpu_state_restore)
503 set_used_math(); 503 set_used_math();
504 } 504 }
505 set_tsk_thread_flag(tsk, TIF_USEDFPU); 505 set_tsk_thread_flag(tsk, TIF_USEDFPU);
506 tsk->fpu_counter++;
507}
508
509BUILD_TRAP_HANDLER(fpu_state_restore)
510{
511 TRAP_HANDLER_DECL;
512
513 fpu_state_restore(regs);
506} 514}