Implement basic imul/idiv for x86.cs

This commit is contained in:
pancake 2015-11-23 16:17:35 +01:00
parent d47216b349
commit 861e99a67c

View file

@ -1193,8 +1193,20 @@ SETL/SETNGE
free (dst);
}
break;
case X86_INS_DIV:
case X86_INS_IDIV:
op->type = R_ANAL_OP_TYPE_DIV;
if (a->decode) {
char *a0 = getarg (&gop, 0, 0, NULL);
char *a1 = getarg (&gop, 1, 0, NULL);
char *a2 = getarg (&gop, 2, 0, NULL);
// TODO update flags & handle signedness
esilprintf (op, "%s,%s,/,%s,=", a2, a1, a0);
free (a0);
free (a1);
free (a2);
}
break;
case X86_INS_DIV:
op->type = R_ANAL_OP_TYPE_DIV;
if (a->decode) {
int width = INSOP(0).size;
@ -1207,6 +1219,19 @@ SETL/SETNGE
free (dst);
}
break;
case X86_INS_IMUL:
op->type = R_ANAL_OP_TYPE_MUL;
if (a->decode) {
char *a0 = getarg (&gop, 0, 0, NULL);
char *a1 = getarg (&gop, 1, 0, NULL);
char *a2 = getarg (&gop, 2, 0, NULL);
// TODO update flags & handle signedness
esilprintf (op, "%s,%s,*,%s,=", a2, a1, a0);
free (a0);
free (a1);
free (a2);
}
break;
case X86_INS_MUL:
case X86_INS_MULX:
case X86_INS_MULPD: