RArch now depends on REsil ##abi

This commit is contained in:
Luc Tielen 2023-06-10 00:06:53 +02:00 committed by pancake
parent 97a7b7b4a3
commit 48bbbba6a4
12 changed files with 42 additions and 40 deletions

View File

@ -18,30 +18,14 @@ include libs.mk
.PHONY: $(LIBS)
all:
ifneq ($(LIBS0),)
$(MAKE) $(LIBS0)
endif
ifneq ($(LIBS1),)
$(MAKE) $(LIBS1)
endif
ifneq ($(LIBS2),)
$(MAKE) $(LIBS2)
endif
ifneq ($(LIBS3),)
$(MAKE) $(LIBS3)
endif
ifneq ($(LIBS4),)
$(MAKE) $(LIBS4)
endif
ifneq ($(LIBS5),)
$(MAKE) $(LIBS5)
endif
ifneq ($(LIBS6),)
$(MAKE) $(LIBS6)
endif
ifneq ($(LIBS7),)
$(MAKE) $(LIBS7)
endif
ifneq ($(LIBS8),)
$(MAKE) $(LIBS8)
endif

View File

@ -2,7 +2,7 @@ include ../config.mk
include p/capstone.mk
NAME=r_arch
R2DEPS+=r_util r_reg
R2DEPS+=r_util r_reg r_esil
CFLAGS+=-DR2_PLUGIN_INCORE
CFLAGS:=-I.. -I$(LTOP)/asm/arch/include -DR2_PLUGIN_INCORE -Iarch -I$(TOP)/shlr $(CFLAGS)

View File

