powerpc sstep: Add support for modsd, modud instructions
authorSandipan Das <sandipan@linux.ibm.com>
Fri, 22 Feb 2019 06:53:32 +0000 (12:23 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 25 Feb 2019 13:05:20 +0000 (00:05 +1100)
This adds emulation support for the following integer instructions:
  * Modulo Signed Doubleword (modsd)
  * Modulo Unsigned Doubleword (modud)

Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/lib/sstep.c

index 9c65fb1da29839fde5a4a82811d0ced35a0c282c..3d33fb509ef44e880e97d27a685708de133809f5 100644 (file)
@@ -1704,7 +1704,13 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
                                (int) regs->gpr[rb];
 
                        goto arith_done;
-
+#ifdef __powerpc64__
+               case 265:       /* modud */
+                       if (!cpu_has_feature(CPU_FTR_ARCH_300))
+                               return -1;
+                       op->val = regs->gpr[ra] % regs->gpr[rb];
+                       goto compute_done;
+#endif
                case 266:       /* add */
                        op->val = regs->gpr[ra] + regs->gpr[rb];
                        goto arith_done;
@@ -1756,7 +1762,14 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
                        }
 
                        return -1;
-
+#ifdef __powerpc64__
+               case 777:       /* modsd */
+                       if (!cpu_has_feature(CPU_FTR_ARCH_300))
+                               return -1;
+                       op->val = (long int) regs->gpr[ra] %
+                               (long int) regs->gpr[rb];
+                       goto compute_done;
+#endif
                case 779:       /* modsw */
                        if (!cpu_has_feature(CPU_FTR_ARCH_300))
                                return -1;