Skip to content

Commit

Permalink
Fix incorrect operand in disassembled instruction (#2401)
Browse files Browse the repository at this point in the history
Disassembling the "slwi", "srwi" and "rldicr" PowerPC instructions
with the "-d" option displays the wrong operands in the detailed
view. This is due to an incorrect break condition in the
"PPC_insert_detail_op_imm_at" function.

This patch fixes #2401.
  • Loading branch information
valdaarhun committed Jul 21, 2024
1 parent 5ba4ca4 commit bca012d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/PowerPC/PPCMapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ void PPC_insert_detail_op_imm_at(MCInst *MI, unsigned index, int64_t Val,

cs_ppc_op *ops = PPC_get_detail(MI)->operands;
int i = PPC_get_detail(MI)->op_count - 1;
for (; i >= 0; --i) {
for (; i >= index; --i) {
ops[i + 1] = ops[i];
if (i == index)
break;
Expand Down

0 comments on commit bca012d

Please sign in to comment.