summaryrefslogtreecommitdiff
path: root/arch/powerpc/lib
diff options
context:
space:
mode:
authorMatt Brown <matthew.brown.dev@gmail.com>2017-07-31 10:58:26 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2017-08-10 22:30:29 +1000
commite27f71e5ff3c2ec5db96fc9aeb831b7bb31e3b6d (patch)
tree3c8bd30afa1de473dfb0fe251e7acd034cd3db9c /arch/powerpc/lib
parent2c979c489fee0e6b418133a9d0b938f02f47232a (diff)
powerpc/lib/sstep: Add isel instruction emulation
This adds emulation for the isel instruction. Tested for correctness against the isel instruction and its extended mnemonics (lt, gt, eq) on ppc64le. Signed-off-by: Matt Brown <matthew.brown.dev@gmail.com> Reviewed-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/lib')
-rw-r--r--arch/powerpc/lib/sstep.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index a2ded89db73e..a85b82c0e3f3 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -1255,6 +1255,14 @@ int analyse_instr(struct instruction_op *op, struct pt_regs *regs,
/*
* Logical instructions
*/
+ case 15: /* isel */
+ mb = (instr >> 6) & 0x1f; /* bc */
+ val = (regs->ccr >> (31 - mb)) & 1;
+ val2 = (ra) ? regs->gpr[ra] : 0;
+
+ regs->gpr[rd] = (val) ? val2 : regs->gpr[rb];
+ goto logical_done;
+
case 26: /* cntlzw */
asm("cntlzw %0,%1" : "=r" (regs->gpr[ra]) :
"r" (regs->gpr[rd]));