diff options
-rw-r--r-- | arch/sh/kernel/ptrace_64.c | 8 | ||||
-rw-r--r-- | arch/sh/kernel/traps_64.c | 8 | ||||
-rw-r--r-- | include/asm-sh/processor_64.h | 15 |
3 files changed, 21 insertions, 10 deletions
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c index 8a2d339cf760..14e7d5e5679a 100644 --- a/arch/sh/kernel/ptrace_64.c +++ b/arch/sh/kernel/ptrace_64.c | |||
@@ -74,9 +74,9 @@ get_fpu_long(struct task_struct *task, unsigned long addr) | |||
74 | } | 74 | } |
75 | 75 | ||
76 | if (last_task_used_math == task) { | 76 | if (last_task_used_math == task) { |
77 | grab_fpu(); | 77 | enable_fpu(); |
78 | fpsave(&task->thread.fpu.hard); | 78 | fpsave(&task->thread.fpu.hard); |
79 | release_fpu(); | 79 | disable_fpu(); |
80 | last_task_used_math = 0; | 80 | last_task_used_math = 0; |
81 | regs->sr |= SR_FD; | 81 | regs->sr |= SR_FD; |
82 | } | 82 | } |
@@ -110,9 +110,9 @@ put_fpu_long(struct task_struct *task, unsigned long addr, unsigned long data) | |||
110 | fpinit(&task->thread.fpu.hard); | 110 | fpinit(&task->thread.fpu.hard); |
111 | set_stopped_child_used_math(task); | 111 | set_stopped_child_used_math(task); |
112 | } else if (last_task_used_math == task) { | 112 | } else if (last_task_used_math == task) { |
113 | grab_fpu(); | 113 | enable_fpu(); |
114 | fpsave(&task->thread.fpu.hard); | 114 | fpsave(&task->thread.fpu.hard); |
115 | release_fpu(); | 115 | disable_fpu(); |
116 | last_task_used_math = 0; | 116 | last_task_used_math = 0; |
117 | regs->sr |= SR_FD; | 117 | regs->sr |= SR_FD; |
118 | } | 118 | } |
diff --git a/arch/sh/kernel/traps_64.c b/arch/sh/kernel/traps_64.c index 742ce18b6820..0f4ea3ac3e0b 100644 --- a/arch/sh/kernel/traps_64.c +++ b/arch/sh/kernel/traps_64.c | |||
@@ -617,9 +617,9 @@ static int misaligned_fpu_load(struct pt_regs *regs, | |||
617 | context switch the registers into memory so they can be | 617 | context switch the registers into memory so they can be |
618 | indexed by register number. */ | 618 | indexed by register number. */ |
619 | if (last_task_used_math == current) { | 619 | if (last_task_used_math == current) { |
620 | grab_fpu(); | 620 | enable_fpu(); |
621 | fpsave(¤t->thread.fpu.hard); | 621 | fpsave(¤t->thread.fpu.hard); |
622 | release_fpu(); | 622 | disable_fpu(); |
623 | last_task_used_math = NULL; | 623 | last_task_used_math = NULL; |
624 | regs->sr |= SR_FD; | 624 | regs->sr |= SR_FD; |
625 | } | 625 | } |
@@ -690,9 +690,9 @@ static int misaligned_fpu_store(struct pt_regs *regs, | |||
690 | context switch the registers into memory so they can be | 690 | context switch the registers into memory so they can be |
691 | indexed by register number. */ | 691 | indexed by register number. */ |
692 | if (last_task_used_math == current) { | 692 | if (last_task_used_math == current) { |
693 | grab_fpu(); | 693 | enable_fpu(); |
694 | fpsave(¤t->thread.fpu.hard); | 694 | fpsave(¤t->thread.fpu.hard); |
695 | release_fpu(); | 695 | disable_fpu(); |
696 | last_task_used_math = NULL; | 696 | last_task_used_math = NULL; |
697 | regs->sr |= SR_FD; | 697 | regs->sr |= SR_FD; |
698 | } | 698 | } |
diff --git a/include/asm-sh/processor_64.h b/include/asm-sh/processor_64.h index ecd6b403f7db..312fd73fb87e 100644 --- a/include/asm-sh/processor_64.h +++ b/include/asm-sh/processor_64.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <asm/page.h> | 18 | #include <asm/page.h> |
19 | #include <asm/types.h> | 19 | #include <asm/types.h> |
20 | #include <asm/cache.h> | 20 | #include <asm/cache.h> |
21 | #include <asm/ptrace.h> | ||
21 | #include <asm/cpu/registers.h> | 22 | #include <asm/cpu/registers.h> |
22 | 23 | ||
23 | /* | 24 | /* |
@@ -218,7 +219,7 @@ extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | |||
218 | * FPU lazy state save handling. | 219 | * FPU lazy state save handling. |
219 | */ | 220 | */ |
220 | 221 | ||
221 | static inline void release_fpu(void) | 222 | static inline void disable_fpu(void) |
222 | { | 223 | { |
223 | unsigned long long __dummy; | 224 | unsigned long long __dummy; |
224 | 225 | ||
@@ -230,7 +231,7 @@ static inline void release_fpu(void) | |||
230 | : "r" (SR_FD)); | 231 | : "r" (SR_FD)); |
231 | } | 232 | } |
232 | 233 | ||
233 | static inline void grab_fpu(void) | 234 | static inline void enable_fpu(void) |
234 | { | 235 | { |
235 | unsigned long long __dummy; | 236 | unsigned long long __dummy; |
236 | 237 | ||
@@ -242,6 +243,16 @@ static inline void grab_fpu(void) | |||
242 | : "r" (~SR_FD)); | 243 | : "r" (~SR_FD)); |
243 | } | 244 | } |
244 | 245 | ||
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 | |||
245 | /* Round to nearest, no exceptions on inexact, overflow, underflow, | 256 | /* Round to nearest, no exceptions on inexact, overflow, underflow, |
246 | zero-divide, invalid. Configure option for whether to flush denorms to | 257 | zero-divide, invalid. Configure option for whether to flush denorms to |
247 | zero, or except if a denorm is encountered. */ | 258 | zero, or except if a denorm is encountered. */ |