Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

anal_x86_cs fix esil expr for neg instruction #15252

Merged
merged 1 commit into from
Oct 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions libr/anal/p/anal_x86_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1615,8 +1615,25 @@ static void anop_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len,
ut32 bitsize;
src = getarg (&gop, 0, 0, NULL, SRC_AR, NULL);
dst = getarg (&gop, 0, 1, NULL, DST_AR, &bitsize);
esilprintf (op, "0,cf,:=,0,%s,>,?{,1,cf,:=,},%s,0,-,%s,$z,zf,:=,0,of,:=,%d,$s,sf,:=,%d,$o,pf,:=",
src, src, dst, bitsize - 1, bitsize - 1); //is this correct ?
ut64 xor = 0;
switch (bitsize) {
case 8:
xor = 0xff;
break;
case 16:
xor = 0xffff;
break;
case 32:
xor = 0xffffffff;
break;
case 64:
xor = 0xffffffffffffffff;
break;
default:
eprintf ("Neg: Unhandled bitsize %d\n", bitsize);
}
esilprintf (op, "%s,!,!,cf,:=,%s,0x%"PFMT64x",^,1,+,%s,$z,zf,:=,0,of,:=,%d,$s,sf,:=,%d,$o,pf,:=",
src, src, xor, dst, bitsize - 1, bitsize - 1);
}
break;
case X86_INS_NOT:
Expand Down