From d3556e860eea5d0dbfb8e44c1b25a822687153c5 Mon Sep 17 00:00:00 2001 From: Jiayi Zhao Date: Thu, 31 Oct 2019 15:10:47 -0400 Subject: [PATCH] systemz: fix base/index printing - 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 b1f1c3360b..0d992dcb0f 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++; + } } }