Skip to contentSkip to conversation

powerpc/sstep: mullw should calculate a 64 bit signed result

PATCH Applied Anton Blanchard 2 participants 2 messages Sep 19, 2017 – Sep 21, 2017 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/sstep: mullw should calculate a 64 bit signed result

From: Anton Blanchard <[email protected]>

mullw should do a 32 bit signed multiply and create a 64 bit signed result. It currently truncates the result to 32 bits.

---
 arch/powerpc/lib/sstep.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/lib/sstep.c +3 -2
index c4cda1afb49d..5e8418c28bd8 100644
@@ -1651,8 +1651,9 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
 			goto arith_done;
 
 		case 235:	/* mullw */
-			op->val = (unsigned int) regs->gpr[ra] *
-				(unsigned int) regs->gpr[rb];
+			op->val = (long)(int) regs->gpr[ra] *
+				(int) regs->gpr[rb];
+
 			goto arith_done;
 
 		case 266:	/* add */
Signature · 1 line
2.11.0