Skip to content

Commit

Permalink
[POWERPC] Fix handling of stfiwx math emulation
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
  • Loading branch information
Kumar Gala committed Oct 16, 2007
1 parent 65a6ec0 commit ba02946
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions arch/powerpc/math-emu/math.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,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:
Expand Down

0 comments on commit ba02946

Please sign in to comment.