From 293ba25765b3dd06fa9ca24d6b932ecc6aea29d3 Mon Sep 17 00:00:00 2001 From: pancake Date: Mon, 10 Nov 2014 06:21:22 +0100 Subject: [PATCH] Switch to Capstone for MIPS (instead of GNU) --- libr/anal/p/anal_mips_cs.c | 13 ++++++++++++- libr/anal/p/anal_mips_gnu.c | 2 +- libr/asm/p/asm_mips_cs.c | 4 +--- libr/asm/p/asm_mips_gnu.c | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/libr/anal/p/anal_mips_cs.c b/libr/anal/p/anal_mips_cs.c index 9bfa3c51b9..3d11f82e12 100644 --- a/libr/anal/p/anal_mips_cs.c +++ b/libr/anal/p/anal_mips_cs.c @@ -134,6 +134,9 @@ static int analop_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len break; case MIPS_INS_FSUB: case MIPS_INS_SUB: + case MIPS_INS_SUBU: + case MIPS_INS_DSUB: + case MIPS_INS_DSUBU: { const char *arg0 = ARG(0); const char *arg1 = ARG(1); @@ -294,8 +297,16 @@ static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len) { break; case MIPS_INS_SUB: case MIPS_INS_SUBV: + case MIPS_INS_SUBVI: case MIPS_INS_DSUBU: case MIPS_INS_FSUB: + case MIPS_INS_FMSUB: + case MIPS_INS_SUBU: + case MIPS_INS_DSUB: + case MIPS_INS_SUBS_S: + case MIPS_INS_SUBS_U: + case MIPS_INS_SUBUH: + case MIPS_INS_SUBUH_R: op->type = R_ANAL_OP_TYPE_SUB; break; case MIPS_INS_MULV: @@ -421,7 +432,7 @@ static int set_reg_profile(RAnal *anal) { } RAnalPlugin r_anal_plugin_mips_cs = { - .name = "mips.cs", + .name = "mips", .desc = "Capstone MIPS analyzer", .license = "BSD", .esil = R_TRUE, diff --git a/libr/anal/p/anal_mips_gnu.c b/libr/anal/p/anal_mips_gnu.c index f0f4eadd9c..4d2628c152 100644 --- a/libr/anal/p/anal_mips_gnu.c +++ b/libr/anal/p/anal_mips_gnu.c @@ -520,7 +520,7 @@ static int mips_set_reg_profile(RAnal* anal){ } struct r_anal_plugin_t r_anal_plugin_mips_gnu = { - .name = "mips", + .name = "mips.gnu", .desc = "MIPS code analysis plugin", .license = "LGPL3", .arch = R_SYS_ARCH_MIPS, diff --git a/libr/asm/p/asm_mips_cs.c b/libr/asm/p/asm_mips_cs.c index fcae57059e..f134862589 100644 --- a/libr/asm/p/asm_mips_cs.c +++ b/libr/asm/p/asm_mips_cs.c @@ -20,8 +20,6 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) { mode |= CS_MODE_MIPS32R6; } else if (!strcmp (a->cpu, "v3")) { mode |= CS_MODE_MIPS3; - } else { - eprintf ("Invalid CPU selected: gp64, micro, r6, v3\n"); } } mode |= (a->bits==64)? CS_MODE_64: CS_MODE_32; @@ -62,7 +60,7 @@ static int assemble(RAsm *a, RAsmOp *op, const char *str) { } RAsmPlugin r_asm_plugin_mips_cs = { - .name = "mips.cs", + .name = "mips", .desc = "Capstone MIPS disassembler", .license = "BSD", .arch = "mips", diff --git a/libr/asm/p/asm_mips_gnu.c b/libr/asm/p/asm_mips_gnu.c index ea76aabd70..42aaf94bbb 100644 --- a/libr/asm/p/asm_mips_gnu.c +++ b/libr/asm/p/asm_mips_gnu.c @@ -95,7 +95,7 @@ static int assemble(RAsm *a, RAsmOp *op, const char *str) { } RAsmPlugin r_asm_plugin_mips_gnu = { - .name = "mips", + .name = "mips.gnu", .arch = "mips", .license = "GPL3", .bits = 32|64,