From 9c84eff616f5cc3a48816e31aee74e7141ecc2a9 Mon Sep 17 00:00:00 2001 From: Jiayi Zhao Date: Mon, 4 Nov 2019 22:48:06 -0500 Subject: [PATCH] systemz: fix base/index printing (#1561) - In cases where base is 0 but index is not, Capstone doesn't print anything --- arch/SystemZ/SystemZInstPrinter.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/SystemZ/SystemZInstPrinter.c b/arch/SystemZ/SystemZInstPrinter.c index ee606161..b2f489b9 100644 --- a/arch/SystemZ/SystemZInstPrinter.c +++ b/arch/SystemZ/SystemZInstPrinter.c @@ -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++; + } } }