Tiny fixes for the v850.np esil ##esil

This commit is contained in:
pancake 2022-05-22 00:16:00 +02:00 committed by pancake
parent 919e3ac1a1
commit 6b28a44133
5 changed files with 16 additions and 11 deletions

View File

@ -861,9 +861,9 @@ const struct v850_opcode v850_opcodes[] = {
{ "jarl32", one (0x02e0), one (0xffe0), {D32_31_PCREL, R1_NOTR0}, 0, V850_CPU_E2_UP | V850_CPU_OPTION_ALIAS },
{ "jarlw", one (0x02e0), one (0xffe0), {D32_31_PCREL, R1_NOTR0}, 0, V850_CPU_E2_UP | V850_CPU_OPTION_ALIAS },
{ "jmp", two (0x06e0, 0x0000), two (0xffe0, 0x0001), {D32_31, R1}, 2, V850_CPU_E3V5_UP , R_ANAL_OP_TYPE_MJMP, "#1,[4],PC,:=" },
{ "jmp", one (0x06e0), one (0xffe0), {D32_31, R1}, 2, V850_CPU_E2 | V850_CPU_E2V3, R_ANAL_OP_TYPE_MJMP, "#1,[4],PC,:=" },
{ "jmp", one (0x0060), one (0xffe0), {R1}, 1, V850_CPU_ALL, R_ANAL_OP_TYPE_RJMP, "#1,[4],PC,:=" },
{ "jmp", two (0x06e0, 0x0000), two (0xffe0, 0x0001), {D32_31, R1}, 2, V850_CPU_E3V5_UP , R_ANAL_OP_TYPE_MJMP, "#1,PC,:=" },
{ "jmp", one (0x06e0), one (0xffe0), {D32_31, R1}, 2, V850_CPU_E2 | V850_CPU_E2V3, R_ANAL_OP_TYPE_MJMP, "#1,PC,:=" },
{ "jmp", one (0x0060), one (0xffe0), {R1}, 1, V850_CPU_ALL, R_ANAL_OP_TYPE_RJMP, "#1,PC,:=" },
/* Gas local alias of jmp disp22(not defined in spec). */
{ "jmp22", one (0x0060), one (0xffe0), {R1}, 1, V850_CPU_ALL | V850_CPU_OPTION_ALIAS, R_ANAL_OP_TYPE_JMP },
/* Gas local alias of jmp disp32(not defined in spec). */

View File

@ -745,7 +745,10 @@ static bool esil_sf(RAnalEsil *esil) {
r_return_val_if_fail (esil, false);
char *p_size = r_anal_esil_pop (esil);
r_return_val_if_fail (p_size, false);
if (!p_size) {
R_LOG_WARN ("$sf cannot pop value");
return false;
}
if (r_anal_esil_get_parm_type (esil, p_size) != R_ANAL_ESIL_PARM_NUM) {
free (p_size);
@ -760,8 +763,7 @@ static bool esil_sf(RAnalEsil *esil) {
} else {
num = (esil->cur >> size) & 1;
}
ut64 res = r_anal_esil_pushnum (esil, num);
return res;
return r_anal_esil_pushnum (esil, num);
}
static bool esil_ds(RAnalEsil *esil) {

View File

@ -101,10 +101,10 @@ static char *get_reg_profile(RAnal *anal) {
"gpr r0 .32 0 0\n"
"gpr r1 .32 4 0\n"
"gpr r2 .32 8 0\n"
"gpr r3 .32 12 0\n"
"gpr sp .32 12 0\n"
"gpr r4 .32 16 0\n"
"gpr r3 .32 12 0\n"
"gpr gp .32 16 0\n"
"gpr r4 .32 16 0\n"
"gpr r5 .32 20 0\n"
"gpr tp .32 20 0\n"
"gpr r6 .32 24 0\n"

View File

@ -2999,9 +2999,11 @@ R_API bool r_core_init(RCore *core) {
core->lastcmd = NULL;
core->cmdlog = NULL;
sdb_free (core->print->charset->db);
core->print->charset->db = sdb_ns (core->sdb, "charset", 1);
core->print->charset->db->refs++; // increase reference counter to avoid double-free
if (core->print->charset) {
sdb_free (core->print->charset->db);
core->print->charset->db = sdb_ns (core->sdb, "charset", 1);
core->print->charset->db->refs++; // increase reference counter to avoid double-free
}
// ideally sdb_ns_set should be used here, but it doesnt seems to work well. must fix
// sdb_ns_set (DB, "charset", core->print->charset->db);
core->stkcmd = NULL;

View File

@ -84,6 +84,7 @@ R_API void r_charset_free(RCharset *c) {
}
R_API void r_charset_close(RCharset *c) {
r_return_if_fail (c);
c->loaded = false;
}