aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/ptrace.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 906536998291..895b082f1e48 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -229,12 +229,16 @@ static int gpr_get(struct task_struct *target, const struct user_regset *regset,
229 unsigned int pos, unsigned int count, 229 unsigned int pos, unsigned int count,
230 void *kbuf, void __user *ubuf) 230 void *kbuf, void __user *ubuf)
231{ 231{
232 int ret; 232 int i, ret;
233 233
234 if (target->thread.regs == NULL) 234 if (target->thread.regs == NULL)
235 return -EIO; 235 return -EIO;
236 236
237 CHECK_FULL_REGS(target->thread.regs); 237 if (!FULL_REGS(target->thread.regs)) {
238 /* We have a partial register set. Fill 14-31 with bogus values */
239 for (i = 14; i < 32; i++)
240 target->thread.regs->gpr[i] = NV_REG_POISON;
241 }
238 242
239 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, 243 ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
240 target->thread.regs, 244 target->thread.regs,
@@ -641,11 +645,16 @@ static int gpr32_get(struct task_struct *target,
641 compat_ulong_t *k = kbuf; 645 compat_ulong_t *k = kbuf;
642 compat_ulong_t __user *u = ubuf; 646 compat_ulong_t __user *u = ubuf;
643 compat_ulong_t reg; 647 compat_ulong_t reg;
648 int i;
644 649
645 if (target->thread.regs == NULL) 650 if (target->thread.regs == NULL)
646 return -EIO; 651 return -EIO;
647 652
648 CHECK_FULL_REGS(target->thread.regs); 653 if (!FULL_REGS(target->thread.regs)) {
654 /* We have a partial register set. Fill 14-31 with bogus values */
655 for (i = 14; i < 32; i++)
656 target->thread.regs->gpr[i] = NV_REG_POISON;
657 }
649 658
650 pos /= sizeof(reg); 659 pos /= sizeof(reg);
651 count /= sizeof(reg); 660 count /= sizeof(reg);