Merge asm.xap into anal.xap ##refactor

This commit is contained in:
Richard Patel 2022-06-17 09:29:52 +01:00 committed by pancake
parent 918998410f
commit d4837e1c59
16 changed files with 6 additions and 83 deletions

View File

@ -78,7 +78,6 @@ io.zip
asm.8051
asm.tms320
asm.sh
asm.xap
asm.arm_winedbg
asm.sparc
asm.java
@ -120,5 +119,4 @@ debug.rap
debug.bf
asm.dcpu16
asm.rar
asm.xap
io.shm"

View File

@ -92,7 +92,6 @@ asm.sparc_cs
asm.sparc_gnu
asm.tms320
asm.m68k_gnu
asm.xap
asm.arm_as
asm.x86_as
asm.x86_cs

View File

@ -68,7 +68,6 @@ io.zip
asm.8051
asm.tms320
asm.sh
asm.xap
asm.arm_winedbg
asm.sparc
anal.ppc
@ -97,5 +96,4 @@ debug.rap
debug.bf
asm.dcpu16
asm.rar
asm.xap
io.shm"

View File

@ -84,7 +84,6 @@ asm.sparc_cs
asm.sparc_gnu
asm.tms320
asm.m68k_gnu
asm.xap
asm.arm_as
asm.x86_as
asm.x86_cs

View File

@ -69,7 +69,6 @@ asm.sh
asm.sparc_gnu
asm.tms320
asm.m68k_gnu
asm.xap
asm.arm_as
asm.x86_as
asm.x86_nz

View File

@ -29,7 +29,6 @@ esil.dummy
asm.8051
asm.arm_cs
asm.arm_winedbg
asm.xap
asm.dalvik
asm.dcpu16
asm.gb

View File

@ -59,7 +59,6 @@ asm.lanai_gnu
asm.sh
asm.sparc_cs
asm.sparc_gnu
asm.xap
asm.arm_as
asm.x86_as
asm.x86_cs

View File

@ -39,7 +39,6 @@ asm.propeller
asm.riscv
asm.sh
asm.sparc_cs
asm.xap
asm.arm_as
asm.x86_as
asm.x86_cs

View File

@ -57,7 +57,6 @@ asm.sparc_cs
asm.sparc_gnu
asm.tms320
asm.m68k_gnu
asm.xap
asm.arm_as
asm.x86_as
asm.x86_cs

View File

@ -64,6 +64,10 @@ static int xap_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *bytes, int len
op->type = R_ANAL_OP_TYPE_UNK;
op->size = 2;
if (mask & R_ANAL_OP_MASK_DISASM) {
op->mnemonic = r_str_ndup (d.d_asm, sizeof (d.d_asm));
}
switch (i2ut16 (in)) {
case INST_NOP:
op->type = R_ANAL_OP_TYPE_NOP;
@ -215,6 +219,7 @@ RAnalPlugin r_anal_plugin_xap = {
.license = "LGPL3",
.arch = "xap",
.bits = 16,
.endian = R_SYS_ENDIAN_LITTLE,
.op = &xap_op,
};

View File

@ -43,7 +43,6 @@ r_asm_sources = [
join_paths('p','asm_x86_nasm.c'),
join_paths('p','asm_x86_nz.c'),
#join_paths('p','asm_x86_vm.c'),
join_paths('p','asm_xap.c'),
# join_paths('p','asm_z80.c'),
#join_paths('arch','8051','8051_disas.c'),
join_paths('arch','8051','8051_ass.c'),
@ -106,7 +105,6 @@ r_asm_sources = [
join_paths('arch','v810','v810_disas.c'),
join_paths('arch','v850','v850_disas.c'),
# join_paths('arch','whitespace','wsdis.c'),
# join_paths('arch','xap','dis.c'),
#join_paths('arch','z80','expressions.c'),
# join_paths('arch','z80','z80.c'),
#join_paths('arch','z80','z80asm.c'),

View File

@ -19,7 +19,7 @@ ALL_TARGETS=
# TODO: rename to enabled plugins
ARCHS=mips_gnu.mk x86_cs.mk sparc_cs.mk sparc_gnu.mk java.mk arm_gnu.mk dalvik.mk
ARCHS+=x86_as.mk x86_nz.mk cris_gnu.mk arc.mk
ARCHS+=ppc_gnu.mk ppc_as.mk ppc_cs.mk xap.mk x86_nasm.mk avr.mk
ARCHS+=ppc_gnu.mk ppc_as.mk ppc_cs.mk x86_nasm.mk avr.mk
ARCHS+=sh.mk arm_winedbg.mk tms320.mk gb.mk ebc.mk
ARCHS+=cr16.mk v850.mk propeller.mk
ARCHS+=v810.mk mcs96.mk lm32.mk jdh8.mk

View File

@ -1,55 +0,0 @@
/* radare - LGPL - Copyright 2009-2014 - nibble */
#include <stdio.h>
#include <r_types.h>
#include <r_lib.h>
#include <r_util.h>
#include <r_asm.h>
#include "xap/dis.c"
static int arch_xap_disasm(char *str, const unsigned char *buf, ut64 seek) {
struct state *s = get_state();
struct directive *d;
memset(s, 0, sizeof(*s));
s->s_buf = buf;
s->s_off = seek;
s->s_out = NULL;
d = next_inst(s);
if (d) {
xap_decode (s, d);
strcpy (str, d->d_asm);
free (d);
} else {
*str = '\0';
}
#if 0
if (s->s_ff_quirk) {
sprintf(d->d_asm, "DC\t0x%x", i2u16(&d->d_inst));
s->s_ff_quirk = 0;
}
#endif
return 0;
}
static int disassemble(RAsm *a, struct r_asm_op_t *op, const ut8 *buf, int len) {
char *buf_asm = r_strbuf_get (&op->buf_asm);
arch_xap_disasm (buf_asm, buf, a->pc);
return (op->size = 2);
}
RAsmPlugin r_asm_plugin_xap = {
.name = "xap",
.arch = "xap",
.license = "PD",
.bits = 16,
.endian = R_SYS_ENDIAN_LITTLE,
.desc = "XAP4 RISC (CSR)",
.disassemble = &disassemble
};
#ifndef R2_PLUGIN_INCORE
R_API RLibStruct radare_plugin = {
.type = R_LIB_TYPE_ASM,
.data = &r_asm_plugin_xap,
.version = R2_VERSION
};
#endif

View File

@ -1,12 +0,0 @@
OBJ_XAP=asm_xap.o
#OBJ_XAP+=../arch/xap/dis.o
STATIC_OBJ+=${OBJ_XAP}
TARGET_XAP=asm_xap.${EXT_SO}
ifeq ($(WITHPIC),1)
ALL_TARGETS+=${TARGET_XAP}
${TARGET_XAP}: ${OBJ_XAP}
${CC} $(call libname,asm_xap) ${LDFLAGS} ${CFLAGS} -o asm_xap.${EXT_SO} ${OBJ_XAP}
endif

View File

@ -227,7 +227,6 @@ extern RAsmPlugin r_asm_plugin_x86_as;
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_xtensa;
extern RAsmPlugin r_asm_plugin_alpha;
extern RAsmPlugin r_asm_plugin_vasm;

View File

@ -153,7 +153,6 @@ asm_plugins += [
'x86_cs',
'x86_nasm',
'x86_nz',
'xap',
]
# TODO: add the pyc plugin for meson builds too