summaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/cpu/sh2a
diff options
context:
space:
mode:
authorPaul Mundt2009-11-24 09:56:17 +0100
committerPaul Mundt2009-11-24 09:56:17 +0100
commit0f09e197a39c081fa8c2752ee65919cb6cba963a (patch)
tree4b3e8f930f317d775b814c65898d100ba1450241 /arch/sh/kernel/cpu/sh2a
parentsh: Minor optimisations to FPU handling (diff)
downloadkernel-qcow2-linux-0f09e197a39c081fa8c2752ee65919cb6cba963a.tar.gz
kernel-qcow2-linux-0f09e197a39c081fa8c2752ee65919cb6cba963a.tar.xz
kernel-qcow2-linux-0f09e197a39c081fa8c2752ee65919cb6cba963a.zip
sh: Apply the sleazy FPU changes for SH-2A FPU as well.
This plugs in the fpu_counter manipulation for the SH-2A side also. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/cpu/sh2a')
-rw-r--r--arch/sh/kernel/cpu/sh2a/fpu.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/arch/sh/kernel/cpu/sh2a/fpu.c b/arch/sh/kernel/cpu/sh2a/fpu.c
index 13817ee49d52..d395ce5740e7 100644
--- a/arch/sh/kernel/cpu/sh2a/fpu.c
+++ b/arch/sh/kernel/cpu/sh2a/fpu.c
@@ -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);
}