about summary refs log tree commit diff stats
path: root/miasm2/arch/x86/sem.py
diff options
context:
space:
mode:
authorserpilliere <fabrice.desclaux@cea.fr>2015-10-18 19:07:38 +0200
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2015-10-23 10:53:51 +0200
commit5bb5d780340db46d17f680bdf946aa2696824b56 (patch)
treed14ac26eb79aa7826f45e0c3328db9ffb1fa6f7a /miasm2/arch/x86/sem.py
parent04d8224885693f47c3c5cf0e4aa54587bf20f073 (diff)
downloadmiasm-5bb5d780340db46d17f680bdf946aa2696824b56.tar.gz
miasm-5bb5d780340db46d17f680bdf946aa2696824b56.zip
Arch/x86/sem: add fdivrp; fix fcomp
Diffstat (limited to '')
-rw-r--r--miasm2/arch/x86/sem.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index 14df7a53..f3ebc065 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -2257,6 +2257,23 @@ def fdivr(ir, instr, a, b=None):
     return e, []
 
 
+def fdivrp(ir, instr, a, b=None):
+    if b is None:
+        b = a
+        a = float_st0
+    e = []
+    if isinstance(b, m2_expr.ExprMem):
+        if b.size > 64:
+            raise NotImplementedError('float to long')
+        src = m2_expr.ExprOp('mem_%.2d_to_double' % b.size, b)
+    else:
+        src = b
+    e.append(m2_expr.ExprAff(float_prev(a), m2_expr.ExprOp('fdiv', src, a)))
+    e += set_float_cs_eip(instr)
+    e += float_pop(a)
+    return e, []
+
+
 def fidiv(ir, instr, a, b=None):
     if b is None:
         b = a
@@ -3708,6 +3725,7 @@ mnemo_func = {'mov': mov,
               'fmulp': fmulp,
               'fdiv': fdiv,
               'fdivr': fdivr,
+              'fdivrp': fdivrp,
               'fidiv': fidiv,
               'fidivr': fidivr,
               'fdivp': fdivp,