diff options
| author | Ajax <commial@gmail.com> | 2018-05-17 10:51:28 +0200 |
|---|---|---|
| committer | Ajax <commial@gmail.com> | 2018-05-17 10:51:28 +0200 |
| commit | 18ac4b21a484265ff50f400ad400a6f028038455 (patch) | |
| tree | 0a5f5ae8b99907e8123225193a17614b0066fc96 /miasm2/jitter/codegen.py | |
| parent | f01c7ffbc51c2b9a08b0d2a2efce26a23ef3268a (diff) | |
| download | miasm-18ac4b21a484265ff50f400ad400a6f028038455.tar.gz miasm-18ac4b21a484265ff50f400ad400a6f028038455.zip | |
Add support for 128 bits operations in VmMngr and GCC outputs
Diffstat (limited to 'miasm2/jitter/codegen.py')
| -rw-r--r-- | miasm2/jitter/codegen.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/miasm2/jitter/codegen.py b/miasm2/jitter/codegen.py index 2c546be8..b10a9257 100644 --- a/miasm2/jitter/codegen.py +++ b/miasm2/jitter/codegen.py @@ -10,9 +10,8 @@ from miasm2.core.asmblock import expr_is_label, AsmBlockBad, AsmLabel # Miasm to C translator TRANSLATOR = Translator.to_language("C") -SIZE_TO_MASK = {x: 2**x - 1 for x in (1, 2, 3, 7, 8, 16, 32, 64)} - -MASK_INT = 0xffffffffffffffff +SIZE_TO_MASK = {size: TRANSLATOR.from_expr(m2_expr.ExprInt(0, size).mask) + for size in (1, 2, 3, 7, 8, 16, 32, 64, 128)} class Attributes(object): @@ -246,9 +245,9 @@ class CGen(object): '%s = (%s);' % (self.id_to_c(new_dst), self.id_to_c(src))) else: c_main.append( - '%s = (%s)&0x%X;' % (self.id_to_c(new_dst), - self.id_to_c(src), - SIZE_TO_MASK[src.size])) + '%s = (%s)&%s;' % (self.id_to_c(new_dst), + self.id_to_c(src), + SIZE_TO_MASK[src.size])) elif isinstance(dst, m2_expr.ExprMem): ptr = dst.arg.replace_expr(prefetchers) new_dst = m2_expr.ExprMem(ptr, dst.size) |