From: Kumar Gala Date: Thu, 18 Oct 2007 16:00:21 +0000 (+0200) Subject: [POWERPC] Fix handling of stfiwx math emulation X-Git-Tag: v2.6.16.56-rc1~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f772dcde07136d67393ad32b7572fdd7e180e556;p=thirdparty%2Fkernel%2Fstable.git [POWERPC] Fix handling of stfiwx math emulation Its legal for the stfiwx instruction to have RA = 0 as part of its effective address calculation. This is illegal for all other XE form instructions. Add code to compute the proper effective address for stfiwx if RA = 0 rather than treating it as illegal. Adrian Bunk: Backported to 2.6.16. Signed-off-by: Kumar Gala Signed-off-by: Adrian Bunk --- diff --git a/arch/ppc/math-emu/math.c b/arch/ppc/math-emu/math.c index b7dff53a71031..66ad11f6d0c45 100644 --- a/arch/ppc/math-emu/math.c +++ b/arch/ppc/math-emu/math.c @@ -410,11 +410,16 @@ do_mathemu(struct pt_regs *regs) case XE: idx = (insn >> 16) & 0x1f; - if (!idx) - goto illegal; - op0 = (void *)¤t->thread.fpr[(insn >> 21) & 0x1f]; - op1 = (void *)(regs->gpr[idx] + regs->gpr[(insn >> 11) & 0x1f]); + if (!idx) { + if (((insn >> 1) & 0x3ff) == STFIWX) + op1 = (void *)(regs->gpr[(insn >> 11) & 0x1f]); + else + goto illegal; + } else { + op1 = (void *)(regs->gpr[idx] + regs->gpr[(insn >> 11) & 0x1f]); + } + break; case XEU: