about summary refs log tree commit diff stats
path: root/miasm2/arch/x86/sem.py
diff options
context:
space:
mode:
Diffstat (limited to 'miasm2/arch/x86/sem.py')
-rw-r--r--miasm2/arch/x86/sem.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index 04dc550b..41a2c229 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -73,11 +73,8 @@ def update_flag_pf(a):
                                            a & m2_expr.ExprInt_from(a, 0xFF)))]
 
 
-def update_flag_af(a):
-    return [m2_expr.ExprAff(af,
-                            m2_expr.ExprCond((a & m2_expr.ExprInt_from(a,0x10)),
-                                             m2_expr.ExprInt_from(af, 1),
-                                             m2_expr.ExprInt_from(af, 0)))]
+def update_flag_af(expr):
+    return [m2_expr.ExprAff(af, expr[4:5])]
 
 
 def update_flag_znp(a):
@@ -2498,6 +2495,9 @@ def hlt(ir, instr):
 def rdtsc(ir, instr):
     e = []
     e.append(m2_expr.ExprAff(tsc1, tsc1 + m2_expr.ExprInt32(1)))
+    e.append(m2_expr.ExprAff(tsc2, tsc2 + ExprCond(tsc1 - tsc1.mask,
+                                                   ExprInt32(0),
+                                                   ExprInt32(1))))
     e.append(m2_expr.ExprAff(mRAX[32], tsc1))
     e.append(m2_expr.ExprAff(mRDX[32], tsc2))
     return e, []