Patchwork powerpc: fix VSX alignment handler for regs 32-63

login
register
mail settings
Submitter Michael Neuling
Date Feb. 13, 2009, 5:08 a.m.
Message ID <1803.1234501738@neuling.org>
Download mbox | patch
Permalink /patch/23103/
State Accepted, archived
Commit 26456dcfb8d8e43b1b64b2a14710694cf7a72f05
Headers show

Comments

Michael Neuling - Feb. 13, 2009, 5:08 a.m.
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>
---
 arch/powerpc/kernel/align.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Patch

Index: linux-2.6-ozlabs/arch/powerpc/kernel/align.c
===================================================================
--- linux-2.6-ozlabs.orig/arch/powerpc/kernel/align.c
+++ linux-2.6-ozlabs/arch/powerpc/kernel/align.c
@@ -646,11 +646,16 @@  static int emulate_vsx(unsigned char __u
 		       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 {