mips: fix for micromips

This commit is contained in:
Nguyen Anh Quynh 2013-12-15 14:04:59 +08:00
parent ea8c5af48e
commit 1f44928d97
2 changed files with 6 additions and 6 deletions

View File

@ -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) {

8
cs.c
View File

@ -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;