mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-02 19:55:14 +00:00
Merge asm.xcore_cs into anal.xcore_cs ##refactor
This commit is contained in:
parent
fcbd71cf50
commit
628dd5fa49
1
dist/plugins-cfg/plugins.def.cfg
vendored
1
dist/plugins-cfg/plugins.def.cfg
vendored
@ -99,7 +99,6 @@ asm.x86_as
|
||||
asm.x86_cs
|
||||
asm.x86_nz
|
||||
asm.x86_nasm
|
||||
asm.xcore_cs
|
||||
asm.vasm
|
||||
asm.alpha
|
||||
asm.mcs96
|
||||
|
1
dist/plugins-cfg/plugins.mingw.cfg
vendored
1
dist/plugins-cfg/plugins.mingw.cfg
vendored
@ -91,7 +91,6 @@ asm.x86_as
|
||||
asm.x86_cs
|
||||
asm.x86_nz
|
||||
asm.x86_nasm
|
||||
asm.xcore_cs
|
||||
asm.vasm
|
||||
asm.alpha
|
||||
asm.mcs96
|
||||
|
1
dist/plugins-cfg/plugins.nogpl.cfg
vendored
1
dist/plugins-cfg/plugins.nogpl.cfg
vendored
@ -42,7 +42,6 @@ asm.sparc_cs
|
||||
asm.tms320
|
||||
asm.x86_cs
|
||||
asm.x86_nz
|
||||
asm.xcore_cs
|
||||
bin.any
|
||||
bin.bf
|
||||
bin.bios
|
||||
|
1
dist/plugins-cfg/plugins.static.cfg
vendored
1
dist/plugins-cfg/plugins.static.cfg
vendored
@ -66,7 +66,6 @@ asm.x86_as
|
||||
asm.x86_cs
|
||||
asm.x86_nz
|
||||
asm.x86_nasm
|
||||
asm.xcore_cs
|
||||
asm.mcs96
|
||||
bin.any
|
||||
bin.nro
|
||||
|
1
dist/plugins-cfg/plugins.static.nogpl.cfg
vendored
1
dist/plugins-cfg/plugins.static.nogpl.cfg
vendored
@ -46,7 +46,6 @@ asm.x86_as
|
||||
asm.x86_cs
|
||||
asm.x86_nz
|
||||
asm.x86_nasm
|
||||
asm.xcore_cs
|
||||
asm.mcs96
|
||||
bin.any
|
||||
bin.nro
|
||||
|
1
dist/plugins-cfg/plugins.termux.cfg
vendored
1
dist/plugins-cfg/plugins.termux.cfg
vendored
@ -64,7 +64,6 @@ asm.x86_as
|
||||
asm.x86_cs
|
||||
asm.x86_nz
|
||||
asm.x86_nasm
|
||||
asm.xcore_cs
|
||||
asm.vasm
|
||||
asm.mcs96
|
||||
bin.any
|
||||
|
@ -75,6 +75,11 @@ static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAn
|
||||
if (mask & R_ANAL_OP_MASK_OPEX) {
|
||||
opex (&op->opex, handle, insn);
|
||||
}
|
||||
if (mask & R_ANAL_OP_MASK_DISASM) {
|
||||
op->mnemonic = r_str_newf ("%s%s%s",
|
||||
insn->mnemonic, insn->op_str[0]? " ": "",
|
||||
insn->op_str);
|
||||
}
|
||||
op->size = insn->size;
|
||||
op->id = insn->id;
|
||||
switch (insn->id) {
|
||||
|
@ -45,7 +45,6 @@ r_asm_sources = [
|
||||
join_paths('p','asm_x86_nz.c'),
|
||||
#join_paths('p','asm_x86_vm.c'),
|
||||
join_paths('p','asm_xap.c'),
|
||||
join_paths('p','asm_xcore_cs.c'),
|
||||
# join_paths('p','asm_z80.c'),
|
||||
#join_paths('arch','8051','8051_disas.c'),
|
||||
join_paths('arch','8051','8051_ass.c'),
|
||||
|
@ -1,60 +0,0 @@
|
||||
/* radare2 - LGPL - Copyright 2014-2021 - pancake */
|
||||
|
||||
#include <r_asm.h>
|
||||
#include <r_lib.h>
|
||||
#include "cs_version.h"
|
||||
|
||||
static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
|
||||
csh handle;
|
||||
cs_insn* insn;
|
||||
int mode, n, ret = -1;
|
||||
mode = a->config->big_endian? CS_MODE_BIG_ENDIAN: CS_MODE_LITTLE_ENDIAN;
|
||||
memset (op, 0, sizeof (RAsmOp));
|
||||
op->size = 4;
|
||||
ret = cs_open (CS_ARCH_XCORE, mode, &handle);
|
||||
if (ret) {
|
||||
goto fin;
|
||||
}
|
||||
cs_option (handle, CS_OPT_DETAIL, CS_OPT_OFF);
|
||||
n = cs_disasm (handle, (ut8*)buf, len, a->pc, 1, &insn);
|
||||
if (n < 1) {
|
||||
r_asm_op_set_asm (op, "invalid");
|
||||
op->size = 4;
|
||||
ret = -1;
|
||||
goto beach;
|
||||
}
|
||||
ret = 4;
|
||||
if (insn->size < 1) {
|
||||
goto beach;
|
||||
}
|
||||
op->size = insn->size;
|
||||
r_strf_buffer (256);
|
||||
r_asm_op_set_asm (op, r_strf ("%s%s%s",
|
||||
insn->mnemonic, insn->op_str[0]? " ": "",
|
||||
insn->op_str));
|
||||
// TODO: remove the '$'<registername> in the string
|
||||
beach:
|
||||
cs_free (insn, n);
|
||||
cs_close (&handle);
|
||||
fin:
|
||||
return ret;
|
||||
}
|
||||
|
||||
RAsmPlugin r_asm_plugin_xcore_cs = {
|
||||
.name = "xcore",
|
||||
.desc = "Capstone "CAPSTONE_VERSION_STRING" XCore disassembler",
|
||||
.license = "BSD",
|
||||
.author = "pancake",
|
||||
.arch = "xcore",
|
||||
.bits = 32,
|
||||
.endian = R_SYS_ENDIAN_LITTLE | R_SYS_ENDIAN_BIG,
|
||||
.disassemble = &disassemble,
|
||||
};
|
||||
|
||||
#ifndef R2_PLUGIN_INCORE
|
||||
R_API RLibStruct radare_plugin = {
|
||||
.type = R_LIB_TYPE_ASM,
|
||||
.data = &r_asm_plugin_xcore_cs,
|
||||
.version = R2_VERSION
|
||||
};
|
||||
#endif
|
@ -1,15 +0,0 @@
|
||||
OBJ_XCORECS=asm_xcore_cs.o
|
||||
|
||||
include p/capstone.mk
|
||||
|
||||
STATIC_OBJ+=${OBJ_XCORECS}
|
||||
SHARED_OBJ+=${SHARED_XCORECS}
|
||||
TARGET_XCORECS=asm_xcore_cs.${EXT_SO}
|
||||
|
||||
ifeq ($(WITHPIC),1)
|
||||
ALL_TARGETS+=${TARGET_XCORECS}
|
||||
|
||||
${TARGET_XCORECS}: ${OBJ_XCORECS}
|
||||
${CC} $(call libname,asm_xcore) ${LDFLAGS} ${CFLAGS} $(CS_LDFLAGS) \
|
||||
-o ${TARGET_XCORECS} ${OBJ_XCORECS} ${SHARED2_XCORECS}
|
||||
endif
|
@ -229,7 +229,6 @@ extern RAsmPlugin r_asm_plugin_x86_cs;
|
||||
extern RAsmPlugin r_asm_plugin_x86_nasm;
|
||||
extern RAsmPlugin r_asm_plugin_x86_nz;
|
||||
extern RAsmPlugin r_asm_plugin_xap;
|
||||
extern RAsmPlugin r_asm_plugin_xcore_cs;
|
||||
extern RAsmPlugin r_asm_plugin_xtensa;
|
||||
extern RAsmPlugin r_asm_plugin_alpha;
|
||||
extern RAsmPlugin r_asm_plugin_vasm;
|
||||
|
@ -155,7 +155,6 @@ asm_plugins += [
|
||||
'x86_nasm',
|
||||
'x86_nz',
|
||||
'xap',
|
||||
'xcore_cs',
|
||||
]
|
||||
|
||||
# TODO: add the pyc plugin for meson builds too
|
||||
|
Loading…
x
Reference in New Issue
Block a user