From f5ee69e42baf7d62d816ac57365dd6532de840c0 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Mon, 9 Oct 2017 09:26:41 +0800 Subject: [PATCH] Mips64: fix the last cherry-pick on selecting getInstruction() --- arch/Mips/MipsDisassembler.h | 3 --- arch/Mips/MipsModule.c | 21 +-------------------- 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/arch/Mips/MipsDisassembler.h b/arch/Mips/MipsDisassembler.h index d2b38979..c1a2e894 100644 --- a/arch/Mips/MipsDisassembler.h +++ b/arch/Mips/MipsDisassembler.h @@ -12,7 +12,4 @@ void Mips_init(MCRegisterInfo *MRI); bool Mips_getInstruction(csh handle, const uint8_t *code, size_t code_len, MCInst *instr, uint16_t *size, uint64_t address, void *info); -bool Mips64_getInstruction(csh handle, const uint8_t *code, size_t code_len, - MCInst *instr, uint16_t *size, uint64_t address, void *info); - #endif diff --git a/arch/Mips/MipsModule.c b/arch/Mips/MipsModule.c index e5a1b9cd..534d8080 100644 --- a/arch/Mips/MipsModule.c +++ b/arch/Mips/MipsModule.c @@ -9,15 +9,6 @@ #include "MipsInstPrinter.h" #include "MipsMapping.h" -// Returns mode value with implied bits set -static inline cs_mode updated_mode(cs_mode mode) -{ - if (mode & CS_MODE_MIPS32R6) { - mode |= CS_MODE_32; - } - - return mode; -} static cs_err init(cs_struct *ud) { @@ -40,11 +31,7 @@ static cs_err init(cs_struct *ud) ud->insn_name = Mips_insn_name; ud->group_name = Mips_group_name; - ud->mode = updated_mode(ud->mode); - if (ud->mode & CS_MODE_32) - ud->disasm = Mips_getInstruction; - else - ud->disasm = Mips64_getInstruction; + ud->disasm = Mips_getInstruction; return CS_ERR_OK; } @@ -52,12 +39,6 @@ static cs_err init(cs_struct *ud) static cs_err option(cs_struct *handle, cs_opt_type type, size_t value) { if (type == CS_OPT_MODE) { - value = updated_mode(value); - if (value & CS_MODE_32) - handle->disasm = Mips_getInstruction; - else - handle->disasm = Mips64_getInstruction; - handle->mode = (cs_mode)value; handle->big_endian = ((handle->mode & CS_MODE_BIG_ENDIAN) != 0); return CS_ERR_OK;