Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/aquynh/capstone
Browse files Browse the repository at this point in the history
  • Loading branch information
aquynh committed May 7, 2017
2 parents ce8a822 + a8ad69a commit 7ca24f1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ uninstall:

clean:
rm -f $(LIBOBJ)
rm -f $(BLDIR)/lib$(LIBNAME).* $(BLDIR)/$(LIBNAME).*
rm -f $(BLDIR)/lib$(LIBNAME).* $(BLDIR)/$(LIBNAME).pc
rm -f $(PKGCFGF)
$(MAKE) -C cstool clean

Expand Down
5 changes: 5 additions & 0 deletions arch/ARM/ARMInstPrinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,11 @@ void ARM_printInst(MCInst *MI, SStream *O, void *Info)
MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].type = ARM_OP_REG;
MI->flat_insn->detail->arm.operands[MI->flat_insn->detail->arm.op_count].reg = MCOperand_getReg(MCInst_getOperand(MI, 0));
MI->flat_insn->detail->arm.op_count++;
// this instruction implicitly read/write SP register
MI->flat_insn->detail->regs_read[MI->flat_insn->detail->regs_read_count] = ARM_REG_SP;
MI->flat_insn->detail->regs_read_count++;
MI->flat_insn->detail->regs_write[MI->flat_insn->detail->regs_write_count] = ARM_REG_SP;
MI->flat_insn->detail->regs_write_count++;
}
SStream_concat0(O, "}");
return;
Expand Down
11 changes: 6 additions & 5 deletions arch/X86/X86ATTInstPrinter.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ static void printMemReference(MCInst *MI, unsigned Op, SStream *O)
MCOperand *DispSpec = MCInst_getOperand(MI, Op + X86_AddrDisp);
MCOperand *SegReg = MCInst_getOperand(MI, Op + X86_AddrSegmentReg);
uint64_t ScaleVal;
int reg;
int segreg;

if (MI->csh->detail) {
MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].type = X86_OP_MEM;
Expand All @@ -689,11 +689,11 @@ static void printMemReference(MCInst *MI, unsigned Op, SStream *O)
}

// If this has a segment register, print it.
reg = MCOperand_getReg(SegReg);
if (reg) {
segreg = MCOperand_getReg(SegReg);
if (segreg) {
_printOperand(MI, Op + X86_AddrSegmentReg, O);
if (MI->csh->detail) {
MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.segment = reg;
MI->flat_insn->detail->x86.operands[MI->flat_insn->detail->x86.op_count].mem.segment = segreg;
}

SStream_concat0(O, ":");
Expand Down Expand Up @@ -728,7 +728,8 @@ static void printMemReference(MCInst *MI, unsigned Op, SStream *O)
}
}
} else {
//SStream_concat0(O, "0");
if (segreg)
SStream_concat0(O, "0");
}
}

Expand Down
6 changes: 6 additions & 0 deletions arch/X86/X86Disassembler.c
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,12 @@ bool X86_getInstruction(csh ud, const uint8_t *code, size_t code_len,

result = (!translateInstruction(instr, &insn)) ? true : false;
if (result) {
// quick fix for #904. TODO: fix this properly in the next update
if (handle->mode & CS_MODE_64 &&
(instr->Opcode == X86_LES16rm || instr->Opcode == X86_LES32rm))
// LES is invalid in x64
return false;

instr->imm_size = insn.immSize;
if (handle->detail) {
update_pub_insn(instr->flat_insn, &insn, instr->x86_prefix);
Expand Down
3 changes: 3 additions & 0 deletions arch/X86/X86DisassemblerDecoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -2133,6 +2133,9 @@ static bool checkPrefix(struct InternalInstruction *insn)
// invalid LOCK
return true;

// nop dword [rax]
case X86_NOOPL:

// DEC
case X86_DEC16m:
case X86_DEC32m:
Expand Down

0 comments on commit 7ca24f1

Please sign in to comment.