]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
[POWERPC] Fix handling of stfiwx math emulation
authorKumar Gala <galak@kernel.crashing.org>
Thu, 18 Oct 2007 16:00:21 +0000 (18:00 +0200)
committerAdrian Bunk <bunk@kernel.org>
Thu, 18 Oct 2007 16:00:21 +0000 (18:00 +0200)
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 <galak@kernel.crashing.org>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
arch/ppc/math-emu/math.c

index b7dff53a71031a3b3984071621a1875343aadd5c..66ad11f6d0c45681e9dfbd8a32e3c2a41ed1175c 100644 (file)
@@ -410,11 +410,16 @@ do_mathemu(struct pt_regs *regs)
 
        case XE:
                idx = (insn >> 16) & 0x1f;
-               if (!idx)
-                       goto illegal;
-
                op0 = (void *)&current->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: