mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-07 18:43:45 +00:00
Fix build with capstone3 (tms320c64x is not available)
This commit is contained in:
parent
b22656289e
commit
85d2225e8a
@ -6,10 +6,19 @@
|
|||||||
static csh cd = 0;
|
static csh cd = 0;
|
||||||
#include "cs_mnemonics.c"
|
#include "cs_mnemonics.c"
|
||||||
|
|
||||||
|
#ifdef CAPSTONE_TMS320C64X_H
|
||||||
|
#define CAPSTONE_HAS_TMS320C64X 1
|
||||||
|
#else
|
||||||
|
#define CAPSTONE_HAS_TMS320C64X 0
|
||||||
|
#warning Cannot find capstone-m68k support
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if CAPSTONE_HAS_TMS320C64X
|
||||||
|
|
||||||
static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
|
static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
|
||||||
cs_insn* insn;
|
cs_insn* insn;
|
||||||
int n = -1, ret = -1;
|
int n = -1, ret = -1;
|
||||||
int mode = CS_MODE_BIG_ENDIAN;
|
int mode = 0;
|
||||||
if (op) {
|
if (op) {
|
||||||
memset (op, 0, sizeof (RAsmOp));
|
memset (op, 0, sizeof (RAsmOp));
|
||||||
op->size = 4;
|
op->size = 4;
|
||||||
@ -25,9 +34,7 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
|
|||||||
if (!op) {
|
if (!op) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (a->big_endian) {
|
|
||||||
n = cs_disasm (cd, buf, len, a->pc, 1, &insn);
|
n = cs_disasm (cd, buf, len, a->pc, 1, &insn);
|
||||||
}
|
|
||||||
if (n < 1) {
|
if (n < 1) {
|
||||||
strcpy (op->buf_asm, "invalid");
|
strcpy (op->buf_asm, "invalid");
|
||||||
op->size = 4;
|
op->size = 4;
|
||||||
@ -44,7 +51,7 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
|
|||||||
insn->mnemonic, insn->op_str[0]? " ": "",
|
insn->mnemonic, insn->op_str[0]? " ": "",
|
||||||
insn->op_str);
|
insn->op_str);
|
||||||
r_str_replace_char (op->buf_asm, '%', 0);
|
r_str_replace_char (op->buf_asm, '%', 0);
|
||||||
// TODO: remove the '$'<registername> in the string
|
r_str_case (op->buf_asm, false);
|
||||||
cs_free (insn, n);
|
cs_free (insn, n);
|
||||||
beach:
|
beach:
|
||||||
// cs_close (&cd);
|
// cs_close (&cd);
|
||||||
@ -63,6 +70,20 @@ RAsmPlugin r_asm_plugin_tms320c64x = {
|
|||||||
.mnemonics = mnemonics
|
.mnemonics = mnemonics
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
RAsmPlugin r_asm_plugin_tms320c64x = {
|
||||||
|
.name = "tms320c64x",
|
||||||
|
.desc = "Capstone TMS320c64x disassembler (unsupported)",
|
||||||
|
.license = "BSD",
|
||||||
|
.arch = "tms320c64x",
|
||||||
|
.bits = 32,
|
||||||
|
.endian = R_SYS_ENDIAN_LITTLE,
|
||||||
|
.mnemonics = mnemonics
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef CORELIB
|
#ifndef CORELIB
|
||||||
RLibStruct radare_plugin = {
|
RLibStruct radare_plugin = {
|
||||||
.type = R_LIB_TYPE_ASM,
|
.type = R_LIB_TYPE_ASM,
|
||||||
|
Loading…
Reference in New Issue
Block a user