From 8455b3c5a53b02e524494c7e72a3946a32518170 Mon Sep 17 00:00:00 2001 From: billow Date: Fri, 1 Nov 2024 17:31:21 +0800 Subject: [PATCH] tricore: fixes #2386 in v5 (#2527) --- arch/TriCore/TriCoreInstPrinter.c | 10 +++++----- suite/MC/TriCore/handwrite.s.cs | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/TriCore/TriCoreInstPrinter.c b/arch/TriCore/TriCoreInstPrinter.c index 2c6b87115b..a7e77c109a 100644 --- a/arch/TriCore/TriCoreInstPrinter.c +++ b/arch/TriCore/TriCoreInstPrinter.c @@ -402,8 +402,7 @@ static void printDisp4Imm(MCInst *MI, int OpNum, SStream *O) case TRICORE_LOOP_sbr: // {27b’111111111111111111111111111, disp4, 0}; disp = (int32_t)MI->address + - ((0x7ffffff << 5) | - (disp << 1)); + ((0x7ffffff << 5) | (disp << 1)); break; default: // handle other cases, if any @@ -449,10 +448,11 @@ static void printOExtImm_4(MCInst *MI, int OpNum, SStream *O) if (MCOperand_isImm(MO)) { uint32_t imm = MCOperand_getImm(MO); // {27b’111111111111111111111111111, disp4, 0}; - imm = 0xffffffe0 | (imm << 1); + int32_t off = (int32_t)(0xffffffe0 | (imm << 1)); + uint32_t target = (int32_t)MI->address + off; - printInt32Bang(O, imm); - fill_imm(MI, imm); + printUInt32(O, target); + fill_imm(MI, (int32_t)target); } else printOperand(MI, OpNum, O); } diff --git a/suite/MC/TriCore/handwrite.s.cs b/suite/MC/TriCore/handwrite.s.cs index fccd3b9460..5ca1bb7d70 100644 --- a/suite/MC/TriCore/handwrite.s.cs +++ b/suite/MC/TriCore/handwrite.s.cs @@ -1,2 +1,3 @@ # CS_ARCH_TRICORE, CS_MODE_TRICORE_162, None 0x8f,0xff,0x83,0x81 = xor d8, d15, #0x3f +0xfc,0x2e = loop a2, 0xfffffffc \ No newline at end of file