diff options
| author | Camille Mougey <commial@gmail.com> | 2015-08-01 21:39:21 +0200 |
|---|---|---|
| committer | Camille Mougey <commial@gmail.com> | 2015-08-01 21:39:21 +0200 |
| commit | 1d48224cd34d1a18763e47f3f61c5340b9587c7e (patch) | |
| tree | 1b8d428987b6995e922a9a8d91f853d845eb5131 | |
| parent | ea4ca3425e49c59fa4cb9b5b5b91cc9431dcb843 (diff) | |
| parent | 4fc49aac4a5d06ed03b216a635fd9da9bf090ea1 (diff) | |
| download | miasm-1d48224cd34d1a18763e47f3f61c5340b9587c7e.tar.gz miasm-1d48224cd34d1a18763e47f3f61c5340b9587c7e.zip | |
Merge pull request #203 from serpilliere/fix_mod_div_arg
IR/Translators/C: fix umod/udiv argument
| -rw-r--r-- | miasm2/ir/translators/C.py | 8 | ||||
| -rw-r--r-- | test/ir/ir2C.py | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/miasm2/ir/translators/C.py b/miasm2/ir/translators/C.py index 4018454b..b87c2656 100644 --- a/miasm2/ir/translators/C.py +++ b/miasm2/ir/translators/C.py @@ -109,10 +109,10 @@ class TranslatorC(Translator): return "segm2addr(jitcpu, %s, %s)" % ( self.from_expr(expr.args[0]), self.from_expr(expr.args[1])) elif expr.op in ['udiv', 'umod', 'idiv', 'imod']: - return '%s%d(jitcpu, %s, %s)' % (expr.op, - expr.args[0].size, - self.from_expr(expr.args[0]), - self.from_expr(expr.args[1])) + return '%s%d((vm_cpu_t*)jitcpu->cpu, %s, %s)' % (expr.op, + expr.args[0].size, + self.from_expr(expr.args[0]), + self.from_expr(expr.args[1])) elif expr.op in ["bcdadd", "bcdadd_cf"]: return "%s_%d(%s, %s)" % (expr.op, expr.args[0].size, self.from_expr(expr.args[0]), diff --git a/test/ir/ir2C.py b/test/ir/ir2C.py index 3a89b328..8a5f97c4 100644 --- a/test/ir/ir2C.py +++ b/test/ir/ir2C.py @@ -48,7 +48,7 @@ class TestIrIr2C(unittest.TestCase): self.translationTest( ExprOp('segm', *args[:2]), r'segm2addr(jitcpu, 0x0, 0x1)') self.translationTest( - ExprOp('imod', *args[:2]), r'imod32(jitcpu, 0x0, 0x1)') + ExprOp('imod', *args[:2]), r'imod32((vm_cpu_t*)jitcpu->cpu, 0x0, 0x1)') self.translationTest( ExprOp('bcdadd', *args[:2]), r'bcdadd_32(0x0, 0x1)') self.assertRaises(NotImplementedError, translator.from_expr, |