mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-15 17:30:31 +00:00
Move some R_ANAL_OP_MASK_DISASM outside RCore (#14294)
This commit is contained in:
parent
b51902dbad
commit
f917ebb71a
@ -47,16 +47,11 @@ static const char *getCondz(ut8 cond) {
|
||||
static int dalvik_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len, RAnalOpMask mask) {
|
||||
int sz = dalvik_opcodes[data[0]].len;
|
||||
if (!op || sz >= len) {
|
||||
if (mask & R_ANAL_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup ("invalid");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#if 0
|
||||
memset (op, '\0', sizeof (RAnalOp));
|
||||
op->type = R_ANAL_OP_TYPE_UNK;
|
||||
op->ptr = UT64_MAX;
|
||||
op->val = UT64_MAX;
|
||||
op->jump = UT64_MAX;
|
||||
op->fail = UT64_MAX;
|
||||
#endif
|
||||
op->size = sz;
|
||||
op->nopcode = 1; // Necessary??
|
||||
op->id = data[0];
|
||||
|
@ -747,8 +747,17 @@ static int analop(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len,
|
||||
}
|
||||
n = cs_disasm (hndl, (ut8*)buf, len, addr, 1, &insn);
|
||||
if (n < 1 || insn->size < 1) {
|
||||
if (mask & R_ANAL_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup ("invalid");
|
||||
}
|
||||
goto beach;
|
||||
}
|
||||
if (mask & R_ANAL_OP_MASK_DISASM) {
|
||||
op->mnemonic = r_str_newf ("%s%s%s",
|
||||
insn->mnemonic,
|
||||
insn->op_str[0]?" ":"",
|
||||
insn->op_str);
|
||||
}
|
||||
op->type = R_ANAL_OP_TYPE_NULL;
|
||||
op->delay = 0;
|
||||
op->jump = UT64_MAX;
|
||||
|
@ -2922,7 +2922,16 @@ static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len, RAn
|
||||
#endif
|
||||
if (n < 1) {
|
||||
op->type = R_ANAL_OP_TYPE_ILL;
|
||||
if (mask & R_ANAL_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup ("invalid");
|
||||
}
|
||||
} else {
|
||||
if (mask & R_ANAL_OP_MASK_DISASM) {
|
||||
op->mnemonic = r_str_newf ("%s%s%s",
|
||||
insn->mnemonic,
|
||||
insn->op_str[0]?" ":"",
|
||||
insn->op_str);
|
||||
}
|
||||
// int rs = a->bits / 8;
|
||||
//const char *pc = (a->bits==16)?"ip": (a->bits==32)?"eip":"rip";
|
||||
//const char *sp = (a->bits==16)?"sp": (a->bits==32)?"esp":"rsp";
|
||||
|
@ -938,7 +938,7 @@ R_API RAnalOp* r_core_anal_op(RCore *core, ut64 addr, int mask) {
|
||||
if (r_anal_op (core->anal, op, addr, ptr, len, mask) < 1) {
|
||||
goto err_op;
|
||||
}
|
||||
if (mask & R_ANAL_OP_MASK_DISASM) {
|
||||
if (!op->mnemonic && mask & R_ANAL_OP_MASK_DISASM) {
|
||||
// i dont think this is used anywhere
|
||||
// decode instruction here
|
||||
r_asm_set_pc (core->assembler, addr);
|
||||
|
Loading…
Reference in New Issue
Block a user