@ -180,6 +180,7 @@ r_arch = library('r_arch', r_arch_sources,
c_args: library_cflags,
dependencies: [
r_util_dep,
r_esil_dep,
r_reg_dep,
java_dep,
capstone_dep,
@ -217,6 +218,7 @@ pkgconfig_mod.generate(r_arch,
libraries: pkgcfg_sanitize_libs,
requires: [
'r_util',
'r_esil',
'r_reg',
],
description: 'radare foundation libraries'

View File

@ -278,9 +278,11 @@ R_API RLibStruct radare_plugin = {
#else
// empty plugin
RArchPlugin r_arch_plugin_6502_cs = {
.meta {
.name = "6502.cs",
.desc = "Capstone mos65xx analysis plugin (not supported)",
.license = "LGPL3",
},
.arch = "6502",
.bits = R_SYS_BITS_PACK1 (8),
};

View File

@ -1,7 +1,6 @@
/* radare2 - LGPL - Copyright 2015-2023 - mrmacete, pancake */
#include <r_arch.h>
#include <r_esil.h>
#include <r_anal/op.h>
#include "bpf.h"
@ -741,11 +740,6 @@ static bool encode(RArchSession *s, RAnalOp *op, ut32 mask) {
// (k) >= 0 must also be true, but the value is already unsigned
#define INSIDE_M(k) ((k) < 16)
/*
static bool bpf_int_exit(REsil *esil, ut32 interrupt, void *user);
REsilInterruptHandler ih = { 0, NULL, NULL, &bpf_int_exit, NULL };
*/
#if 0
static const char *M[] = {
"m[0]",
@ -1214,6 +1208,8 @@ static bool esilcb(RArchSession *as, RArchEsilAction action) {
case R_ARCH_ESIL_FINI:
r_esil_del_interrupt (esil, 0);
break;
default:
return false;
}
return true;
}
@ -1230,6 +1226,7 @@ RArchPlugin r_arch_plugin_bpf = {
.encode = encode,
.decode = decode,
.regs = &regs,
.esilcb = &esilcb,
};
#ifndef R2_PLUGIN_INCORE

View File

@ -1,7 +1,7 @@
include ../../global.mk
NAME=r_asm
R2DEPS=r_syscall r_util
R2DEPS=r_syscall r_util r_esil
R2DEPS+=r_flag r_cons r_reg r_arch
CFLAGS+=-DR2_PLUGIN_INCORE -Iarch/include -Iarch -I../../shlr
CURDIR=p/

View File

@ -2,7 +2,7 @@ include ../config.mk
NAME=r_egg
R2DEPS=r_asm r_syscall r_util
R2DEPS+=r_flag r_cons r_reg r_lang r_arch
R2DEPS+=r_flag r_cons r_reg r_arch
R2DEPS+=r_esil r_anal r_crypto r_search
OBJS=egg.o egg_lang.o

View File

@ -1,6 +1,9 @@
#include <r_anal.h>
#include <r_util.h>
#include <sdb/sdb.h>
/* radare - LGPL - Copyright 2014-2023 - pancake, condret */
// TODO: esil_handler.c -> esil_syscall ? set_interrupts ? set_syscalls?
#define R_LOG_ORIGIN "esil.syscall"
#include <r_esil.h>
static bool _set_interrupt(REsil *esil, REsilHandler *intr, ut32 intr_num) {
return intr_num ? dict_set (esil->interrupts, intr_num, intr_num, intr) : (esil->intr0 = intr, true);

View File

@ -6,6 +6,7 @@
#include <r_util.h>
#include <r_bin.h>
#include <r_reg.h>
#include <r_lib.h>
// Rename to R_ARCH_VALTYPE_*
typedef enum {
@ -49,6 +50,7 @@ typedef struct r_arch_value_t {
const char *regdelta;
} RArchValue;
#include <r_anal/op.h>
#include <r_esil.h>
#ifdef __cplusplus
extern "C" {
@ -130,6 +132,7 @@ typedef enum {
typedef struct r_arch_t {
RList *plugins; // all plugins
RBinBind binb; // required for java, dalvik, wasm, pickle and pyc plugin... pending refactor
struct r_esil_t *esil;
RNum *num; // XXX maybe not required
struct r_arch_session_t *session;
RArchConfig *cfg; // global / default config
@ -141,12 +144,20 @@ typedef struct r_arch_session_t {
struct r_arch_t *arch;
struct r_arch_plugin_t *plugin; // used for decoding
struct r_arch_session_t *encoder; // used for encoding when plugin->encode is not set
RArchConfig *config; // TODO remove arch->config!
void *data;
void *user;
RArchConfig *config; // TODO remove arch->config and keep archsession->config
void *data; // store plugin-specific data
void *user; // holds user pointer provided by user
R_REF_TYPE;
} RArchSession;
typedef enum {
R_ARCH_ESIL_INIT,
R_ARCH_ESIL_MAPS,
// R_ARCH_ESIL_EVAL,
R_ARCH_ESIL_RESET,
R_ARCH_ESIL_FINI,
} RArchEsilAction;
typedef ut32 RArchDecodeMask;
typedef ut32 RArchEncodeMask; // syntax ?
typedef ut32 RArchModifyMask; // syntax ?
@ -160,6 +171,7 @@ typedef bool (*RArchPluginModifyCallback)(RArchSession *s, struct r_anal_op_t *o
typedef RList *(*RArchPluginPreludesCallback)(RArchSession *s);
typedef bool (*RArchPluginInitCallback)(RArchSession *s);
typedef bool (*RArchPluginFiniCallback)(RArchSession *s);
typedef bool (*RArchPluginEsilCallback)(RArchSession *s, RArchEsilAction action);
// TODO: use `const char *const` instead of `char*`
typedef struct r_arch_plugin_t {
@ -188,6 +200,7 @@ typedef struct r_arch_plugin_t {
RArchPluginModifyCallback patch;
RArchPluginMnemonicsCallback mnemonics;
RArchPluginPreludesCallback preludes;
RArchPluginEsilCallback esilcb;
} RArchPlugin;
// decoder.c

View File

@ -7,6 +7,7 @@ R2DEPS+=r_cons
R2DEPS+=r_reg
R2DEPS+=r_asm
R2DEPS+=r_arch
R2DEPS+=r_esil
R2DEPS+=r_syscall
R2DEPS+=r_flag
CFLAGS+=-DR2_PLUGIN_INCORE

View File

@ -2,11 +2,11 @@
ifeq ($(LIBS0),)
LIBS0=util
LIBS1=socket reg cons magic bp config crypto syscall
LIBS2=search flag arch esil io
LIBS3=asm fs anal
LIBS4=bin lang
LIBS5=egg
LIBS1=socket reg cons bp config crypto syscall
LIBS2=search flag esil io
LIBS3=arch fs # esil depends on reg and esil
LIBS4=asm anal magic
LIBS5=lang egg bin
LIBS6=debug
LIBS7=core
LIBS8=main

View File

@ -616,13 +616,13 @@ subdir('libr/search')
subdir('libr/magic')
subdir('libr/flag')
subdir('libr/reg')
subdir('libr/esil')
subdir('libr/arch')
subdir('libr/fs')
subdir('libr/bin')
subdir('libr/config')
subdir('libr/asm')
subdir('libr/lang')
subdir('libr/esil')
subdir('libr/anal')
subdir('libr/egg')
subdir('libr/debug')