diff options
| author | serpilliere <serpilliere@users.noreply.github.com> | 2018-05-17 12:31:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-05-17 12:31:35 +0200 |
| commit | f6a9db54b4f385d680abfe91b33c7c5f577118cb (patch) | |
| tree | 37ec6ee8f5c153aa34f7476d76053578eb50a69d /miasm2/jitter/codegen.py | |
| parent | cb1e73d65b99b5e6f73bd7823b6142e99ef9994a (diff) | |
| parent | 23cee4aeb4d667b6ff93b279a8619acf56a70bc3 (diff) | |
| download | miasm-f6a9db54b4f385d680abfe91b33c7c5f577118cb.tar.gz miasm-f6a9db54b4f385d680abfe91b33c7c5f577118cb.zip | |
Merge pull request #746 from commial/feature/XMM-regs
Feature/xmm regs
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) |