Skip to content

Commit

Permalink
Add printAdrAdrpLabel def
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed May 10, 2024
1 parent 8feecf5 commit df51ebc
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions arch/AArch64/AArch64InstPrinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -2557,6 +2557,32 @@ void printAdrpLabel(MCInst *MI, uint64_t Address, unsigned OpNum, SStream *O)
assert(0 && "Expressions are not supported.");
}

void printAdrAdrpLabel(MCInst *MI, uint64_t Address, unsigned OpNum, SStream *O) {
add_cs_detail(MI, AArch64_OP_GROUP_AdrAdrpLabel, OpNum);
MCOperand *Op = MCInst_getOperand(MI, (OpNum));

// If the label has already been resolved to an immediate offset (say, when
// we're running the disassembler), just print the immediate.
if (MCOperand_isImm(Op)) {
int64_t Offset = MCOperand_getImm(Op);
if (MCInst_getOpcode(MI) == AArch64_ADRP) {
Offset = Offset * 4096;
Address = Address & -4096;
}
SStream_concat0(O, markup(">"));
if (!MI->csh->PrintBranchImmNotAsAddress)
printUInt64(O, (Address + Offset));
else {
printUInt64Bang(O, Offset);
}
SStream_concat0(O, markup(">"));
return;
}

// Otherwise, just print the expression.
assert(0 && "Expressions are not supported.");
}

void printBarrierOption(MCInst *MI, unsigned OpNo, SStream *O)
{
add_cs_detail(MI, AArch64_OP_GROUP_BarrierOption, OpNo);
Expand Down

0 comments on commit df51ebc

Please sign in to comment.