mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-07 10:33:30 +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;
|
||||
#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) {
|
||||
cs_insn* insn;
|
||||
int n = -1, ret = -1;
|
||||
int mode = CS_MODE_BIG_ENDIAN;
|
||||
int mode = 0;
|
||||
if (op) {
|
||||
memset (op, 0, sizeof (RAsmOp));
|
||||
op->size = 4;
|
||||
@ -25,9 +34,7 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
|
||||
if (!op) {
|
||||
return 0;
|
||||
}
|
||||
if (a->big_endian) {
|
||||
n = cs_disasm (cd, buf, len, a->pc, 1, &insn);
|
||||
}
|
||||
if (n < 1) {
|
||||
strcpy (op->buf_asm, "invalid");
|
||||
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->op_str);
|
||||
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);
|
||||
beach:
|
||||
// cs_close (&cd);
|
||||
@ -63,6 +70,20 @@ RAsmPlugin r_asm_plugin_tms320c64x = {
|
||||
.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
|
||||
RLibStruct radare_plugin = {
|
||||
.type = R_LIB_TYPE_ASM,
|
||||
|
Loading…
Reference in New Issue
Block a user