diff options
author | Paul Mundt <lethal@linux-sh.org> | 2007-11-22 03:30:50 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-01-27 23:18:55 -0500 |
commit | 332fd57b92d26e2ac6112340b98e92bb76117a41 (patch) | |
tree | fbbc00a900299ad91f46a74b8f2d42efaf4809af /include/asm-sh | |
parent | b6d7b666097e79a8908e3c43fd55fd291a95e133 (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 'include/asm-sh')
-rw-r--r-- | include/asm-sh/fpu.h | 44 | ||||
-rw-r--r-- | include/asm-sh/processor.h | 2 | ||||
-rw-r--r-- | include/asm-sh/processor_32.h | 26 | ||||
-rw-r--r-- | include/asm-sh/processor_64.h | 16 |
4 files changed, 45 insertions, 43 deletions
diff --git a/include/asm-sh/fpu.h b/include/asm-sh/fpu.h new file mode 100644 index 000000000000..33db698a6b4d --- /dev/null +++ b/include/asm-sh/fpu.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef __ASM_SH_FPU_H | ||
2 | #define __ASM_SH_FPU_H | ||
3 | |||
4 | #define SR_FD 0x00008000 | ||
5 | |||
6 | #ifndef __ASSEMBLY__ | ||
7 | #include <asm/ptrace.h> | ||
8 | |||
9 | #ifdef CONFIG_SH_FPU | ||
10 | static inline void release_fpu(struct pt_regs *regs) | ||
11 | { | ||
12 | regs->sr |= SR_FD; | ||
13 | } | ||
14 | |||
15 | static inline void grab_fpu(struct pt_regs *regs) | ||
16 | { | ||
17 | regs->sr &= ~SR_FD; | ||
18 | } | ||
19 | |||
20 | struct task_struct; | ||
21 | |||
22 | extern void save_fpu(struct task_struct *__tsk, struct pt_regs *regs); | ||
23 | #else | ||
24 | #define release_fpu(regs) do { } while (0) | ||
25 | #define grab_fpu(regs) do { } while (0) | ||
26 | #define save_fpu(tsk, regs) do { } while (0) | ||
27 | #endif | ||
28 | |||
29 | #define unlazy_fpu(tsk, regs) do { \ | ||
30 | if (test_tsk_thread_flag(tsk, TIF_USEDFPU)) { \ | ||
31 | save_fpu(tsk, regs); \ | ||
32 | } \ | ||
33 | } while (0) | ||
34 | |||
35 | #define clear_fpu(tsk, regs) do { \ | ||
36 | if (test_tsk_thread_flag(tsk, TIF_USEDFPU)) { \ | ||
37 | clear_tsk_thread_flag(tsk, TIF_USEDFPU); \ | ||
38 | release_fpu(regs); \ | ||
39 | } \ | ||
40 | } while (0) | ||
41 | |||
42 | #endif /* __ASSEMBLY__ */ | ||
43 | |||
44 | #endif /* __ASM_SH_FPU_H */ | ||
diff --git a/include/asm-sh/processor.h b/include/asm-sh/processor.h index f3bd82e95898..3ae2a1c223f2 100644 --- a/include/asm-sh/processor.h +++ b/include/asm-sh/processor.h | |||
@@ -2,9 +2,9 @@ | |||
2 | #define __ASM_SH_PROCESSOR_H | 2 | #define __ASM_SH_PROCESSOR_H |
3 | 3 | ||
4 | #include <asm/cpu-features.h> | 4 | #include <asm/cpu-features.h> |
5 | #include <asm/fpu.h> | ||
5 | 6 | ||
6 | #ifndef __ASSEMBLY__ | 7 | #ifndef __ASSEMBLY__ |
7 | |||
8 | /* | 8 | /* |
9 | * CPU type and hardware bug flags. Kept separately for each CPU. | 9 | * CPU type and hardware bug flags. Kept separately for each CPU. |
10 | * | 10 | * |
diff --git a/include/asm-sh/processor_32.h b/include/asm-sh/processor_32.h index 1ad74633c009..a7edaa1a870c 100644 --- a/include/asm-sh/processor_32.h +++ b/include/asm-sh/processor_32.h | |||
@@ -65,7 +65,6 @@ extern struct sh_cpuinfo cpu_data[]; | |||
65 | * IMASK-bit: | 65 | * IMASK-bit: |
66 | * Interrupt level mask | 66 | * Interrupt level mask |
67 | */ | 67 | */ |
68 | #define SR_FD 0x00008000 | ||
69 | #define SR_DSP 0x00001000 | 68 | #define SR_DSP 0x00001000 |
70 | #define SR_IMASK 0x000000f0 | 69 | #define SR_IMASK 0x000000f0 |
71 | 70 | ||
@@ -178,31 +177,6 @@ static __inline__ void enable_fpu(void) | |||
178 | : "r" (~SR_FD)); | 177 | : "r" (~SR_FD)); |
179 | } | 178 | } |
180 | 179 | ||
181 | static __inline__ void release_fpu(struct pt_regs *regs) | ||
182 | { | ||
183 | regs->sr |= SR_FD; | ||
184 | } | ||
185 | |||
186 | static __inline__ void grab_fpu(struct pt_regs *regs) | ||
187 | { | ||
188 | regs->sr &= ~SR_FD; | ||
189 | } | ||
190 | |||
191 | extern void save_fpu(struct task_struct *__tsk, struct pt_regs *regs); | ||
192 | |||
193 | #define unlazy_fpu(tsk, regs) do { \ | ||
194 | if (test_tsk_thread_flag(tsk, TIF_USEDFPU)) { \ | ||
195 | save_fpu(tsk, regs); \ | ||
196 | } \ | ||
197 | } while (0) | ||
198 | |||
199 | #define clear_fpu(tsk, regs) do { \ | ||
200 | if (test_tsk_thread_flag(tsk, TIF_USEDFPU)) { \ | ||
201 | clear_tsk_thread_flag(tsk, TIF_USEDFPU); \ | ||
202 | release_fpu(regs); \ | ||
203 | } \ | ||
204 | } while (0) | ||
205 | |||
206 | /* Double presision, NANS as NANS, rounding to nearest, no exceptions */ | 180 | /* Double presision, NANS as NANS, rounding to nearest, no exceptions */ |
207 | #define FPSCR_INIT 0x00080000 | 181 | #define FPSCR_INIT 0x00080000 |
208 | 182 | ||
diff --git a/include/asm-sh/processor_64.h b/include/asm-sh/processor_64.h index f54648229231..99c22b14a85b 100644 --- a/include/asm-sh/processor_64.h +++ b/include/asm-sh/processor_64.h | |||
@@ -102,8 +102,6 @@ extern struct sh_cpuinfo cpu_data[]; | |||
102 | * Single step bit | 102 | * Single step bit |
103 | * | 103 | * |
104 | */ | 104 | */ |
105 | #define SR_FD 0x00008000 | ||
106 | |||
107 | #if defined(CONFIG_SH64_SR_WATCH) | 105 | #if defined(CONFIG_SH64_SR_WATCH) |
108 | #define SR_MMU 0x84000000 | 106 | #define SR_MMU 0x84000000 |
109 | #else | 107 | #else |
@@ -243,16 +241,6 @@ static inline void enable_fpu(void) | |||
243 | : "r" (~SR_FD)); | 241 | : "r" (~SR_FD)); |
244 | } | 242 | } |
245 | 243 | ||
246 | static inline void release_fpu(struct pt_regs *regs) | ||
247 | { | ||
248 | regs->sr |= SR_FD; | ||
249 | } | ||
250 | |||
251 | static inline void grab_fpu(struct pt_regs *regs) | ||
252 | { | ||
253 | regs->sr &= ~SR_FD; | ||
254 | } | ||
255 | |||
256 | /* Round to nearest, no exceptions on inexact, overflow, underflow, | 244 | /* Round to nearest, no exceptions on inexact, overflow, underflow, |
257 | zero-divide, invalid. Configure option for whether to flush denorms to | 245 | zero-divide, invalid. Configure option for whether to flush denorms to |
258 | zero, or except if a denorm is encountered. */ | 246 | zero, or except if a denorm is encountered. */ |
@@ -263,13 +251,9 @@ static inline void grab_fpu(struct pt_regs *regs) | |||
263 | #endif | 251 | #endif |
264 | 252 | ||
265 | #ifdef CONFIG_SH_FPU | 253 | #ifdef CONFIG_SH_FPU |
266 | /* Save the current FP regs */ | ||
267 | void fpsave(struct sh_fpu_hard_struct *fpregs); | ||
268 | |||
269 | /* Initialise the FP state of a task */ | 254 | /* Initialise the FP state of a task */ |
270 | void fpinit(struct sh_fpu_hard_struct *fpregs); | 255 | void fpinit(struct sh_fpu_hard_struct *fpregs); |
271 | #else | 256 | #else |
272 | #define fpsave(fpregs) do { } while (0) | ||
273 | #define fpinit(fpregs) do { } while (0) | 257 | #define fpinit(fpregs) do { } while (0) |
274 | #endif | 258 | #endif |
275 | 259 | ||