about summary refs log tree commit diff stats
path: root/miasm2/core
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2017-03-30 16:24:26 +0200
committerGitHub <noreply@github.com>2017-03-30 16:24:26 +0200
commit7947f33a61118c35a6b24aaac29337e2739216b4 (patch)
tree6c281f7fc4efd326fb95151173b7847026a94f05 /miasm2/core
parentcedf19e7d73ca8d603f2e1ed7f5306db27678e65 (diff)
parente8916cf8cc44a0cc375af762b38798cb378b986c (diff)
downloadmiasm-7947f33a61118c35a6b24aaac29337e2739216b4.tar.gz
miasm-7947f33a61118c35a6b24aaac29337e2739216b4.zip
Merge pull request #509 from commial/fix/int-singleton
Fix/int singleton
Diffstat (limited to '')
-rw-r--r--miasm2/core/cpu.py10
-rw-r--r--miasm2/core/sembuilder.py11
2 files changed, 11 insertions, 10 deletions
diff --git a/miasm2/core/cpu.py b/miasm2/core/cpu.py
index 8b906027..3502397d 100644
--- a/miasm2/core/cpu.py
+++ b/miasm2/core/cpu.py
@@ -196,7 +196,7 @@ def ast_id2expr(a):
 
 
 def ast_int2expr(a):
-    return m2_expr.ExprInt32(a)
+    return m2_expr.ExprInt(a, 32)
 
 
 
@@ -1558,19 +1558,19 @@ class imm_noarg(object):
 
 
 class imm08_noarg(object):
-    int2expr = lambda self, x: m2_expr.ExprInt08(x)
+    int2expr = lambda self, x: m2_expr.ExprInt(x, 8)
 
 
 class imm16_noarg(object):
-    int2expr = lambda self, x: m2_expr.ExprInt16(x)
+    int2expr = lambda self, x: m2_expr.ExprInt(x, 16)
 
 
 class imm32_noarg(object):
-    int2expr = lambda self, x: m2_expr.ExprInt32(x)
+    int2expr = lambda self, x: m2_expr.ExprInt(x, 32)
 
 
 class imm64_noarg(object):
-    int2expr = lambda self, x: m2_expr.ExprInt64(x)
+    int2expr = lambda self, x: m2_expr.ExprInt(x, 64)
 
 
 class int32_noarg(imm_noarg):
diff --git a/miasm2/core/sembuilder.py b/miasm2/core/sembuilder.py
index f101d94c..138e4552 100644
--- a/miasm2/core/sembuilder.py
+++ b/miasm2/core/sembuilder.py
@@ -32,7 +32,7 @@ class MiasmTransformer(ast.NodeTransformer):
         node = self.generic_visit(node)
 
         if isinstance(node.func, ast.Name):
-            # iX(Y) -> ExprIntX(Y)
+            # iX(Y) -> ExprInt(Y, X)
             fc_name = node.func.id
 
             # Match the function name
@@ -41,10 +41,11 @@ class MiasmTransformer(ast.NodeTransformer):
 
             # Do replacement
             if integer is not None:
-                new_name = "ExprInt%s" % integer.groups()[0]
-
-            # Replace in the node
-            node.func.id = new_name
+                size = int(integer.groups()[0])
+                new_name = "ExprInt"
+                # Replace in the node
+                node.func.id = new_name
+                node.args.append(ast.Num(n=size))
 
         elif (isinstance(node.func, ast.Str) or
               (isinstance(node.func, ast.BinOp) and