about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2015-11-09 15:16:49 +0100
committerAjax <commial@gmail.com>2015-11-09 15:16:49 +0100
commitf30ee5a3275e0e8665d017ab4e302e412d01a8c9 (patch)
tree5c0f684b0c99d41ad78c0ca64e6025cd26862368
parent7681a432c7c98df9d075701a172df0d5f311f753 (diff)
downloadmiasm-f30ee5a3275e0e8665d017ab4e302e412d01a8c9.tar.gz
miasm-f30ee5a3275e0e8665d017ab4e302e412d01a8c9.zip
x86/Sem/RDTSC: update tsc2 value on tsc1 overflow
-rw-r--r--miasm2/arch/x86/sem.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index e511a534..4b5f38c1 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -2498,6 +2498,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, []