Commit 49f297f8 authored by Michael Neuling's avatar Michael Neuling Committed by Benjamin Herrenschmidt

powerpc: Fix load/store float double alignment handler

When we introduced VSX, we changed the way FPRs are stored in the
thread_struct.  Unfortunately we missed the load/store float double
alignment handler code when updating how we access FPRs in the
thread_struct.

Below fixes this and merges the little/big endian case.
Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 169d418b
...@@ -367,27 +367,24 @@ static int emulate_multiple(struct pt_regs *regs, unsigned char __user *addr, ...@@ -367,27 +367,24 @@ static int emulate_multiple(struct pt_regs *regs, unsigned char __user *addr,
static int emulate_fp_pair(unsigned char __user *addr, unsigned int reg, static int emulate_fp_pair(unsigned char __user *addr, unsigned int reg,
unsigned int flags) unsigned int flags)
{ {
char *ptr = (char *) &current->thread.TS_FPR(reg); char *ptr0 = (char *) &current->thread.TS_FPR(reg);
int i, ret; char *ptr1 = (char *) &current->thread.TS_FPR(reg+1);
int i, ret, sw = 0;
if (!(flags & F)) if (!(flags & F))
return 0; return 0;
if (reg & 1) if (reg & 1)
return 0; /* invalid form: FRS/FRT must be even */ return 0; /* invalid form: FRS/FRT must be even */
if (!(flags & SW)) { if (flags & SW)
/* not byte-swapped - easy */ sw = 7;
if (!(flags & ST))
ret = __copy_from_user(ptr, addr, 16);
else
ret = __copy_to_user(addr, ptr, 16);
} else {
/* each FPR value is byte-swapped separately */
ret = 0; ret = 0;
for (i = 0; i < 16; ++i) { for (i = 0; i < 8; ++i) {
if (!(flags & ST)) if (!(flags & ST)) {
ret |= __get_user(ptr[i^7], addr + i); ret |= __get_user(ptr0[i^sw], addr + i);
else ret |= __get_user(ptr1[i^sw], addr + i + 8);
ret |= __put_user(ptr[i^7], addr + i); } else {
ret |= __put_user(ptr0[i^sw], addr + i);
ret |= __put_user(ptr1[i^sw], addr + i + 8);
} }
} }
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment