From ad3b6fa1c894bd4ff690066dc6b2f657703f9f53 Mon Sep 17 00:00:00 2001 From: Rot127 Date: Mon, 18 Nov 2024 13:21:09 -0500 Subject: [PATCH] Fix: AbsAddr should be printed as unsigned. --- arch/PowerPC/PPCInstPrinter.c | 5 +---- arch/PowerPC/PPCMapping.c | 3 +-- tests/details/ppc.yaml | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/PowerPC/PPCInstPrinter.c b/arch/PowerPC/PPCInstPrinter.c index 288a6ba9bb1..bef07b10b57 100644 --- a/arch/PowerPC/PPCInstPrinter.c +++ b/arch/PowerPC/PPCInstPrinter.c @@ -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) diff --git a/arch/PowerPC/PPCMapping.c b/arch/PowerPC/PPCMapping.c index 65b2332f5c6..d6f6b8f81e2 100644 --- a/arch/PowerPC/PPCMapping.c +++ b/arch/PowerPC/PPCMapping.c @@ -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; diff --git a/tests/details/ppc.yaml b/tests/details/ppc.yaml index 079f06ef6a8..d0cda5893b9 100644 --- a/tests/details/ppc.yaml +++ b/tests/details/ppc.yaml @@ -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: @@ -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