powerpc/vsx: Fix VSX alignment handler for regs 32-63
authorMichael Neuling <mikey@neuling.org>
Thu, 12 Feb 2009 19:08:58 +0000 (19:08 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 13 Feb 2009 05:37:45 +0000 (16:37 +1100)
Fix the VSX alignment handler for VSX registers > 32.  32-63 are stored
in the VMX part of the thread_struct not the FPR part.

Signed-off-by: Michael Neuling <mikey@neuling.org>
CC: stable@kernel.org (2.6.27 & .28 please)
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/align.c

index 5af4e9b2dbe2c6dcdde0213809f0d74673e19252..ada06924a423b312e1e404c65a3d446e92fb31ea 100644 (file)
@@ -646,11 +646,16 @@ static int emulate_vsx(unsigned char __user *addr, unsigned int reg,
                       unsigned int areg, struct pt_regs *regs,
                       unsigned int flags, unsigned int length)
 {
-       char *ptr = (char *) &current->thread.TS_FPR(reg);
+       char *ptr;
        int ret = 0;
 
        flush_vsx_to_thread(current);
 
+       if (reg < 32)
+               ptr = (char *) &current->thread.TS_FPR(reg);
+       else
+               ptr = (char *) &current->thread.vr[reg - 32];
+
        if (flags & ST)
                ret = __copy_to_user(addr, ptr, length);
         else {