Move all the arch plugins to the new plugin structure structure

This commit is contained in:
pancake 2022-11-29 21:09:58 +01:00 committed by pancake
parent ffdc611fdc
commit 28ca83cd73
21 changed files with 27 additions and 70 deletions

View File

@ -8,6 +8,7 @@ CFLAGS:=-I.. -I$(LTOP)/asm/arch/include -DR2_PLUGIN_INCORE -Iarch -I$(TOP)/shlr
.PHONY: pre
pre: libr_arch.$(EXT_SO) libr_arch.$(EXT_AR)
$(MAKE) -C ../asm/arch/arm/v35arm64
$(MAKE) -C p
include $(STATIC_ARCH_PLUGINS)

View File

@ -6,17 +6,18 @@ r_arch_sources = [
'arch_session.c',
'arch_cond.c',
'arch_value.c',
'p/arch_null.c',
'p/arch_i4004.c',
'p/arch_amd29k.c',
'p/arch_jdh8.c',
'p/null/plugin.c',
'p/any_as/plugin.c',
'p/i4004/plugin.c',
'p/amd29k/plugin.c',
'p/jdh8/plugin.c',
'p/pickle/plugin.c',
'p/arch_rsp.c',
'p/rsp/plugin.c',
'p/rsp/rsp_idec.c',
'p/riscv/plugin.c',
'p/arch_sh.c',
'p/sh/plugin.c',
'p/sh/gnu/sh-dis.c',
'p/arch_v810.c',
'p/v810/plugin.c',
'p/v810/v810_disas.c',
]

View File

@ -1,4 +1,4 @@
OBJ_AMD29K=arch_amd29k.o
OBJ_AMD29K=p/amd29k/plugin.o
STATIC_OBJ+=${OBJ_AMD29K}
TARGET_AMD29K=arch_amd29k.${EXT_SO}

View File

@ -626,7 +626,7 @@ void amd29k_instr_print(char *string, int string_size, ut64 address, amd29k_inst
static char *regs(RArchSession *s) {
const char * const p =
#include "amd29k/regs.h"
#include "./regs.h"
;
return strdup (p);
}

View File

@ -1,4 +1,4 @@
OBJ_ANYAS=p/as/plugin.o
OBJ_ANYAS=p/any_as/plugin.o
STATIC_OBJ+=${OBJ_ANYAS}
TARGET_ANYAS=arch_as.${EXT_SO}

View File

@ -1,44 +0,0 @@
/* radare2 - BSD - Copyright 2022 - pancake */
#include <r_arch.h>
#include <r_lib.h>
}
static bool encode (RArchSession *a, RAnalOp *op, RArchEncodeMask mask) {
int len = 0;
ut8 *out;
char *gas = r_sys_getenv ("RASM2_AS");
if (!gas) {
gas = strdup ("as");
}
char *cmd = r_str_newf (
"%s /dev/stdin -o /dev/stdout <<__\n"
"BITS %i\nORG 0x%"PFMT64x"\n%s\n__",
gas, a->bits, a->pc, buf);
ut8 *out = (ut8 *)r_sys_cmd_str (cmd, "", &len);
if (out) {
r_anal_op_setbytes (op, op->addr, out, len);
free (out);
}
op->size = len;
free (cmd);
return true;
}
RArchPlugin r_arch_plugin_as = {
.name = "as",
.desc = "GNU/Clang assembler RASM2_AS or `as`",
.license = "LGPL3",
.arch = NULL,
.bits = R_SYS_BITS_PACK3 (16, 32, 64),
.encode = &encode,
.endian = R_SYS_ENDIAN_LITTLE | R_:SYS_ENDIAN_BIG,
};
#ifndef R2_PLUGIN_INCORE
R_API RLibStruct radare_plugin = {
.type = R_LIB_TYPE_ARCH,
.data = &r_arch_plugin_as,
.version = R2_VERSION
};
#endif

View File

