powerpc sstep: Add support for modsw, moduw instructions
authorPrasannaKumar Muralidharan <prasannatsmkumar@gmail.com>
Fri, 22 Feb 2019 06:53:31 +0000 (12:23 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 25 Feb 2019 13:05:19 +0000 (00:05 +1100)
This adds emulation support for the following integer instructions:
  * Modulo Signed Word (modsw)
  * Modulo Unsigned Word (moduw)

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

index 742298bdf30bf20cd47b611e57abac5e61bb8694..9c65fb1da29839fde5a4a82811d0ced35a0c282c 100644 (file)
@@ -1708,6 +1708,13 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
                case 266:       /* add */
                        op->val = regs->gpr[ra] + regs->gpr[rb];
                        goto arith_done;
+
+               case 267:       /* moduw */
+                       if (!cpu_has_feature(CPU_FTR_ARCH_300))
+                               return -1;
+                       op->val = (unsigned int) regs->gpr[ra] %
+                               (unsigned int) regs->gpr[rb];
+                       goto compute_done;
 #ifdef __powerpc64__
                case 457:       /* divdu */
                        op->val = regs->gpr[ra] / regs->gpr[rb];
@@ -1750,6 +1757,13 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
 
                        return -1;
 
+               case 779:       /* modsw */
+                       if (!cpu_has_feature(CPU_FTR_ARCH_300))
+                               return -1;
+                       op->val = (int) regs->gpr[ra] %
+                               (int) regs->gpr[rb];
+                       goto compute_done;
+
 
 /*
  * Logical instructions