diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2006-10-08 11:10:01 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-10-09 18:20:48 -0400 |
commit | e04582b7bc70b40c57287cdc24f81964ee88f565 (patch) | |
tree | a5127c2d4165e656a84612836f6326427843acca /arch/mips/kernel/ptrace.c | |
parent | f5c70dd7f384db4c524c35288d9be3ed61ac41a9 (diff) |
[MIPS] Make sure cpu_has_fpu is used only in atomic context
Make sure cpu_has_fpu (which uses smp_processor_id()) is used only in
atomic context.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/ptrace.c')
-rw-r--r-- | arch/mips/kernel/ptrace.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index 362d1728e531..258d74fd0b63 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c | |||
@@ -106,6 +106,7 @@ int ptrace_setregs (struct task_struct *child, __s64 __user *data) | |||
106 | int ptrace_getfpregs (struct task_struct *child, __u32 __user *data) | 106 | int ptrace_getfpregs (struct task_struct *child, __u32 __user *data) |
107 | { | 107 | { |
108 | int i; | 108 | int i; |
109 | unsigned int tmp; | ||
109 | 110 | ||
110 | if (!access_ok(VERIFY_WRITE, data, 33 * 8)) | 111 | if (!access_ok(VERIFY_WRITE, data, 33 * 8)) |
111 | return -EIO; | 112 | return -EIO; |
@@ -121,10 +122,10 @@ int ptrace_getfpregs (struct task_struct *child, __u32 __user *data) | |||
121 | 122 | ||
122 | __put_user (child->thread.fpu.fcr31, data + 64); | 123 | __put_user (child->thread.fpu.fcr31, data + 64); |
123 | 124 | ||
125 | preempt_disable(); | ||
124 | if (cpu_has_fpu) { | 126 | if (cpu_has_fpu) { |
125 | unsigned int flags, tmp; | 127 | unsigned int flags; |
126 | 128 | ||
127 | preempt_disable(); | ||
128 | if (cpu_has_mipsmt) { | 129 | if (cpu_has_mipsmt) { |
129 | unsigned int vpflags = dvpe(); | 130 | unsigned int vpflags = dvpe(); |
130 | flags = read_c0_status(); | 131 | flags = read_c0_status(); |
@@ -138,11 +139,11 @@ int ptrace_getfpregs (struct task_struct *child, __u32 __user *data) | |||
138 | __asm__ __volatile__("cfc1\t%0,$0" : "=r" (tmp)); | 139 | __asm__ __volatile__("cfc1\t%0,$0" : "=r" (tmp)); |
139 | write_c0_status(flags); | 140 | write_c0_status(flags); |
140 | } | 141 | } |
141 | preempt_enable(); | ||
142 | __put_user (tmp, data + 65); | ||
143 | } else { | 142 | } else { |
144 | __put_user ((__u32) 0, data + 65); | 143 | tmp = 0; |
145 | } | 144 | } |
145 | preempt_enable(); | ||
146 | __put_user (tmp, data + 65); | ||
146 | 147 | ||
147 | return 0; | 148 | return 0; |
148 | } | 149 | } |
@@ -245,16 +246,17 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
245 | unsigned int mtflags; | 246 | unsigned int mtflags; |
246 | #endif /* CONFIG_MIPS_MT_SMTC */ | 247 | #endif /* CONFIG_MIPS_MT_SMTC */ |
247 | 248 | ||
248 | if (!cpu_has_fpu) | 249 | preempt_disable(); |
250 | if (!cpu_has_fpu) { | ||
251 | preempt_enable(); | ||
249 | break; | 252 | break; |
253 | } | ||
250 | 254 | ||
251 | #ifdef CONFIG_MIPS_MT_SMTC | 255 | #ifdef CONFIG_MIPS_MT_SMTC |
252 | /* Read-modify-write of Status must be atomic */ | 256 | /* Read-modify-write of Status must be atomic */ |
253 | local_irq_save(irqflags); | 257 | local_irq_save(irqflags); |
254 | mtflags = dmt(); | 258 | mtflags = dmt(); |
255 | #endif /* CONFIG_MIPS_MT_SMTC */ | 259 | #endif /* CONFIG_MIPS_MT_SMTC */ |
256 | |||
257 | preempt_disable(); | ||
258 | if (cpu_has_mipsmt) { | 260 | if (cpu_has_mipsmt) { |
259 | unsigned int vpflags = dvpe(); | 261 | unsigned int vpflags = dvpe(); |
260 | flags = read_c0_status(); | 262 | flags = read_c0_status(); |