From 706b808af379d24abc3afdd2f6b241663f2504ba Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Mon, 12 Jan 2015 15:27:29 +0800 Subject: [PATCH] arm: add lshift field to arm_op_mem to provide left-shift value for index register in some memory op. issue reported by @jabba2989 --- arch/ARM/ARMInstPrinter.c | 6 ++---- include/arm.h | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/ARM/ARMInstPrinter.c b/arch/ARM/ARMInstPrinter.c index d02e9f7d5b..ab15b3e1de 100644 --- a/arch/ARM/ARMInstPrinter.c +++ b/arch/ARM/ARMInstPrinter.c @@ -851,8 +851,7 @@ static void printAddrModeTBH(MCInst *MI, unsigned Op, SStream *O) MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].mem.index = MCOperand_getReg(MO2); SStream_concat0(O, ", lsl #1]"); if (MI->csh->detail) { - MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].shift.type = ARM_SFT_LSL; - MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].shift.value = 1; + MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].mem.lshift = 1; } set_mem_access(MI, false); } @@ -1986,8 +1985,7 @@ static void printT2AddrModeSoRegOperand(MCInst *MI, SStream_concat0(O, ", lsl "); SStream_concat(O, "#%d", ShAmt); if (MI->csh->detail) { - MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count - 1].shift.type = ARM_SFT_LSL; - MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count - 1].shift.value = ShAmt; + MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].mem.lshift = ShAmt; } } diff --git a/include/arm.h b/include/arm.h index 73c5135f1d..dddcca87f0 100644 --- a/include/arm.h +++ b/include/arm.h @@ -217,6 +217,7 @@ typedef struct arm_op_mem { unsigned int index; // index register int scale; // scale for index register (can be 1, or -1) int disp; // displacement/offset value + int lshift; // left-shift on index register, or 0 if irrelevant. } arm_op_mem; // Instruction operand