diff options
| author | Ajax <commial@gmail.com> | 2015-11-10 14:53:37 +0100 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2015-11-10 14:53:37 +0100 |
| commit | 4807c50299bdaa0b62c5a4b56400c3aacc7f6195 (patch) | |
| tree | 84b1d435c68ad6a8d6e3518d2ad7c81129e54618 | |
| parent | 4e677ff826933d9de2a82539327c0d4bbe856342 (diff) | |
| download | miasm-4807c50299bdaa0b62c5a4b56400c3aacc7f6195.tar.gz miasm-4807c50299bdaa0b62c5a4b56400c3aacc7f6195.zip | |
x86/TCC: add `fchs`
| -rw-r--r-- | miasm2/ir/translators/C.py | 2 | ||||
| -rw-r--r-- | miasm2/jitter/vm_mngr.c | 10 | ||||
| -rw-r--r-- | miasm2/jitter/vm_mngr.h | 1 |
3 files changed, 12 insertions, 1 deletions
diff --git a/miasm2/ir/translators/C.py b/miasm2/ir/translators/C.py index b87c2656..96be6bd0 100644 --- a/miasm2/ir/translators/C.py +++ b/miasm2/ir/translators/C.py @@ -68,7 +68,7 @@ class TranslatorC(Translator): expr.op.startswith("access_") or expr.op.startswith("load_") or expr.op in ["-", "ftan", "frndint", "f2xm1", - "fsin", "fsqrt", "fabs", "fcos"]): + "fsin", "fsqrt", "fabs", "fcos", "fchs"]): return "%s(%s)" % (expr.op, self.from_expr(expr.args[0])) else: raise NotImplementedError('Unknown op: %r' % expr.op) diff --git a/miasm2/jitter/vm_mngr.c b/miasm2/jitter/vm_mngr.c index bf1eb7df..d0171c17 100644 --- a/miasm2/jitter/vm_mngr.c +++ b/miasm2/jitter/vm_mngr.c @@ -1243,6 +1243,16 @@ double fabs(double a) return b; } +double fchs(double a) +{ + double b; + b = -a; +#ifdef DEBUG_MIASM_DOUBLE + dump_float(); + printf(" - %e -> %e\n", a, b); +#endif + return b; +} unsigned int fcom_c0(double a, double b) diff --git a/miasm2/jitter/vm_mngr.h b/miasm2/jitter/vm_mngr.h index c93ed583..dd0bad0f 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 fchs(double a); unsigned int fcom_c0(double a, double b); unsigned int fcom_c1(double a, double b); unsigned int fcom_c2(double a, double b); |