Add more op.val for x86

This commit is contained in:
pancake 2016-03-30 15:50:16 +02:00
parent 400b4da257
commit 33d6a27441
4 changed files with 18 additions and 11 deletions

View File

@ -526,6 +526,9 @@ SETL/SETNGE
if (op->ptr < 0x1000)
op->ptr = UT64_MAX;
}
if (INSOP(1).type == X86_OP_IMM) {
op->val = INSOP(1).imm;
}
if (a->decode) {
if (op->prefix & R_ANAL_OP_PREFIX_REP) {
int width = INSOP(0).size;
@ -731,7 +734,7 @@ SETL/SETNGE
}
break;
case X86_OP_IMM:
op->ptr = INSOP(1).imm;
op->val = op->ptr = INSOP(1).imm;
break;
default:
break;
@ -813,7 +816,7 @@ SETL/SETNGE
}
switch (INSOP(0).type) {
case X86_OP_IMM:
op->ptr = INSOP(0).imm;
op->val = op->ptr = INSOP(0).imm;
op->type = R_ANAL_OP_TYPE_PUSH;
break;
default:
@ -877,6 +880,7 @@ SETL/SETNGE
esilprintf (op, "%d,$",
R_ABS((int)INSOP(0).imm));
op->type = R_ANAL_OP_TYPE_SWI;
op->val = (int)INSOP(0).imm;
break;
case X86_INS_SYSCALL:
op->type = R_ANAL_OP_TYPE_SWI;
@ -1114,6 +1118,9 @@ SETL/SETNGE
free (src);
free (dst);
}
if (INSOP(1).type == X86_OP_IMM) {
op->val = INSOP(1).imm;
}
break;
case X86_INS_INC:
// The CF flag is not affected. The OF, SF, ZF, AF, and PF flags
@ -1173,6 +1180,7 @@ SETL/SETNGE
op->stackptr = INSOP(1).imm;
}
}
op->val = INSOP(1).imm;
break;
case X86_INS_SBB:
// dst = dst - (src + cf)
@ -1403,6 +1411,7 @@ SETL/SETNGE
op->stackptr = -INSOP(1).imm;
}
}
op->val = INSOP(1).imm;
break;
case X86_INS_ADD:
// The OF, SF, ZF, AF, CF, and PF flags are set according to the
@ -1431,6 +1440,7 @@ SETL/SETNGE
op->stackptr = -INSOP(1).imm;
}
}
op->val = INSOP(1).imm;
break;
case X86_INS_ADC:
op->type = R_ANAL_OP_TYPE_ADD;

View File

@ -226,8 +226,6 @@ static int parse_segments(struct MACH0_(obj_t)* bin, ut64 off) {
bin->nsects = sect;
return false;
}
} else {
eprintf ("SEGMENT without sections %d\n", size_sects);
}
return true;
}

View File

@ -74,7 +74,6 @@ static int lang_rust_run(RLang *lang, const char *code, int len) {
" fn cmdstr(&self, c: *const u8, str: &str) -> String {\n" \
" unsafe {\n" \
" let ptr = r_core_cmd_str(c, str.as_ptr()) as *const i8;\n" \
// " let slice = CStr::from_ptr(ptr);\n"
" let c_str = CStr::from_ptr(ptr).to_string_lossy().into_owned();\n" \
" free (ptr as *const u8);\n" \
" String::from (c_str)\n" \