systemz: fix base/index printing (#1561)

- In cases where base is 0 but index is not, Capstone doesn't print anything
This commit is contained in:
Jiayi Zhao 2019-11-04 22:48:06 -05:00 committed by naq
parent 418d36d695
commit 9c84eff616
1 changed files with 9 additions and 0 deletions

View File

@ -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.operands[MI->flat_insn->detail->sysz.op_count].imm = Disp;
MI->flat_insn->detail->sysz.op_count++; 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++;
}
} }
} }