MCPcopy Create free account
hub / github.com/capstone-engine/capstone / printAddrMode3OffsetOperand

Function printAddrMode3OffsetOperand

arch/ARM/ARMInstPrinter.c:1243–1277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1241}
1242
1243static void printAddrMode3OffsetOperand(MCInst *MI, unsigned OpNum, SStream *O)
1244{
1245 MCOperand *MO1 = MCInst_getOperand(MI, OpNum);
1246 MCOperand *MO2 = MCInst_getOperand(MI, OpNum + 1);
1247 ARM_AM_AddrOpc subtracted = getAM3Op((unsigned int)MCOperand_getImm(MO2));
1248 unsigned ImmOffs;
1249
1250 if (MCOperand_getReg(MO1)) {
1251 SStream_concat0(O, ARM_AM_getAddrOpcStr(subtracted));
1252 printRegName(MI->csh, O, MCOperand_getReg(MO1));
1253
1254 if (MI->csh->detail) {
1255 MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].type = ARM_OP_REG;
1256 MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].reg = MCOperand_getReg(MO1);
1257 MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].access = CS_AC_READ;
1258 MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].subtracted = subtracted == ARM_AM_sub;
1259 MI->flat_insn->detail->arm.op_count++;
1260 }
1261
1262 return;
1263 }
1264
1265 ImmOffs = getAM3Offset((unsigned int)MCOperand_getImm(MO2));
1266 if (ImmOffs > HEX_THRESHOLD)
1267 SStream_concat(O, "#%s0x%x", ARM_AM_getAddrOpcStr(subtracted), ImmOffs);
1268 else
1269 SStream_concat(O, "#%s%u", ARM_AM_getAddrOpcStr(subtracted), ImmOffs);
1270
1271 if (MI->csh->detail) {
1272 MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].type = ARM_OP_IMM;
1273 MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].imm = ImmOffs;
1274 MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].subtracted = subtracted == ARM_AM_sub;
1275 MI->flat_insn->detail->arm.op_count++;
1276 }
1277}
1278
1279static void printPostIdxImm8Operand(MCInst *MI, unsigned OpNum, SStream *O)
1280{

Callers

nothing calls this directly

Calls 9

MCInst_getOperandFunction · 0.85
getAM3OpFunction · 0.85
MCOperand_getImmFunction · 0.85
MCOperand_getRegFunction · 0.85
SStream_concat0Function · 0.85
ARM_AM_getAddrOpcStrFunction · 0.85
getAM3OffsetFunction · 0.85
SStream_concatFunction · 0.85
printRegNameFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…