arm: add lshift field to arm_op_mem to provide left-shift value for index register in some memory op. issue reported by @jabba2989

This commit is contained in:
Nguyen Anh Quynh 2015-01-12 15:27:29 +08:00
parent 499f0ca7cb
commit 706b808af3
2 changed files with 3 additions and 4 deletions

View File

@ -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); MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].mem.index = MCOperand_getReg(MO2);
SStream_concat0(O, ", lsl #1]"); SStream_concat0(O, ", lsl #1]");
if (MI->csh->detail) { 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].mem.lshift = 1;
MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].shift.value = 1;
} }
set_mem_access(MI, false); set_mem_access(MI, false);
} }
@ -1986,8 +1985,7 @@ static void printT2AddrModeSoRegOperand(MCInst *MI,
SStream_concat0(O, ", lsl "); SStream_concat0(O, ", lsl ");
SStream_concat(O, "#%d", ShAmt); SStream_concat(O, "#%d", ShAmt);
if (MI->csh->detail) { 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].mem.lshift = ShAmt;
MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count - 1].shift.value = ShAmt;
} }
} }

View File

@ -217,6 +217,7 @@ typedef struct arm_op_mem {
unsigned int index; // index register unsigned int index; // index register
int scale; // scale for index register (can be 1, or -1) int scale; // scale for index register (can be 1, or -1)
int disp; // displacement/offset value int disp; // displacement/offset value
int lshift; // left-shift on index register, or 0 if irrelevant.
} arm_op_mem; } arm_op_mem;
// Instruction operand // Instruction operand