Skip to content

Commit

Permalink
TriCore: Add off8_fixup()
Browse files Browse the repository at this point in the history
we need to multiply off8 by 4 for the SC variants of ld/sw.
  • Loading branch information
Bastian Koppelmann committed Jul 16, 2023
1 parent 493013a commit 8c383ac
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 @@ -224,6 +224,19 @@ static void off4_fixup(MCInst *MI, uint64_t *off4)
}
}

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

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

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

0 comments on commit 8c383ac

Please sign in to comment.