summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/ptrace.c
diff options
context:
space:
mode:
authorAnton Blanchard2013-09-23 04:04:38 +0200
committerBenjamin Herrenschmidt2013-10-11 07:48:27 +0200
commit87fec0514f613f8ac43c01b0bc0bc7072c5d10ae (patch)
tree9da3fd6e0c527501160535e9095c4596fb4eb056 /arch/powerpc/kernel/ptrace.c
parentpowerpc: Fix offset of FPRs in VSX registers in little endian builds (diff)
downloadkernel-qcow2-linux-87fec0514f613f8ac43c01b0bc0bc7072c5d10ae.tar.gz
kernel-qcow2-linux-87fec0514f613f8ac43c01b0bc0bc7072c5d10ae.tar.xz
kernel-qcow2-linux-87fec0514f613f8ac43c01b0bc0bc7072c5d10ae.zip
powerpc: PTRACE_PEEKUSR/PTRACE_POKEUSER of FPR registers in little endian builds
FPRs overlap the high 64bits of the first 32 VSX registers. The ptrace FP read/write code assumes big endian ordering and grabs the lowest 64 bits. Fix this by using the TS_FPR macro which does the right thing. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/ptrace.c')
-rw-r--r--arch/powerpc/kernel/ptrace.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 9a0d24c390a3..8d5d4e921a5e 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1554,8 +1554,8 @@ long arch_ptrace(struct task_struct *child, long request,
flush_fp_to_thread(child);
if (fpidx < (PT_FPSCR - PT_FPR0))
- tmp = ((unsigned long *)child->thread.fpr)
- [fpidx * TS_FPRWIDTH];
+ memcpy(&tmp, &child->thread.TS_FPR(fpidx),
+ sizeof(long));
else
tmp = child->thread.fpscr.val;
}
@@ -1587,8 +1587,8 @@ long arch_ptrace(struct task_struct *child, long request,
flush_fp_to_thread(child);
if (fpidx < (PT_FPSCR - PT_FPR0))
- ((unsigned long *)child->thread.fpr)
- [fpidx * TS_FPRWIDTH] = data;
+ memcpy(&child->thread.TS_FPR(fpidx), &data,
+ sizeof(long));
else
child->thread.fpscr.val = data;
ret = 0;