aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/include/asm/fpu.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/include/asm/fpu.h')
-rw-r--r--arch/sh/include/asm/fpu.h26
1 files changed, 15 insertions, 11 deletions
diff --git a/arch/sh/include/asm/fpu.h b/arch/sh/include/asm/fpu.h
index bfd78e19de1b..d7709c06fac4 100644
--- a/arch/sh/include/asm/fpu.h
+++ b/arch/sh/include/asm/fpu.h
@@ -18,17 +18,14 @@ static inline void grab_fpu(struct pt_regs *regs)
18 18
19struct task_struct; 19struct task_struct;
20 20
21extern void save_fpu(struct task_struct *__tsk, struct pt_regs *regs); 21extern void save_fpu(struct task_struct *__tsk);
22void fpu_state_restore(struct pt_regs *regs); 22void fpu_state_restore(struct pt_regs *regs);
23#else 23#else
24 24
25#define save_fpu(tsk) do { } while (0)
25#define release_fpu(regs) do { } while (0) 26#define release_fpu(regs) do { } while (0)
26#define grab_fpu(regs) do { } while (0) 27#define grab_fpu(regs) do { } while (0)
27 28
28static inline void save_fpu(struct task_struct *tsk, struct pt_regs *regs)
29{
30 clear_tsk_thread_flag(tsk, TIF_USEDFPU);
31}
32#endif 29#endif
33 30
34struct user_regset; 31struct user_regset;
@@ -40,21 +37,28 @@ extern int fpregs_get(struct task_struct *target,
40 unsigned int pos, unsigned int count, 37 unsigned int pos, unsigned int count,
41 void *kbuf, void __user *ubuf); 38 void *kbuf, void __user *ubuf);
42 39
40static inline void __unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs)
41{
42 if (task_thread_info(tsk)->status & TS_USEDFPU) {
43 task_thread_info(tsk)->status &= ~TS_USEDFPU;
44 save_fpu(tsk);
45 release_fpu(regs);
46 } else
47 tsk->fpu_counter = 0;
48}
49
43static inline void unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs) 50static inline void unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs)
44{ 51{
45 preempt_disable(); 52 preempt_disable();
46 if (test_tsk_thread_flag(tsk, TIF_USEDFPU)) 53 __unlazy_fpu(tsk, regs);
47 save_fpu(tsk, regs);
48 else
49 tsk->fpu_counter = 0;
50 preempt_enable(); 54 preempt_enable();
51} 55}
52 56
53static inline void clear_fpu(struct task_struct *tsk, struct pt_regs *regs) 57static inline void clear_fpu(struct task_struct *tsk, struct pt_regs *regs)
54{ 58{
55 preempt_disable(); 59 preempt_disable();
56 if (test_tsk_thread_flag(tsk, TIF_USEDFPU)) { 60 if (task_thread_info(tsk)->status & TS_USEDFPU) {
57 clear_tsk_thread_flag(tsk, TIF_USEDFPU); 61 task_thread_info(tsk)->status &= ~TS_USEDFPU;
58 release_fpu(regs); 62 release_fpu(regs);
59 } 63 }
60 preempt_enable(); 64 preempt_enable();