aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/ptrace32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/ptrace32.c')
-rw-r--r--arch/powerpc/kernel/ptrace32.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/ptrace32.c b/arch/powerpc/kernel/ptrace32.c
index 197d49c790ad..297632cba047 100644
--- a/arch/powerpc/kernel/ptrace32.c
+++ b/arch/powerpc/kernel/ptrace32.c
@@ -67,7 +67,8 @@ static long compat_ptrace_old(struct task_struct *child, long request,
67/* Macros to workout the correct index for the FPR in the thread struct */ 67/* Macros to workout the correct index for the FPR in the thread struct */
68#define FPRNUMBER(i) (((i) - PT_FPR0) >> 1) 68#define FPRNUMBER(i) (((i) - PT_FPR0) >> 1)
69#define FPRHALF(i) (((i) - PT_FPR0) & 1) 69#define FPRHALF(i) (((i) - PT_FPR0) & 1)
70#define FPRINDEX(i) TS_FPRWIDTH * FPRNUMBER(i) + FPRHALF(i) 70#define FPRINDEX(i) TS_FPRWIDTH * FPRNUMBER(i) * 2 + FPRHALF(i)
71#define FPRINDEX_3264(i) (TS_FPRWIDTH * ((i) - PT_FPR0))
71 72
72long compat_arch_ptrace(struct task_struct *child, compat_long_t request, 73long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
73 compat_ulong_t caddr, compat_ulong_t cdata) 74 compat_ulong_t caddr, compat_ulong_t cdata)
@@ -168,8 +169,9 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
168 CHECK_FULL_REGS(child->thread.regs); 169 CHECK_FULL_REGS(child->thread.regs);
169 if (numReg >= PT_FPR0) { 170 if (numReg >= PT_FPR0) {
170 flush_fp_to_thread(child); 171 flush_fp_to_thread(child);
171 tmp = ((unsigned long int *)child->thread.fpr) 172 /* get 64 bit FPR */
172 [FPRINDEX(numReg)]; 173 tmp = ((u64 *)child->thread.fpr)
174 [FPRINDEX_3264(numReg)];
173 } else { /* register within PT_REGS struct */ 175 } else { /* register within PT_REGS struct */
174 tmp = ptrace_get_reg(child, numReg); 176 tmp = ptrace_get_reg(child, numReg);
175 } 177 }
@@ -262,8 +264,13 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
262 freg = (freg & 0xfffffffful) | (data << 32); 264 freg = (freg & 0xfffffffful) | (data << 32);
263 ret = ptrace_put_reg(child, numReg, freg); 265 ret = ptrace_put_reg(child, numReg, freg);
264 } else { 266 } else {
267 u64 *tmp;
265 flush_fp_to_thread(child); 268 flush_fp_to_thread(child);
266 ((unsigned int *)child->thread.regs)[index] = data; 269 /* get 64 bit FPR ... */
270 tmp = &(((u64 *)child->thread.fpr)
271 [FPRINDEX_3264(numReg)]);
272 /* ... write the 32 bit part we want */
273 ((u32 *)tmp)[index % 2] = data;
267 ret = 0; 274 ret = 0;
268 } 275 }
269 break; 276 break;