diff options
Diffstat (limited to 'miasm2/arch/x86/sem.py')
| -rw-r--r-- | miasm2/arch/x86/sem.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py index 22e8c276..36d8e618 100644 --- a/miasm2/arch/x86/sem.py +++ b/miasm2/arch/x86/sem.py @@ -635,7 +635,9 @@ def pop(ir, instr, a): if not s in [16, 32, 64]: raise ValueError('bad size stacker!') new_esp = mRSP[instr.mode][:s] + ExprInt_fromsize(s, off / 8) - e.append(ExprAff(mRSP[instr.mode][:s], new_esp)) + # don't generate ESP incrementation on POP ESP + if a != ir.sp: + e.append(ExprAff(mRSP[instr.mode][:s], new_esp)) # XXX FIX XXX for pop [esp] if isinstance(a, ExprMem): a = a.replace_expr({mRSP[instr.mode]: new_esp}) @@ -1821,16 +1823,16 @@ def fucomip(ir, instr, a, b): def fcomp(ir, instr, a, b = None): - dst, e, extra = fcom(ir, instr, a, b) + e, extra = fcom(ir, instr, a, b) e += float_pop() e += set_float_cs_eip(instr) - return dst, e, extra + return e, extra def ficomp(ir, instr, a, b = None): - dst, e, extra = ficom(ir, instr, a, b) + e, extra = ficom(ir, instr, a, b) e += float_pop() e += set_float_cs_eip(instr) - return dst, e, extra + return e, extra def fld(ir, instr, a): @@ -1872,9 +1874,9 @@ def fst(ir, instr, a): def fstp(ir, instr, a): - dst, e, extra = fst(ir, instr, a) + e, extra = fst(ir, instr, a) e += float_pop(a) - return dst, e, extra + return e, extra def fist(ir, instr, a): @@ -1885,9 +1887,9 @@ def fist(ir, instr, a): return e, [] def fistp(ir, instr, a): - dst, e, extra = fist(ir, instr, a) + e, extra = fist(ir, instr, a) e += float_pop(a) - return dst, e, extra + return e, extra def fist(ir, instr, a): e = [] @@ -1910,9 +1912,9 @@ def fild(ir, instr, a): src = ExprOp('int_%.2d_to_double' % a.size, a) e = [] e += set_float_cs_eip(instr) - dst, e_fld, extra = fld(ir, instr, src) + e_fld, extra = fld(ir, instr, src) e += e_fld - return dst, e, extra + return e, extra def fldz(ir, instr): @@ -2003,6 +2005,9 @@ def fnstenv(ir, instr, a): ]) s = instr.mode + # The behaviour in 64bit is identical to 64 bit + # This will truncate addresses + s = min(32, s) ad = ExprMem(a.arg, size=16) e.append(ExprAff(ad, float_control)) ad = ExprMem(a.arg + ExprInt_from(a.arg, s / 8 * 1), size=16) |