about summary refs log tree commit diff stats
path: root/miasm2/arch
diff options
context:
space:
mode:
authorFabrice Desclaux <fabrice.desclaux@cea.fr>2017-02-08 10:20:03 +0100
committerFabrice Desclaux <fabrice.desclaux@cea.fr>2017-02-12 18:03:12 +0100
commit527dc222b107e39e2da8d2d4b053db397df08fae (patch)
tree1a565c192712c8b944944329698dee4939ee333e /miasm2/arch
parentca275b0c0a4cdbfe0033758b61f9f1484f67e884 (diff)
downloadmiasm-527dc222b107e39e2da8d2d4b053db397df08fae.tar.gz
miasm-527dc222b107e39e2da8d2d4b053db397df08fae.zip
Expression: REPLACE IS_OP_SEGM
/!\ API MODIFICATION: is_op_segm becomes is_mem_segm

is_op_segm: Returns True if is ExprOp and op == 'segm'
is_mem_segm: Returns True if is ExprMem and ptr is_op_segm
Diffstat (limited to 'miasm2/arch')
-rw-r--r--miasm2/arch/x86/arch.py6
-rw-r--r--miasm2/arch/x86/sem.py6
2 files changed, 6 insertions, 6 deletions
diff --git a/miasm2/arch/x86/arch.py b/miasm2/arch/x86/arch.py
index edbe9874..20fdc1cf 100644
--- a/miasm2/arch/x86/arch.py
+++ b/miasm2/arch/x86/arch.py
@@ -596,7 +596,7 @@ class instruction_x86(instruction):
                 prefix = ""
             sz = SIZE2MEMPREFIX[expr.size]
             segm = ""
-            if expr.is_op_segm():
+            if expr.is_mem_segm():
                 segm = "%s:" % expr.arg.args[0]
                 expr = expr.arg.args[1]
             else:
@@ -1720,10 +1720,10 @@ SIZE2XMMREG = {64:gpregs_mm,
 def parse_mem(expr, parent, w8, sx=0, xmm=0, mm=0):
     dct_expr = {}
     opmode = parent.v_opmode()
-    if expr.is_op_segm() and isinstance(expr.arg.args[0], ExprInt):
+    if expr.is_mem_segm() and expr.arg.args[0].is_int():
         return None, None, False
 
-    if expr.is_op_segm():
+    if expr.is_mem_segm():
         segm = expr.arg.args[0]
         ptr = expr.arg.args[1]
     else:
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py
index f9673ff5..14ecbbe6 100644
--- a/miasm2/arch/x86/sem.py
+++ b/miasm2/arch/x86/sem.py
@@ -329,7 +329,7 @@ def movsx(ir, instr, dst, src):
 
 def lea(ir, instr, dst, src):
     ptr = src.arg
-    if src.is_op_segm():
+    if src.is_mem_segm():
         # Do not use segmentation here
         ptr = ptr.args[1]
 
@@ -2901,7 +2901,7 @@ def bittest_get(ir, instr, src, index):
         b_mask = {16: 4, 32: 5, 64: 6}
         b_decal = {16: 1, 32: 3, 64: 7}
         ptr = src.arg
-        segm = src.is_op_segm()
+        segm = src.is_mem_segm()
         if segm:
             ptr = ptr.args[1]
 
@@ -4457,7 +4457,7 @@ class ir_x86_16(ir):
                 instr.additional_info.g2.value]
         if my_ss is not None:
             for i, a in enumerate(args):
-                if isinstance(a, m2_expr.ExprMem) and not a.is_op_segm():
+                if a.is_mem() and not a.is_mem_segm():
                     args[i] = m2_expr.ExprMem(expraddr(instr.mode, m2_expr.ExprOp('segm', my_ss,
                                                                                   a.arg)), a.size)