[PATCH 1/2] powerpc/sstep: Add emulation support for ‘setb’ instruction

Sathvika Vasireddy sathvika at linux.vnet.ibm.com
Fri Apr 16 17:02:48 AEST 2021


This adds emulation support for the following instruction:
   * Set Boolean (setb)

Signed-off-by: Sathvika Vasireddy <sathvika at linux.vnet.ibm.com>
---
 arch/powerpc/lib/sstep.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index c6aebc149d14..263c613d7490 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -1964,6 +1964,18 @@ int analyse_instr(struct instruction_op *op, const struct pt_regs *regs,
 			op->val = ~(regs->gpr[rd] | regs->gpr[rb]);
 			goto logical_done;
 
+		case 128:	/* setb */
+			if (!cpu_has_feature(CPU_FTR_ARCH_300))
+				goto unknown_opcode;
+			ra = ra & ~0x3;
+			if ((regs->ccr) & (1 << (31 - ra)))
+				op->val = -1;
+			else if ((regs->ccr) & (1 << (30 - ra)))
+				op->val = 1;
+			else
+				op->val = 0;
+			goto compute_done;
+
 		case 154:	/* prtyw */
 			do_prty(regs, op, regs->gpr[rd], 32);
 			goto logical_done_nocc;
-- 
2.16.4



More information about the Linuxppc-dev mailing list