diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /arch/sh/include/asm/fpu.h | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'arch/sh/include/asm/fpu.h')
-rw-r--r-- | arch/sh/include/asm/fpu.h | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/arch/sh/include/asm/fpu.h b/arch/sh/include/asm/fpu.h index 1d3aee04b5cc..06c4281aab65 100644 --- a/arch/sh/include/asm/fpu.h +++ b/arch/sh/include/asm/fpu.h | |||
@@ -2,8 +2,8 @@ | |||
2 | #define __ASM_SH_FPU_H | 2 | #define __ASM_SH_FPU_H |
3 | 3 | ||
4 | #ifndef __ASSEMBLY__ | 4 | #ifndef __ASSEMBLY__ |
5 | #include <linux/preempt.h> | 5 | |
6 | #include <asm/ptrace.h> | 6 | struct task_struct; |
7 | 7 | ||
8 | #ifdef CONFIG_SH_FPU | 8 | #ifdef CONFIG_SH_FPU |
9 | static inline void release_fpu(struct pt_regs *regs) | 9 | static inline void release_fpu(struct pt_regs *regs) |
@@ -16,59 +16,56 @@ static inline void grab_fpu(struct pt_regs *regs) | |||
16 | regs->sr &= ~SR_FD; | 16 | regs->sr &= ~SR_FD; |
17 | } | 17 | } |
18 | 18 | ||
19 | struct task_struct; | 19 | extern void save_fpu(struct task_struct *__tsk); |
20 | 20 | extern void restore_fpu(struct task_struct *__tsk); | |
21 | extern void save_fpu(struct task_struct *__tsk, struct pt_regs *regs); | 21 | extern void fpu_state_restore(struct pt_regs *regs); |
22 | extern void __fpu_state_restore(void); | ||
22 | #else | 23 | #else |
23 | 24 | #define save_fpu(tsk) do { } while (0) | |
24 | #define release_fpu(regs) do { } while (0) | 25 | #define restore_fpu(tsk) do { } while (0) |
25 | #define grab_fpu(regs) do { } while (0) | 26 | #define release_fpu(regs) do { } while (0) |
26 | 27 | #define grab_fpu(regs) do { } while (0) | |
27 | static inline void save_fpu(struct task_struct *tsk, struct pt_regs *regs) | 28 | #define fpu_state_restore(regs) do { } while (0) |
28 | { | 29 | #define __fpu_state_restore(regs) do { } while (0) |
29 | clear_tsk_thread_flag(tsk, TIF_USEDFPU); | ||
30 | } | ||
31 | #endif | 30 | #endif |
32 | 31 | ||
33 | struct user_regset; | 32 | struct user_regset; |
34 | 33 | ||
35 | extern int do_fpu_inst(unsigned short, struct pt_regs *); | 34 | extern int do_fpu_inst(unsigned short, struct pt_regs *); |
35 | extern int init_fpu(struct task_struct *); | ||
36 | 36 | ||
37 | extern int fpregs_get(struct task_struct *target, | 37 | extern int fpregs_get(struct task_struct *target, |
38 | const struct user_regset *regset, | 38 | const struct user_regset *regset, |
39 | unsigned int pos, unsigned int count, | 39 | unsigned int pos, unsigned int count, |
40 | void *kbuf, void __user *ubuf); | 40 | void *kbuf, void __user *ubuf); |
41 | 41 | ||
42 | static inline void __unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs) | ||
43 | { | ||
44 | if (task_thread_info(tsk)->status & TS_USEDFPU) { | ||
45 | task_thread_info(tsk)->status &= ~TS_USEDFPU; | ||
46 | save_fpu(tsk); | ||
47 | release_fpu(regs); | ||
48 | } else | ||
49 | tsk->fpu_counter = 0; | ||
50 | } | ||
51 | |||
42 | static inline void unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs) | 52 | static inline void unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs) |
43 | { | 53 | { |
44 | preempt_disable(); | 54 | preempt_disable(); |
45 | if (test_tsk_thread_flag(tsk, TIF_USEDFPU)) | 55 | __unlazy_fpu(tsk, regs); |
46 | save_fpu(tsk, regs); | ||
47 | preempt_enable(); | 56 | preempt_enable(); |
48 | } | 57 | } |
49 | 58 | ||
50 | static inline void clear_fpu(struct task_struct *tsk, struct pt_regs *regs) | 59 | static inline void clear_fpu(struct task_struct *tsk, struct pt_regs *regs) |
51 | { | 60 | { |
52 | preempt_disable(); | 61 | preempt_disable(); |
53 | if (test_tsk_thread_flag(tsk, TIF_USEDFPU)) { | 62 | if (task_thread_info(tsk)->status & TS_USEDFPU) { |
54 | clear_tsk_thread_flag(tsk, TIF_USEDFPU); | 63 | task_thread_info(tsk)->status &= ~TS_USEDFPU; |
55 | release_fpu(regs); | 64 | release_fpu(regs); |
56 | } | 65 | } |
57 | preempt_enable(); | 66 | preempt_enable(); |
58 | } | 67 | } |
59 | 68 | ||
60 | static inline int init_fpu(struct task_struct *tsk) | ||
61 | { | ||
62 | if (tsk_used_math(tsk)) { | ||
63 | if ((boot_cpu_data.flags & CPU_HAS_FPU) && tsk == current) | ||
64 | unlazy_fpu(tsk, task_pt_regs(tsk)); | ||
65 | return 0; | ||
66 | } | ||
67 | |||
68 | set_stopped_child_used_math(tsk); | ||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | #endif /* __ASSEMBLY__ */ | 69 | #endif /* __ASSEMBLY__ */ |
73 | 70 | ||
74 | #endif /* __ASM_SH_FPU_H */ | 71 | #endif /* __ASM_SH_FPU_H */ |