In message <[email protected]> you wrote:
> Michael Neuling <[email protected]> writes:
> 
> >> @@ -263,7 +263,9 @@ long compat_arch_ptrace(struct task_stru
> >>                    ret = ptrace_put_reg(child, numReg, freg);
> >>            } else {
> >>                    flush_fp_to_thread(child);
> >> -                  ((unsigned int *)child->thread.regs)[index] = data;
> >> +                  ((unsigned int *)child->thread.fpr)
> >> +                          [TS_FPRWIDTH * (numReg - PT_FPR0) * 2 +
> >> +                           index % 2] = data;
> >
> > I think the indexing here should be the same as PEEKUSR_3264.  This
> > looks better but all this magic indexing makes me want to vomit.
> 
> How about this instead:
> 
> @@ -241,6 +241,7 @@ long compat_arch_ptrace(struct task_stru
>       case PPC_PTRACE_POKEUSR_3264: {
>               u32 index;
>               u32 numReg;
> +             u32 *tmp;
>  
>               ret = -EIO;
>               /* Determine which register the user wants */
> @@ -263,7 +264,8 @@ long compat_arch_ptrace(struct task_stru
>                       ret = ptrace_put_reg(child, numReg, freg);
>               } else {
>                       flush_fp_to_thread(child);
> -                     ((unsigned int *)child->thread.regs)[index] = data;
> +                     tmp = (u32 *)child->thread.fpr[numReg - PT_FPR0];
> +                     tmp[index % 2] = data;

I do like this approach better (two arrays) but there is no accounting
for TS_WIDTH, so I'm not sure it works.

We *really* need a test case for this stuff :-)

Mikey

>                       ret = 0;
>               }
>               break;
> 
> Andreas.
> 
> -- 
> Andreas Schwab, [email protected]
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
> 
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to