mips: fix for micromips
This commit is contained in:
parent
ea8c5af48e
commit
1f44928d97
|
@ -256,11 +256,11 @@ static DecodeStatus MipsDisassembler_getInstruction(int mode, MCInst *instr,
|
||||||
return MCDisassembler_Fail;
|
return MCDisassembler_Fail;
|
||||||
|
|
||||||
DecodeStatus Result = readInstruction32((unsigned char*)code, &Insn, isBigEndian,
|
DecodeStatus Result = readInstruction32((unsigned char*)code, &Insn, isBigEndian,
|
||||||
instr->mode & CS_MODE_MICRO);
|
mode & CS_MODE_MICRO);
|
||||||
if (Result == MCDisassembler_Fail)
|
if (Result == MCDisassembler_Fail)
|
||||||
return MCDisassembler_Fail;
|
return MCDisassembler_Fail;
|
||||||
|
|
||||||
if (instr->mode & CS_MODE_MICRO) {
|
if (mode & CS_MODE_MICRO) {
|
||||||
// Calling the auto-generated decoder function.
|
// Calling the auto-generated decoder function.
|
||||||
Result = decodeInstruction(DecoderTableMicroMips32, instr, Insn, Address, MRI, mode);
|
Result = decodeInstruction(DecoderTableMicroMips32, instr, Insn, Address, MRI, mode);
|
||||||
if (Result != MCDisassembler_Fail) {
|
if (Result != MCDisassembler_Fail) {
|
||||||
|
|
8
cs.c
8
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) {
|
while (size > 0) {
|
||||||
MCInst_Init(&mci);
|
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);
|
bool r = handle->disasm(ud, buffer, size, &mci, &insn_size, offset, handle->getinsn_info);
|
||||||
if (r) {
|
if (r) {
|
||||||
SStream ss;
|
SStream ss;
|
||||||
SStream_Init(&ss);
|
SStream_Init(&ss);
|
||||||
|
|
||||||
mci.detail = handle->detail;
|
|
||||||
// relative branches need to know the address & size of current insn
|
// relative branches need to know the address & size of current insn
|
||||||
mci.insn_size = insn_size;
|
mci.insn_size = insn_size;
|
||||||
mci.address = offset;
|
mci.address = offset;
|
||||||
|
|
||||||
if (handle->detail) {
|
if (handle->detail) {
|
||||||
mci.mode = handle->mode;
|
|
||||||
// save all the information for non-detailed mode
|
// save all the information for non-detailed mode
|
||||||
mci.pub_insn.address = offset;
|
mci.pub_insn.address = offset;
|
||||||
mci.pub_insn.size = insn_size;
|
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) {
|
while (size > 0) {
|
||||||
MCInst_Init(&mci);
|
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);
|
bool r = handle->disasm(ud, buffer, size, &mci, &insn_size, offset, handle->getinsn_info);
|
||||||
if (r) {
|
if (r) {
|
||||||
SStream ss;
|
SStream ss;
|
||||||
SStream_Init(&ss);
|
SStream_Init(&ss);
|
||||||
|
|
||||||
mci.detail = handle->detail;
|
|
||||||
// relative branches need to know the address & size of current insn
|
// relative branches need to know the address & size of current insn
|
||||||
mci.insn_size = insn_size;
|
mci.insn_size = insn_size;
|
||||||
mci.address = offset;
|
mci.address = offset;
|
||||||
|
|
||||||
if (handle->detail) {
|
if (handle->detail) {
|
||||||
mci.mode = handle->mode;
|
|
||||||
// save all the information for non-detailed mode
|
// save all the information for non-detailed mode
|
||||||
mci.pub_insn.address = offset;
|
mci.pub_insn.address = offset;
|
||||||
mci.pub_insn.size = insn_size;
|
mci.pub_insn.size = insn_size;
|
||||||
|
|
Loading…
Reference in New Issue