move DUP into the official esilvm opset

This commit is contained in:
condret 2015-04-02 00:27:04 +02:00
parent 04450503f3
commit 413fbb7b5d
2 changed files with 19 additions and 3 deletions

View File

@ -999,6 +999,7 @@ static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len) {
return op->size;
}
#if 0
static int x86_cs_custom_dup (RAnalEsil *esil)
{
char *dup_me;
@ -1024,6 +1025,7 @@ static int esil_x86_cs_fini (RAnalEsil *esil)
{
return R_TRUE;
}
#endif
RAnalPlugin r_anal_plugin_x86_cs = {
.name = "x86",
@ -1034,8 +1036,8 @@ RAnalPlugin r_anal_plugin_x86_cs = {
.bits = 16|32|64,
.op = &analop,
//.set_reg_profile = &set_reg_profile,
.esil_init = esil_x86_cs_init,
.esil_fini = esil_x86_cs_fini,
//.esil_init = esil_x86_cs_init,
//.esil_fini = esil_x86_cs_fini,
};
#ifndef CORELIB

View File

@ -2150,6 +2150,19 @@ static int esil_mem_deceq(RAnalEsil *esil) {
return 0;
}
static int esil_dup (RAnalEsil *esil)
{
char *dup_me;
ut64 dup;
if (!esil)
return R_FALSE;
dup_me = r_anal_esil_pop (esil);
if (!r_anal_esil_get_parm (esil, dup_me, &dup))
return R_FALSE;
free (dup_me);
return r_anal_esil_pushnum (esil, dup);
}
static int esil_smaller(RAnalEsil *esil) { // 'src < dst' => 'src,dst,<'
int ret = 0;
ut64 s, d;
@ -2541,7 +2554,8 @@ R_API int r_anal_esil_setup (RAnalEsil *esil, RAnal *anal, int romem, int stats)
r_anal_esil_set_op (esil, "GOTO", esil_goto);
r_anal_esil_set_op (esil, "BREAK", esil_break);
r_anal_esil_set_op (esil, "CLEAR", esil_clear);
r_anal_esil_set_op (esil, "DUP", esil_dup);
if (anal->cur && anal->cur->esil_init && anal->cur->esil_fini)
return anal->cur->esil_init (esil);
return R_TRUE;
}
}