Add the gb.pseudo plugin ##arch

This commit is contained in:
pancake 2024-11-16 21:18:01 +01:00 committed by GitHub
parent 3921857875
commit 71a7e9bb48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 37 additions and 4 deletions

View File

@ -292,6 +292,7 @@ parse.bpf_pseudo
parse.chip8_pseudo
parse.dalvik_pseudo
parse.evm_pseudo
parse.gb_pseudo
parse.m68k_pseudo
parse.mips_pseudo
parse.ppc_pseudo

2
libr/arch/p/gb/pseudo.c Normal file
View File

@ -0,0 +1,2 @@
#define Z80_IS_GB 1
#include "../z80/pseudo.c"

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2015-2022 - jvoisin */
/* radare - LGPL - Copyright 2015-2024 - jvoisin */
#include <r_lib.h>
#include <r_flag.h>
@ -78,11 +78,19 @@ static int parse(RParse *p, const char *data, char *str) {
return true;
}
RParsePlugin r_parse_plugin_z80_pseudo = {
.name = "z80.pseudo",
.desc = "z80 pseudo syntax",
#if Z80_IS_GB
RParsePlugin r_parse_plugin_gb_pseudo = {
.name = "gb.pseudo",
.desc = "GameBoy pseudo syntax",
.parse = parse, // parse actually converts the string into asm.pseudo
};
#else
RParsePlugin r_parse_plugin_z80_pseudo = {
.name = "z80.pseudo",
.desc = "Z80 pseudo syntax",
.parse = parse, // parse actually converts the string into asm.pseudo
};
#endif
#ifndef R2_PLUGIN_INCORE
R_API RLibStruct radare_plugin = {

View File

@ -10,6 +10,7 @@ r_asm_sources = [
'../arch/p/null/pseudo.c',
'../arch/p/tricore/pseudo.c',
'../arch/p/z80/pseudo.c',
'../arch/p/gb/pseudo.c',
'../arch/p/wasm/pseudo.c',
'../arch/p/v850/pseudo.c',
'../arch/p/tms320/pseudo.c',

18
libr/asm/p/gb_pseudo.mk Normal file
View File

@ -0,0 +1,18 @@
OBJ_GB_PSEUDO+=$(LIBR)/arch/p/gb/pseudo.o
TARGET_GB_PSEUDO=parse_gb_pseudo.${EXT_SO}
STATIC_OBJ+=${OBJ_GB_PSEUDO}
ifeq ($(CC),cccl)
LIBDEPS=-L../../util -llibr_util
LIBDEPS+=-L../../flag -llibr_flag
else
LIBDEPS=-L../../util -lr_util
LIBDEPS+=-L../../flag -lr_flag
endif
ifeq ($(WITHPIC),1)
ALL_TARGETS+=${TARGET_GB_PSEUDO}
${TARGET_GB_PSEUDO}: ${OBJ_GB_PSEUDO}
${CC} $(call libname,parse_gb_pseudo) ${LIBDEPS} $(LDFLAGS) \
$(LDFLAGS_SHARED) ${CFLAGS} -o ${TARGET_GB_PSEUDO} ${OBJ_GB_PSEUDO}
endif

View File

@ -97,6 +97,7 @@ extern RParsePlugin r_parse_plugin_bpf_pseudo;
extern RParsePlugin r_parse_plugin_stm8_pseudo;
extern RParsePlugin r_parse_plugin_evm_pseudo;
extern RParsePlugin r_parse_plugin_null_pseudo;
extern RParsePlugin r_parse_plugin_gb_pseudo;
extern RParsePlugin r_parse_plugin_tricore_pseudo;
#endif

View File

@ -409,6 +409,7 @@ EXPECT=<<EOF
{
"opcode": "adc 0xed",
"disasm": "adc 0xed",
"pseudo": "0xed = 0xed + ",
"description": "add with carry register pair",
"srcs": [
{

View File

@ -12,6 +12,7 @@ bpf.pseudo
chip8.pseudo
dalvik.pseudo
evm.pseudo
gb.pseudo
m68k.pseudo
mips.pseudo
null.pseudo