]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/mips/kernel/ptrace32.c
Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
[linux-2.6-omap-h63xx.git] / arch / mips / kernel / ptrace32.c
index 0d5cf97af727e3c39fd6c3e3fa965979c2a517bf..f2bffed94fa312ba4c9b0c8f68a8d7b79cb58b32 100644 (file)
 #include <asm/uaccess.h>
 #include <asm/bootinfo.h>
 
-int ptrace_getregs (struct task_struct *child, __s64 __user *data);
-int ptrace_setregs (struct task_struct *child, __s64 __user *data);
+int ptrace_getregs(struct task_struct *child, __s64 __user *data);
+int ptrace_setregs(struct task_struct *child, __s64 __user *data);
 
-int ptrace_getfpregs (struct task_struct *child, __u32 __user *data);
-int ptrace_setfpregs (struct task_struct *child, __u32 __user *data);
+int ptrace_getfpregs(struct task_struct *child, __u32 __user *data);
+int ptrace_setfpregs(struct task_struct *child, __u32 __user *data);
 
 /*
  * Tracing a 32-bit process with a 64-bit strace and vice versa will not
@@ -166,20 +166,28 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
                        tmp = regs->lo;
                        break;
                case FPC_CSR:
-                       if (cpu_has_fpu)
-                               tmp = child->thread.fpu.hard.fcr31;
-                       else
-                               tmp = child->thread.fpu.soft.fcr31;
+                       tmp = child->thread.fpu.fcr31;
                        break;
                case FPC_EIR: { /* implementation / version register */
                        unsigned int flags;
+#ifdef CONFIG_MIPS_MT_SMTC
+                       unsigned int irqflags;
+                       unsigned int mtflags;
+#endif /* CONFIG_MIPS_MT_SMTC */
 
+                       preempt_disable();
                        if (!cpu_has_fpu) {
+                               preempt_enable();
                                tmp = 0;
                                break;
                        }
 
-                       preempt_disable();
+#ifdef CONFIG_MIPS_MT_SMTC
+                       /* Read-modify-write of Status must be atomic */
+                       local_irq_save(irqflags);
+                       mtflags = dmt();
+#endif /* CONFIG_MIPS_MT_SMTC */
+
                        if (cpu_has_mipsmt) {
                                unsigned int vpflags = dvpe();
                                flags = read_c0_status();
@@ -193,6 +201,10 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
                                __asm__ __volatile__("cfc1\t%0,$0": "=r" (tmp));
                                write_c0_status(flags);
                        }
+#ifdef CONFIG_MIPS_MT_SMTC
+                       emt(mtflags);
+                       local_irq_restore(irqflags);
+#endif /* CONFIG_MIPS_MT_SMTC */
                        preempt_enable();
                        break;
                }
@@ -274,9 +286,9 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
 
                        if (!tsk_used_math(child)) {
                                /* FP not yet used  */
-                               memset(&child->thread.fpu.hard, ~0,
-                                      sizeof(child->thread.fpu.hard));
-                               child->thread.fpu.hard.fcr31 = 0;
+                               memset(&child->thread.fpu, ~0,
+                                      sizeof(child->thread.fpu));
+                               child->thread.fpu.fcr31 = 0;
                        }
                        /*
                         * The odd registers are actually the high order bits
@@ -304,10 +316,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
                        regs->lo = data;
                        break;
                case FPC_CSR:
-                       if (cpu_has_fpu)
-                               child->thread.fpu.hard.fcr31 = data;
-                       else
-                               child->thread.fpu.soft.fcr31 = data;
+                       child->thread.fpu.fcr31 = data;
                        break;
                case DSP_BASE ... DSP_BASE + 5: {
                        dspreg_t *dregs;
@@ -337,19 +346,19 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
                }
 
        case PTRACE_GETREGS:
-               ret = ptrace_getregs (child, (__u64 __user *) (__u64) data);
+               ret = ptrace_getregs(child, (__u64 __user *) (__u64) data);
                break;
 
        case PTRACE_SETREGS:
-               ret = ptrace_setregs (child, (__u64 __user *) (__u64) data);
+               ret = ptrace_setregs(child, (__u64 __user *) (__u64) data);
                break;
 
        case PTRACE_GETFPREGS:
-               ret = ptrace_getfpregs (child, (__u32 __user *) (__u64) data);
+               ret = ptrace_getfpregs(child, (__u32 __user *) (__u64) data);
                break;
 
        case PTRACE_SETFPREGS:
-               ret = ptrace_setfpregs (child, (__u32 __user *) (__u64) data);
+               ret = ptrace_setfpregs(child, (__u32 __user *) (__u64) data);
                break;
 
        case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */