about summary refs log tree commit diff stats
path: root/miasm2/arch/x86/sem.py
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2017-07-21 17:39:27 +0200
committerAjax <commial@gmail.com>2017-07-24 09:01:20 +0200
commitf01c3f1c6d233c30b3c16deeda4d5b0114ae47e7 (patch)
treeda23e556dd876e597dc53909eb851edc3d7701c7 /miasm2/arch/x86/sem.py
parent4dfca940e75ad8af65b69dd9bab9ff503141984b (diff)
downloadmiasm-f01c3f1c6d233c30b3c16deeda4d5b0114ae47e7.tar.gz
miasm-f01c3f1c6d233c30b3c16deeda4d5b0114ae47e7.zip
x86: fix MOVSD semantic
Diffstat (limited to '')
-rw-r--r--miasm2/arch/x86/sem.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index b3dfb3ef..12f2ef2a 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -1775,14 +1775,18 @@ def movs(ir, instr, size):
 
 
 def movsd(_, instr, dst, src):
-    e = []
-    if isinstance(dst, m2_expr.ExprId) and isinstance(src, m2_expr.ExprMem):
-        src = m2_expr.ExprMem(src.arg, dst.size)
-    elif isinstance(dst, m2_expr.ExprMem) and isinstance(src, m2_expr.ExprId):
-        dst = m2_expr.ExprMem(dst.arg, src.size)
-
-    e.append(m2_expr.ExprAff(dst, src))
-    return e, []
+    # 64 bits access
+    if dst.is_id() and src.is_id():
+        src = src[:64]
+        dst = dst[:64]
+    elif dst.is_mem() and src.is_id():
+        dst = m2_expr.ExprMem(dst.arg, 64)
+        src = src[:64]
+    else:
+        src = m2_expr.ExprMem(src.arg, 64)
+        # Erase dst high bits
+        src = src.zeroExtend(dst.size)
+    return [m2_expr.ExprAff(dst, src)], []
 
 
 def movsd_dispatch(ir, instr, dst=None, src=None):