powerpc/lib/sstep: Add isel instruction emulation
authorMatt Brown <matthew.brown.dev@gmail.com>
Mon, 31 Jul 2017 00:58:26 +0000 (10:58 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 10 Aug 2017 12:30:29 +0000 (22:30 +1000)
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>
arch/powerpc/lib/sstep.c

index a2ded89db73e7a7a42481842062f6b0f7d62971c..a85b82c0e3f3115ae14d44c57225ef7c59dbefe1 100644 (file)
@@ -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]));