aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/cpu/sh5/fpu.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2007-11-22 03:30:50 -0500
committerPaul Mundt <lethal@linux-sh.org>2008-01-27 23:18:55 -0500
commit332fd57b92d26e2ac6112340b98e92bb76117a41 (patch)
treefbbc00a900299ad91f46a74b8f2d42efaf4809af /arch/sh/kernel/cpu/sh5/fpu.c
parentb6d7b666097e79a8908e3c43fd55fd291a95e133 (diff)
sh: Bring the SH-5 FPU in line with the SH-4 FPU API.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/cpu/sh5/fpu.c')
-rw-r--r--arch/sh/kernel/cpu/sh5/fpu.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/arch/sh/kernel/cpu/sh5/fpu.c b/arch/sh/kernel/cpu/sh5/fpu.c
index d3f5e7468dfe..5a391b1a00e2 100644
--- a/arch/sh/kernel/cpu/sh5/fpu.c
+++ b/arch/sh/kernel/cpu/sh5/fpu.c
@@ -30,12 +30,12 @@
30 30
31static union sh_fpu_union init_fpuregs = { 31static union sh_fpu_union init_fpuregs = {
32 .hard = { 32 .hard = {
33 .fp_regs = { [0 ... 63] = sNAN32 }, 33 .fp_regs = { [0 ... 63] = sNAN32 },
34 .fpscr = FPSCR_INIT 34 .fpscr = FPSCR_INIT
35 } 35 }
36}; 36};
37 37
38inline void fpsave(struct sh_fpu_hard_struct *fpregs) 38void save_fpu(struct task_struct *tsk, struct pt_regs *regs)
39{ 39{
40 asm volatile("fst.p %0, (0*8), fp0\n\t" 40 asm volatile("fst.p %0, (0*8), fp0\n\t"
41 "fst.p %0, (1*8), fp2\n\t" 41 "fst.p %0, (1*8), fp2\n\t"
@@ -73,11 +73,10 @@ inline void fpsave(struct sh_fpu_hard_struct *fpregs)
73 "fgetscr fr63\n\t" 73 "fgetscr fr63\n\t"
74 "fst.s %0, (32*8), fr63\n\t" 74 "fst.s %0, (32*8), fr63\n\t"
75 : /* no output */ 75 : /* no output */
76 : "r" (fpregs) 76 : "r" (&tsk->thread.fpu.hard)
77 : "memory"); 77 : "memory");
78} 78}
79 79
80
81static inline void 80static inline void
82fpload(struct sh_fpu_hard_struct *fpregs) 81fpload(struct sh_fpu_hard_struct *fpregs)
83{ 82{
@@ -153,10 +152,10 @@ do_fpu_state_restore(unsigned long ex, struct pt_regs *regs)
153 return; 152 return;
154 153
155 enable_fpu(); 154 enable_fpu();
156 if (last_task_used_math != NULL) { 155 if (last_task_used_math != NULL)
157 /* Other processes fpu state, save away */ 156 /* Other processes fpu state, save away */
158 fpsave(&last_task_used_math->thread.fpu.hard); 157 save_fpu(last_task_used_math, regs);
159 } 158
160 last_task_used_math = current; 159 last_task_used_math = current;
161 if (used_math()) { 160 if (used_math()) {
162 fpload(&current->thread.fpu.hard); 161 fpload(&current->thread.fpu.hard);
@@ -167,4 +166,3 @@ do_fpu_state_restore(unsigned long ex, struct pt_regs *regs)
167 } 166 }
168 disable_fpu(); 167 disable_fpu();
169} 168}
170