Merge branch 'dev' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
[pandora-kernel.git] / arch / powerpc / kernel / ptrace.c
index 05b7dd2..5de73db 100644 (file)
@@ -30,9 +30,6 @@
 #include <linux/seccomp.h>
 #include <linux/audit.h>
 #include <trace/syscall.h>
-#ifdef CONFIG_PPC32
-#include <linux/module.h>
-#endif
 #include <linux/hw_breakpoint.h>
 #include <linux/perf_event.h>
 
@@ -1497,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;
@@ -1525,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;