Skip to content

Commit

Permalink
systemz: fix base/index printing (capstone-engine#1561)
Browse files Browse the repository at this point in the history
- In cases where base is 0 but index is not, Capstone doesn't print anything
  • Loading branch information
kamiyaa authored and aquynh committed Nov 5, 2019
1 parent 418d36d commit 9c84eff
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions arch/SystemZ/SystemZInstPrinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ static void printAddress(MCInst *MI, unsigned Base, int64_t Disp, unsigned Index
MI->flat_insn->detail->sysz.operands[MI->flat_insn->detail->sysz.op_count].imm = Disp;
MI->flat_insn->detail->sysz.op_count++;
}
} else {
SStream_concat(O, "(%%%s)", getRegisterName(Index));
if (MI->csh->detail) {
MI->flat_insn->detail->sysz.operands[MI->flat_insn->detail->sysz.op_count].type = SYSZ_OP_MEM;
MI->flat_insn->detail->sysz.operands[MI->flat_insn->detail->sysz.op_count].mem.base = (uint8_t)SystemZ_map_register(Base);
MI->flat_insn->detail->sysz.operands[MI->flat_insn->detail->sysz.op_count].mem.index = (uint8_t)SystemZ_map_register(Index);
MI->flat_insn->detail->sysz.operands[MI->flat_insn->detail->sysz.op_count].mem.disp = Disp;
MI->flat_insn->detail->sysz.op_count++;
}
}
}

Expand Down

0 comments on commit 9c84eff

Please sign in to comment.