mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-04 03:11:28 +00:00
8051 is a 8bit cpu, set asm.bits when asm.arch doesnt supports current value
This commit is contained in:
parent
20ed296741
commit
b3e8b3152b
@ -84,7 +84,7 @@ static int i8051_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len
|
||||
struct r_anal_plugin_t r_anal_plugin_8051 = {
|
||||
.name = "8051",
|
||||
.arch = R_SYS_ARCH_8051,
|
||||
.bits = 16,
|
||||
.bits = 8,
|
||||
.desc = "8051 CPU code analysis plugin",
|
||||
.license = "LGPL3",
|
||||
.init = NULL,
|
||||
|
@ -38,7 +38,7 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
|
||||
RAsmPlugin r_asm_plugin_8051 = {
|
||||
.name = "8051",
|
||||
.arch = "8051",
|
||||
.bits = 16,
|
||||
.bits = 8,
|
||||
.desc = "8051 Intel CPU",
|
||||
.init = NULL,
|
||||
.fini = NULL,
|
||||
|
@ -152,6 +152,7 @@ static int cb_analsplit(void *user, void *data) {
|
||||
}
|
||||
|
||||
static int cb_asmarch(void *user, void *data) {
|
||||
char asmparser[32];
|
||||
RCore *core = (RCore *) user;
|
||||
RConfigNode *node = (RConfigNode *) data;
|
||||
const char *asmos = core->config? r_config_get (core->config, "asm.os"): NULL;
|
||||
@ -163,11 +164,16 @@ static int cb_asmarch(void *user, void *data) {
|
||||
r_egg_setup (core->egg, node->value, core->anal->bits, 0, R_SYS_OS);
|
||||
if (!r_asm_use (core->assembler, node->value))
|
||||
eprintf ("asm.arch: cannot find (%s)\n", node->value);
|
||||
{
|
||||
char asmparser[32];
|
||||
snprintf (asmparser, sizeof (asmparser), "%s.pseudo", node->value);
|
||||
|
||||
r_config_set (core->config, "asm.parser", asmparser);
|
||||
snprintf (asmparser, sizeof (asmparser), "%s.pseudo", node->value);
|
||||
r_config_set (core->config, "asm.parser", asmparser);
|
||||
if (!(core->assembler->cur->bits & core->anal->bits)) {
|
||||
int bits = core->assembler->cur->bits;
|
||||
if (8&bits) bits = 8;
|
||||
else if (16&bits) bits=16;
|
||||
else if (32&bits) bits=32;
|
||||
else bits=64;
|
||||
r_config_set_i (core->config, "asm.bits", bits);
|
||||
}
|
||||
if (!r_config_set (core->config, "anal.arch", node->value)) {
|
||||
char *p, *s = strdup (node->value);
|
||||
|
@ -365,7 +365,7 @@ R_API RSocket *r_socket_accept(RSocket *s) {
|
||||
//signal (SIGPIPE, SIG_DFL);
|
||||
sock->fd = accept (s->fd, (struct sockaddr *)&s->sa, &salen);
|
||||
if (sock->fd == -1) {
|
||||
r_sys_perror("accept");
|
||||
r_sys_perror ("accept");
|
||||
free (sock);
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user