diff options
| author | serpilliere <serpilliere@users.noreply.github.com> | 2016-12-23 16:09:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-12-23 16:09:07 +0100 |
| commit | 336081ceab4c81502dfe9092acdc7fadb8eb0811 (patch) | |
| tree | b94b39fc8bae9f60b0c55793d407e8e9bb9340eb | |
| parent | 00b27c5a291e201e65987c54899f547e802177e4 (diff) | |
| parent | dc9e958b0f8a9fb8eaa0f11acf75d6ed9bf3eb19 (diff) | |
| download | miasm-336081ceab4c81502dfe9092acdc7fadb8eb0811.tar.gz miasm-336081ceab4c81502dfe9092acdc7fadb8eb0811.zip | |
Merge pull request #462 from commial/fix/semantic-aas
AAS sem: avoid an ExprOp('-', a, b)| -rw-r--r-- | miasm2/arch/x86/sem.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py index 5dc49efc..ced545be 100644 --- a/miasm2/arch/x86/sem.py +++ b/miasm2/arch/x86/sem.py @@ -2663,8 +2663,13 @@ def _tpl_aaa(ir, instr, op): cond |= af & i1 to_add = m2_expr.ExprInt(0x106, size=r_ax.size) - new_ax = m2_expr.ExprOp(op, r_ax, to_add) & m2_expr.ExprInt(0xff0f, - size=r_ax.size) + if op == "-": + # Avoid ExprOp("-", A, B), should be ExprOp("+", A, ExprOp("-", B)) + first_part = r_ax - to_add + else: + first_part = m2_expr.ExprOp(op, r_ax, to_add) + new_ax = first_part & m2_expr.ExprInt(0xff0f, + size=r_ax.size) # set AL e.append(m2_expr.ExprAff(r_ax, m2_expr.ExprCond(cond, new_ax, r_ax))) e.append(m2_expr.ExprAff(af, cond)) |