@ -1,4 +1,4 @@
OBJ_I4004=arch_i4004.o
OBJ_I4004=p/i4004/plugin.o
STATIC_OBJ+=${OBJ_I4004}
TARGET_I4004=arch_i4004.${EXT_SO}

View File

@ -1,11 +1,11 @@
/* radare - LGPL - Copyright 2016-2022 - pancake, condret */
#include <r_arch.h>
#include "./i4004/gperfdb.c"
#include "./gperfdb.c"
static char *i4004_regs(RArchSession *a) {
const char *p =
#include "i4004/regs.h"
#include "./regs.h"
;
return strdup (p);
}

View File

@ -1,4 +1,4 @@
OBJ_JDH8=arch_jdh8.o
OBJ_JDH8=p/jdh8/plugin.o
STATIC_OBJ+=${OBJ_JDH8}
TARGET_JDH8=arch_jdh8.${EXT_SO}

View File

@ -2,7 +2,7 @@
#include <r_anal.h>
#include <r_lib.h>
#include "./jdh8/jdh8dis.c"
#include "./jdh8dis.c"
static bool decode(RArchSession *s, RAnalOp *op, RArchDecodeMask mask) {
int dlen = 0;

View File

@ -1,4 +1,4 @@
OBJ_MALBOLGE=arch_malbolge.o
OBJ_MALBOLGE=p/malbolge/plugin.o
STATIC_OBJ+=${OBJ_MALBOLGE}
TARGET_MALBOLGE=arch_malbolge.${EXT_SO}

View File

@ -74,7 +74,7 @@ RArchPlugin r_arch_plugin_malbolge = {
#ifndef R2_PLUGIN_INCORE
R_API RLibStruct radare_plugin = {
.type = R_LIB_TYPE_ANAL,
.type = R_LIB_TYPE_ARCH,
.data = &r_arch_plugin_malbolge,
.version = R2_VERSION
};

View File

@ -1,4 +1,4 @@
OBJ_NULL=arch_null.o
OBJ_NULL=p/null/plugin.o
TARGET_NULL=arch_null.${EXT_SO}
STATIC_OBJ+=${OBJ_NULL}

View File

@ -1,5 +1,4 @@
OBJ_RSP=arch_rsp.o
#RSP_ROOT=$(LIBR)/asm/arch/rsp
OBJ_RSP=p/rsp/plugin.o
CFLAGS+=-Iarch
STATIC_OBJ+=${OBJ_RSP}

View File

@ -8,7 +8,7 @@
#include <r_types.h>
#include <r_lib.h>
#include <r_anal.h>
#include "rsp/rsp_idec.h"
#include "./rsp_idec.h"
static RStrBuf *disassemble(RStrBuf *buf_asm, rsp_instruction *r_instr) {
int i;

View File

@ -1,4 +1,4 @@
OBJ_SH=arch_sh.o
OBJ_SH=p/sh/plugin.o
OBJ_SH+=p/sh/gnu/sh-dis.o
STATIC_OBJ+=$(OBJ_SH)

View File

@ -1215,7 +1215,7 @@ static int (*first_nibble_decode[])(RArch*,RAnalOp*,ut16) = {
static char *regs(RArchSession *s) {
const char * const p =
#include "sh/regs.h"
#include "./regs.h"
;
return strdup (p);
}
@ -1328,7 +1328,7 @@ RArchPlugin r_arch_plugin_sh = {
#ifndef R2_PLUGIN_INCORE
R_API RLibStruct radare_plugin = {
.type = R_LIB_TYPE_ANAL,
.type = R_LIB_TYPE_ARCH,
.data = &r_arch_plugin_sh,
.version = R2_VERSION
};

View File

@ -1,4 +1,4 @@
OBJ_V810=arch_v810.o
OBJ_V810=p/v810/plugin.o
STATIC_OBJ+=${OBJ_V810}
OBJ_V810+=p/v810/v810_disas.o

View File

@ -7,7 +7,7 @@
#include <r_arch.h>
#include <r_util.h>
#include "v810/v810_disas.h"
#include "./v810_disas.h"
enum {
V810_FLAG_CY = 1,