diff options
| author | Ajax <commial@gmail.com> | 2015-11-13 11:29:38 +0100 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2015-11-13 11:29:38 +0100 |
| commit | e4627f5c4ea3e0f3e3555d7d72d7be0cfeefbf6e (patch) | |
| tree | 1cc77fe5126f4f0dc87217cf5ad91fef69150a6f /miasm2/arch/x86/sem.py | |
| parent | ee74c4a2b6edbb8f0241f3cc9c64333c9d3bcbf7 (diff) | |
| download | miasm-e4627f5c4ea3e0f3e3555d7d72d7be0cfeefbf6e.tar.gz miasm-e4627f5c4ea3e0f3e3555d7d72d7be0cfeefbf6e.zip | |
x86/sem: fix overflow flag condition in rotation
Diffstat (limited to 'miasm2/arch/x86/sem.py')
| -rw-r--r-- | miasm2/arch/x86/sem.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py index d0a18897..d8648644 100644 --- a/miasm2/arch/x86/sem.py +++ b/miasm2/arch/x86/sem.py @@ -429,11 +429,13 @@ def _rotate_tpl(ir, instr, a, b, op, op_cf=None, left=False): res = m2_expr.ExprOp(op, a, shifter, cf.zeroExtend(a.size)) new_cf = m2_expr.ExprOp(op_cf, a, shifter, cf.zeroExtend(a.size))[:1] + new_of = m2_expr.ExprCond(b - m2_expr.ExprInt(1, size=b.size), + m2_expr.ExprInt(0, size=of.size), + res.msb() ^ new_cf if left else (a ^ res).msb()) # Build basic blocks e_do = [ m2_expr.ExprAff(cf, new_cf), - # hack (only valid if b=1) - m2_expr.ExprAff(of, res.msb() ^ new_cf), + m2_expr.ExprAff(of, new_of), m2_expr.ExprAff(a, res), ] |