]> Pileus Git - ~andy/linux/blobdiff - arch/powerpc/kernel/ptrace.c
Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git...
[~andy/linux] / arch / powerpc / kernel / ptrace.c
index 9aec4bb1a551ee7a59574156108ca6d7a85e4680..5de73dbd15c7e404a16257ae5239e9b1af293f65 100644 (file)
@@ -1494,9 +1494,14 @@ long arch_ptrace(struct task_struct *child, long request,
                if (index < PT_FPR0) {
                        tmp = ptrace_get_reg(child, (int) index);
                } else {
+                       unsigned int fpidx = index - PT_FPR0;
+
                        flush_fp_to_thread(child);
-                       tmp = ((unsigned long *)child->thread.fpr)
-                               [TS_FPRWIDTH * (index - PT_FPR0)];
+                       if (fpidx < (PT_FPSCR - PT_FPR0))
+                               tmp = ((unsigned long *)child->thread.fpr)
+                                       [fpidx * TS_FPRWIDTH];
+                       else
+                               tmp = child->thread.fpscr.val;
                }
                ret = put_user(tmp, datalp);
                break;
@@ -1522,9 +1527,14 @@ long arch_ptrace(struct task_struct *child, long request,
                if (index < PT_FPR0) {
                        ret = ptrace_put_reg(child, index, data);
                } else {
+                       unsigned int fpidx = index - PT_FPR0;
+
                        flush_fp_to_thread(child);
-                       ((unsigned long *)child->thread.fpr)
-                               [TS_FPRWIDTH * (index - PT_FPR0)] = data;
+                       if (fpidx < (PT_FPSCR - PT_FPR0))
+                               ((unsigned long *)child->thread.fpr)
+                                       [fpidx * TS_FPRWIDTH] = data;
+                       else
+                               child->thread.fpscr.val = data;
                        ret = 0;
                }
                break;