aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/ptrace.c')
-rw-r--r--arch/mips/kernel/ptrace.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 122433f835e3..fcceab8f2e00 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -33,6 +33,7 @@
33#include <asm/dsp.h> 33#include <asm/dsp.h>
34#include <asm/fpu.h> 34#include <asm/fpu.h>
35#include <asm/mipsregs.h> 35#include <asm/mipsregs.h>
36#include <asm/mipsmtregs.h>
36#include <asm/pgtable.h> 37#include <asm/pgtable.h>
37#include <asm/page.h> 38#include <asm/page.h>
38#include <asm/system.h> 39#include <asm/system.h>
@@ -126,10 +127,21 @@ int ptrace_getfpregs (struct task_struct *child, __u32 __user *data)
126 127
127 __put_user (child->thread.fpu.hard.fcr31, data + 64); 128 __put_user (child->thread.fpu.hard.fcr31, data + 64);
128 129
129 flags = read_c0_status(); 130 preempt_disable();
130 __enable_fpu(); 131 if (cpu_has_mipsmt) {
131 __asm__ __volatile__("cfc1\t%0,$0" : "=r" (tmp)); 132 unsigned int vpflags = dvpe();
132 write_c0_status(flags); 133 flags = read_c0_status();
134 __enable_fpu();
135 __asm__ __volatile__("cfc1\t%0,$0" : "=r" (tmp));
136 write_c0_status(flags);
137 evpe(vpflags);
138 } else {
139 flags = read_c0_status();
140 __enable_fpu();
141 __asm__ __volatile__("cfc1\t%0,$0" : "=r" (tmp));
142 write_c0_status(flags);
143 }
144 preempt_enable();
133 __put_user (tmp, data + 65); 145 __put_user (tmp, data + 65);
134 } else { 146 } else {
135 __put_user (child->thread.fpu.soft.fcr31, data + 64); 147 __put_user (child->thread.fpu.soft.fcr31, data + 64);
@@ -284,10 +296,21 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
284 if (!cpu_has_fpu) 296 if (!cpu_has_fpu)
285 break; 297 break;
286 298
287 flags = read_c0_status(); 299 preempt_disable();
288 __enable_fpu(); 300 if (cpu_has_mipsmt) {
289 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp)); 301 unsigned int vpflags = dvpe();
290 write_c0_status(flags); 302 flags = read_c0_status();
303 __enable_fpu();
304 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
305 write_c0_status(flags);
306 evpe(vpflags);
307 } else {
308 flags = read_c0_status();
309 __enable_fpu();
310 __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
311 write_c0_status(flags);
312 }
313 preempt_enable();
291 break; 314 break;
292 } 315 }
293 case DSP_BASE ... DSP_BASE + 5: { 316 case DSP_BASE ... DSP_BASE + 5: {