diff options
| author | Ajax <commial@gmail.com> | 2015-11-10 15:00:01 +0100 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2015-11-10 15:00:01 +0100 |
| commit | 69d5421048a09ae8c13aff48c51a1cc8322ac515 (patch) | |
| tree | e997c9d4e58b21174f5e466384f74e3289b43284 | |
| parent | 206d16bad7f4a98b1be30ac9db0c4798e363c550 (diff) | |
| download | miasm-69d5421048a09ae8c13aff48c51a1cc8322ac515.tar.gz miasm-69d5421048a09ae8c13aff48c51a1cc8322ac515.zip | |
x86/TCC: add `fprem`
| -rw-r--r-- | miasm2/ir/translators/C.py | 3 | ||||
| -rw-r--r-- | miasm2/jitter/vm_mngr.c | 11 | ||||
| -rw-r--r-- | miasm2/jitter/vm_mngr.h | 1 |
3 files changed, 14 insertions, 1 deletions
diff --git a/miasm2/ir/translators/C.py b/miasm2/ir/translators/C.py index a2beee54..23f44b30 100644 --- a/miasm2/ir/translators/C.py +++ b/miasm2/ir/translators/C.py @@ -103,7 +103,8 @@ class TranslatorC(Translator): size2mask(expr.args[0].size)) elif (expr.op.startswith('cpuid') or expr.op.startswith("fcom") or - expr.op in ["fadd", "fsub", "fdiv", 'fmul', "fscale"]): + expr.op in ["fadd", "fsub", "fdiv", 'fmul', "fscale", + "fprem"]): 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 a2c29127..c9fb3eb3 100644 --- a/miasm2/jitter/vm_mngr.c +++ b/miasm2/jitter/vm_mngr.c @@ -1243,6 +1243,17 @@ double fabs(double a) return b; } +double fprem(double a, double b) +{ + double c; + c = fmod(a, b); +#ifdef DEBUG_MIASM_DOUBLE + dump_float(); + printf("%e %% %e -> %e\n", a, b, c); +#endif + return c; +} + double fchs(double a) { double b; diff --git a/miasm2/jitter/vm_mngr.h b/miasm2/jitter/vm_mngr.h index 175f000c..1c8f2ca4 100644 --- a/miasm2/jitter/vm_mngr.h +++ b/miasm2/jitter/vm_mngr.h @@ -370,6 +370,7 @@ double fscale(double a, double b); double f2xm1(double a); double fsqrt(double a); double fabs(double a); +double fprem(double a, double b); double fchs(double a); unsigned int fcom_c0(double a, double b); unsigned int fcom_c1(double a, double b); |