Skip to content

Commit

Permalink
TriCore: Add const8_fixup()
Browse files Browse the repository at this point in the history
we need to multiply const8 by 4 for the SC variants of ld/sw.
  • Loading branch information
Bastian Koppelmann committed Jul 23, 2023
1 parent 03d0635 commit 16ec69d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions arch/TriCore/TriCoreInstPrinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,19 @@ static void off4_fixup(MCInst *MI, uint64_t *off4)
}
}

static void const8_fixup(MCInst *MI, uint64_t *const8)
{
switch (MCInst_getOpcode(MI)) {
case TRICORE_LD_A_sc:
case TRICORE_ST_A_sc:
case TRICORE_ST_W_sc:
case TRICORE_LD_W_sc: {
*const8 *= 4;
break;
}
}
}

static void print_zero_ext(MCInst *MI, int OpNum, SStream *O, unsigned n)
{
MCOperand *MO = MCInst_getOperand(MI, OpNum);
Expand All @@ -236,6 +249,9 @@ static void print_zero_ext(MCInst *MI, int OpNum, SStream *O, unsigned n)
if (n == 4) {
off4_fixup(MI, &imm);
}
if (n == 8) {
const8_fixup(MI, &imm);
}

printInt64Bang(O, imm);
fill_imm(MI, imm);
Expand Down

0 comments on commit 16ec69d

Please sign in to comment.