From 1f44928d9777856c9ace570c4c75885cf6421452 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Sun, 15 Dec 2013 14:04:59 +0800 Subject: [PATCH] mips: fix for micromips --- arch/Mips/MipsDisassembler.c | 4 ++-- cs.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/Mips/MipsDisassembler.c b/arch/Mips/MipsDisassembler.c index b9339c23..6fa91adf 100644 --- a/arch/Mips/MipsDisassembler.c +++ b/arch/Mips/MipsDisassembler.c @@ -256,11 +256,11 @@ static DecodeStatus MipsDisassembler_getInstruction(int mode, MCInst *instr, return MCDisassembler_Fail; DecodeStatus Result = readInstruction32((unsigned char*)code, &Insn, isBigEndian, - instr->mode & CS_MODE_MICRO); + mode & CS_MODE_MICRO); if (Result == MCDisassembler_Fail) return MCDisassembler_Fail; - if (instr->mode & CS_MODE_MICRO) { + if (mode & CS_MODE_MICRO) { // Calling the auto-generated decoder function. Result = decodeInstruction(DecoderTableMicroMips32, instr, Insn, Address, MRI, mode); if (Result != MCDisassembler_Fail) { diff --git a/cs.c b/cs.c index f17868f2..303f5253 100644 --- a/cs.c +++ b/cs.c @@ -270,19 +270,19 @@ size_t cs_disasm(csh ud, const uint8_t *buffer, size_t size, uint64_t offset, si while (size > 0) { MCInst_Init(&mci); + mci.detail = handle->detail; + mci.mode = handle->mode; bool r = handle->disasm(ud, buffer, size, &mci, &insn_size, offset, handle->getinsn_info); if (r) { SStream ss; SStream_Init(&ss); - mci.detail = handle->detail; // relative branches need to know the address & size of current insn mci.insn_size = insn_size; mci.address = offset; if (handle->detail) { - mci.mode = handle->mode; // save all the information for non-detailed mode mci.pub_insn.address = offset; mci.pub_insn.size = insn_size; @@ -334,19 +334,19 @@ size_t cs_disasm_dyn(csh ud, const uint8_t *buffer, size_t size, uint64_t offset while (size > 0) { MCInst_Init(&mci); + mci.detail = handle->detail; + mci.mode = handle->mode; bool r = handle->disasm(ud, buffer, size, &mci, &insn_size, offset, handle->getinsn_info); if (r) { SStream ss; SStream_Init(&ss); - mci.detail = handle->detail; // relative branches need to know the address & size of current insn mci.insn_size = insn_size; mci.address = offset; if (handle->detail) { - mci.mode = handle->mode; // save all the information for non-detailed mode mci.pub_insn.address = offset; mci.pub_insn.size = insn_size;