Skip to content

Commit

Permalink
Fix: AbsAddr should be printed as unsigned.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Nov 18, 2024
1 parent a01ba99 commit ad3b6fa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
5 changes: 1 addition & 4 deletions arch/PowerPC/PPCInstPrinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,7 @@ static inline void printAbsBranchOperand(MCInst *MI, unsigned OpNo, SStream *O)
return;
}

printInt32(O, SignExtend32(((unsigned)MCOperand_getImm(
MCInst_getOperand(MI, (OpNo)))
<< 2),
32));
printUInt64(O, ((unsigned)MCOperand_getImm(MCInst_getOperand(MI, (OpNo))) << 2));
}

static inline void printcrbitm(MCInst *MI, unsigned OpNo, SStream *O)
Expand Down
3 changes: 1 addition & 2 deletions arch/PowerPC/PPCMapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,9 @@ static void add_cs_detail_general(MCInst *MI, ppc_op_group op_group,
// Handled in printOperand()
return;
unsigned Val = MCInst_getOpVal(MI, OpNum) << 2;
int32_t Imm = SignExtend32(Val, 32);
PPC_check_safe_inc(MI);
PPC_get_detail_op(MI, 0)->type = PPC_OP_IMM;
PPC_get_detail_op(MI, 0)->imm = Imm;
PPC_get_detail_op(MI, 0)->imm = Val;
PPC_get_detail_op(MI, 0)->access = map_get_op_access(MI, OpNum);
PPC_inc_op_count(MI);
break;
Expand Down
4 changes: 2 additions & 2 deletions tests/details/ppc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test_cases:
bo_set: true
pred_ctr: PPC_PRED_NZ
-
asm_text: "bdztla 4*cr5+eq, 0xff14"
asm_text: "bdztla 4*cr5+eq, 0xffffff14"
details:
ppc:
operands:
Expand All @@ -41,7 +41,7 @@ test_cases:
access: CS_AC_READ
-
type: PPC_OP_IMM
imm: 0xff14
imm: 0xffffff14
access: CS_AC_READ
bc:
bi: 22
Expand Down

0 comments on commit ad3b6fa

Please sign in to comment.