-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Initial attempt to have BANK switching on ESIL
- Loading branch information
Showing
8 changed files
with
106 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,6 +207,7 @@ debug.winkd | |
egg.exec | ||
egg.xor | ||
esil.null | ||
esil.banksy | ||
esil.dummy | ||
esil.forth | ||
fs.ext2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
OBJ_ESIL_BANKSY=esil_banksy.o | ||
|
||
STATIC_OBJ+=${OBJ_ESIL_BANKSY} | ||
TARGET_ESIL_BANKSY=esil_banksy.${EXT_SO} | ||
|
||
ALL_TARGETS+=${TARGET_ESIL_BANKSY} | ||
|
||
${TARGET_ESIL_BANKSY}: ${OBJ_ESIL_BANKSY} | ||
${CC} -lr_io $(call libname,esil_banksy) ${LDFLAGS} ${CFLAGS} -o esil_banksy.${EXT_SO} ${OBJ_ESIL_BANKSY} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* radare2 - LGPL - Copyright 2024 - pancake */ | ||
|
||
#define R_LOG_ORIGIN "esil.banksy" | ||
|
||
#include <r_lib.h> | ||
#include <r_core.h> | ||
#include <r_anal.h> | ||
|
||
char *obank = NULL; | ||
|
||
static bool esil_banksy_operation(REsil *esil) { | ||
RCore *core = (RCore *)esil->user; | ||
// const int obank = core->io->bank; | ||
char *src = r_esil_pop (esil); | ||
if (src) { | ||
RIOBank *b = r_io_bank_use_byname (core->io, src); | ||
if (!b) { | ||
R_LOG_WARN ("iobank mode on"); | ||
} | ||
} | ||
R_LOG_INFO ("BANK: Switch to bank %s from %s", src); | ||
return true; | ||
} | ||
|
||
static void *r_esil_banksy_init(REsil *esil) { | ||
r_esil_set_op (esil, "BANK", esil_banksy_operation, | ||
0, 0, R_ESIL_OP_TYPE_CUSTOM); | ||
R_LOG_INFO ("esil.banksy: Activated"); | ||
return NULL; | ||
} | ||
|
||
static void r_esil_banksy_fini(REsil *esil, void *user) { | ||
REsilOp *op = r_esil_get_op (esil, "BANK"); | ||
if (op && op->code == esil_banksy_operation) { | ||
r_esil_del_op (esil, "BANK"); | ||
} | ||
R_LOG_INFO ("esil.banksy: Deactivated"); | ||
} | ||
|
||
REsilPlugin r_esil_plugin_banksy = { | ||
.meta = { | ||
.name = "banky", | ||
.desc = "switch banks", | ||
.license = "LGPL3", | ||
}, | ||
.init = r_esil_banksy_init, | ||
.fini = r_esil_banksy_fini | ||
}; | ||
|
||
#ifndef R2_PLUGIN_INCORE | ||
R_API RLibStruct radare_plugin = { | ||
.type = R_LIB_TYPE_ESIL, | ||
.data = &r_esil_plugin_banksy, | ||
.version = R2_VERSION | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters