about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--miasm2/ir/translators/C.py2
-rw-r--r--miasm2/jitter/vm_mngr.c10
-rw-r--r--miasm2/jitter/vm_mngr.h1
3 files changed, 12 insertions, 1 deletions
diff --git a/miasm2/ir/translators/C.py b/miasm2/ir/translators/C.py
index 23f44b30..ae305156 100644
--- a/miasm2/ir/translators/C.py
+++ b/miasm2/ir/translators/C.py
@@ -104,7 +104,7 @@ class TranslatorC(Translator):
             elif (expr.op.startswith('cpuid') or
                   expr.op.startswith("fcom")  or
                   expr.op in ["fadd", "fsub", "fdiv", 'fmul', "fscale",
-                              "fprem"]):
+                              "fprem", "fyl2x"]):
                 return "%s(%s, %s)" % (expr.op, self.from_expr(expr.args[0]),
                                        self.from_expr(expr.args[1]))
             elif expr.op == "segm":
diff --git a/miasm2/jitter/vm_mngr.c b/miasm2/jitter/vm_mngr.c
index c9fb3eb3..b7de5639 100644
--- a/miasm2/jitter/vm_mngr.c
+++ b/miasm2/jitter/vm_mngr.c
@@ -1265,6 +1265,16 @@ double fchs(double a)
 	return b;
 }
 
+double fyl2x(double a, double b)
+{
+	double c;
+	c = b * (log(a) / log(2));
+#ifdef DEBUG_MIASM_DOUBLE
+	dump_float();
+	printf("%e * log(%e) -> %e\n", b, a, c);
+#endif
+	return c;
+}
 
 unsigned int fcom_c0(double a, double b)
 {
diff --git a/miasm2/jitter/vm_mngr.h b/miasm2/jitter/vm_mngr.h
index 1c8f2ca4..12904730 100644
--- a/miasm2/jitter/vm_mngr.h
+++ b/miasm2/jitter/vm_mngr.h
@@ -372,6 +372,7 @@ double fsqrt(double a);
 double fabs(double a);
 double fprem(double a, double b);
 double fchs(double a);
+double fyl2x(double a, double b);
 unsigned int fcom_c0(double a, double b);
 unsigned int fcom_c1(double a, double b);
 unsigned int fcom_c2(double a, double b);