diff options
author | James Yang <James.Yang@freescale.com> | 2013-07-04 17:18:44 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2013-08-14 00:59:57 -0400 |
commit | cc7059b5ea730edde256deb94a42f8e9e732d9b8 (patch) | |
tree | 227c68582067ee0700b8befa841e34f90b8b4ffa | |
parent | 5f20be4478032eeba66abddc79eae3abea45c5c8 (diff) |
powerpc/math-emu: Fix load/store indexed emulation
Load/store indexed instructions where the index register RA=R0, such
as "lfdx f1,0,r3", are not illegal.
Load/store indexed with update instructions where the index register
RA=R0, such as "lfdux f1,0,r3", are invalid, and, to be consistent
with existing math-emu behavior for other invalid instruction forms,
will signal as illegal.
Signed-off-by: James Yang <James.Yang@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/math-emu/math.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/arch/powerpc/math-emu/math.c b/arch/powerpc/math-emu/math.c index bc901623d8df..ab151f040502 100644 --- a/arch/powerpc/math-emu/math.c +++ b/arch/powerpc/math-emu/math.c | |||
@@ -380,21 +380,16 @@ do_mathemu(struct pt_regs *regs) | |||
380 | case XE: | 380 | case XE: |
381 | idx = (insn >> 16) & 0x1f; | 381 | idx = (insn >> 16) & 0x1f; |
382 | op0 = (void *)¤t->thread.TS_FPR((insn >> 21) & 0x1f); | 382 | op0 = (void *)¤t->thread.TS_FPR((insn >> 21) & 0x1f); |
383 | if (!idx) { | 383 | op1 = (void *)((idx ? regs->gpr[idx] : 0) |
384 | if (((insn >> 1) & 0x3ff) == STFIWX) | 384 | + regs->gpr[(insn >> 11) & 0x1f]); |
385 | op1 = (void *)(regs->gpr[(insn >> 11) & 0x1f]); | ||
386 | else | ||
387 | goto illegal; | ||
388 | } else { | ||
389 | op1 = (void *)(regs->gpr[idx] + regs->gpr[(insn >> 11) & 0x1f]); | ||
390 | } | ||
391 | |||
392 | break; | 385 | break; |
393 | 386 | ||
394 | case XEU: | 387 | case XEU: |
395 | idx = (insn >> 16) & 0x1f; | 388 | idx = (insn >> 16) & 0x1f; |
389 | if (!idx) | ||
390 | goto illegal; | ||
396 | op0 = (void *)¤t->thread.TS_FPR((insn >> 21) & 0x1f); | 391 | op0 = (void *)¤t->thread.TS_FPR((insn >> 21) & 0x1f); |
397 | op1 = (void *)((idx ? regs->gpr[idx] : 0) | 392 | op1 = (void *)(regs->gpr[idx] |
398 | + regs->gpr[(insn >> 11) & 0x1f]); | 393 | + regs->gpr[(insn >> 11) & 0x1f]); |
399 | break; | 394 | break; |
400 | 395 | ||