Fix div with byte divisor (#9074)

This commit is contained in:
emvivre 2017-12-27 10:41:34 +01:00 committed by radare
parent 61cf23c33b
commit 16a7cd3a09
1 changed files with 10 additions and 4 deletions

View File

@ -1369,11 +1369,17 @@ static void anop_esil (RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len
{
int width = INSOP(0).size;
dst = getarg (&gop, 0, 0, NULL, DST_AR);
const char *r_ax = (width==2)?"ax": (width==4)?"eax":"rax";
const char *r_dx = (width==2)?"dx": (width==4)?"edx":"rdx";
const char *r_quot = (width==1)?"al": (width==2)?"ax": (width==4)?"eax":"rax";
const char *r_rema = (width==1)?"ah": (width==2)?"dx": (width==4)?"edx":"rdx";
const char *r_nume = (width==1)?"ax": r_quot;
// TODO update flags & handle signedness
esilprintf (op, "%s,%s,%%,%s,=,%s,%s,/,%s,=",
dst, r_ax, r_dx, dst, r_ax, r_ax);
if ( width == 1 ) {
esilprintf(op, "0xffffff00,eflags,&=,%s,%s,%%,eflags,|=,%s,%s,/,%s,=,0xff,eflags,&,%s,=,0xffffff00,eflags,&=,2,eflags,|=",
dst, r_nume, dst, r_nume, r_quot, r_rema);
} else {
esilprintf (op, "%s,%s,%%,%s,=,%s,%s,/,%s,=",
dst, r_nume, r_rema, dst, r_nume, r_quot);
}
}
break;
case X86_INS_IMUL: