about summary refs log tree commit diff stats
path: root/miasm2/arch
diff options
context:
space:
mode:
Diffstat (limited to 'miasm2/arch')
-rw-r--r--miasm2/arch/aarch64/arch.py6
-rw-r--r--miasm2/arch/arm/arch.py8
-rw-r--r--miasm2/arch/arm/disasm.py2
-rw-r--r--miasm2/arch/arm/sem.py12
-rw-r--r--miasm2/arch/mips32/arch.py8
-rw-r--r--miasm2/arch/mips32/ira.py2
-rw-r--r--miasm2/arch/mips32/jit.py2
-rw-r--r--miasm2/arch/mips32/sem.py4
-rw-r--r--miasm2/arch/msp430/arch.py6
-rw-r--r--miasm2/arch/ppc/arch.py4
-rw-r--r--miasm2/arch/ppc/sem.py8
-rw-r--r--miasm2/arch/sh4/arch.py10
-rw-r--r--miasm2/arch/x86/arch.py8
13 files changed, 40 insertions, 40 deletions
diff --git a/miasm2/arch/aarch64/arch.py b/miasm2/arch/aarch64/arch.py
index 79b76743..529621c4 100644
--- a/miasm2/arch/aarch64/arch.py
+++ b/miasm2/arch/aarch64/arch.py
@@ -276,7 +276,7 @@ class aarch64_arg(m_arg):
             if isinstance(value.name, ExprId):
                 fixed_size.add(value.name.size)
                 return value.name
-            loc_key = loc_db.getby_name_create(value.name)
+            loc_key = loc_db.get_or_create_name_location(value.name)
             return ExprLoc(loc_key, size_hint)
         if isinstance(value, AstInt):
             assert size_hint is not None
@@ -316,7 +316,7 @@ class instruction_aarch64(instruction):
             return str(expr)
         elif expr.is_loc():
             if loc_db is not None:
-                return loc_db.str_loc_key(expr.loc_key)
+                return loc_db.pretty_str(expr.loc_key)
             else:
                 return str(expr)
         elif isinstance(expr, m2_expr.ExprOp) and expr.op in shift_expr:
@@ -374,7 +374,7 @@ class instruction_aarch64(instruction):
         if not expr.is_int():
             return
         addr = expr.arg + self.offset
-        loc_key = loc_db.getby_offset_create(addr)
+        loc_key = loc_db.get_or_create_offset_location(addr)
         self.args[index] = m2_expr.ExprLoc(loc_key, expr.size)
 
     def breakflow(self):
diff --git a/miasm2/arch/arm/arch.py b/miasm2/arch/arm/arch.py
index 498de94c..1810cd6a 100644
--- a/miasm2/arch/arm/arch.py
+++ b/miasm2/arch/arm/arch.py
@@ -349,7 +349,7 @@ class instruction_arm(instruction):
             return str(expr)
         elif expr.is_loc():
             if loc_db is not None:
-                return loc_db.str_loc_key(expr.loc_key)
+                return loc_db.pretty_str(expr.loc_key)
             else:
                 return str(expr)
         if isinstance(expr, ExprOp) and expr.op in expr2shift_dct:
@@ -430,7 +430,7 @@ class instruction_arm(instruction):
             addr = expr.arg + self.offset
         else:
             addr = expr.arg + self.offset
-        loc_key = loc_db.getby_offset_create(addr)
+        loc_key = loc_db.get_or_create_offset_location(addr)
         self.args[0] = ExprLoc(loc_key, expr.size)
 
     def breakflow(self):
@@ -512,7 +512,7 @@ class instruction_armt(instruction_arm):
         else:
             addr = expr.arg + self.offset
 
-        loc_key = loc_db.getby_offset_create(addr)
+        loc_key = loc_db.get_or_create_offset_location(addr)
         dst = ExprLoc(loc_key, expr.size)
 
         if self.name in ["CBZ", "CBNZ"]:
@@ -780,7 +780,7 @@ class arm_arg(m_arg):
                 return arg.name
             if arg.name in gpregs.str:
                 return None
-            loc_key = loc_db.getby_name_create(arg.name)
+            loc_key = loc_db.get_or_create_name_location(arg.name)
             return ExprLoc(loc_key, 32)
         if isinstance(arg, AstOp):
             args = [self.asm_ast_to_expr(tmp, loc_db) for tmp in arg.args]
diff --git a/miasm2/arch/arm/disasm.py b/miasm2/arch/arm/disasm.py
index 41034211..5e21778d 100644
--- a/miasm2/arch/arm/disasm.py
+++ b/miasm2/arch/arm/disasm.py
@@ -24,7 +24,7 @@ def cb_arm_fix_call(mn, cur_bloc, loc_db, offsets_to_dis, *args, **kwargs):
         return
     if not l2.args[1] in values:
         return
-    loc_key_cst = loc_db.getby_offset_create(l1.offset + 4)
+    loc_key_cst = loc_db.get_or_create_offset_location(l1.offset + 4)
     cur_bloc.add_cst(loc_key_cst, AsmConstraint.c_next)
     offsets_to_dis.add(l1.offset + 4)
 
diff --git a/miasm2/arch/arm/sem.py b/miasm2/arch/arm/sem.py
index 6e311f8e..a3d12514 100644
--- a/miasm2/arch/arm/sem.py
+++ b/miasm2/arch/arm/sem.py
@@ -441,8 +441,8 @@ def sdiv(ir, instr, a, b, c=None):
     if c is None:
         b, c = a, b
 
-    loc_div = ExprLoc(ir.loc_db.gen_loc_key(), ir.IRDst.size)
-    loc_except = ExprId(ir.loc_db.gen_loc_key(), ir.IRDst.size)
+    loc_div = ExprLoc(ir.loc_db.add_location(), ir.IRDst.size)
+    loc_except = ExprId(ir.loc_db.add_location(), ir.IRDst.size)
     loc_next = ExprLoc(ir.get_next_loc_key(instr), ir.IRDst.size)
 
     e.append(ExprAff(ir.IRDst, ExprCond(c, loc_div, loc_except)))
@@ -474,8 +474,8 @@ def udiv(ir, instr, a, b, c=None):
 
 
 
-    loc_div = ExprLoc(ir.loc_db.gen_loc_key(), ir.IRDst.size)
-    loc_except = ExprLoc(ir.loc_db.gen_loc_key(), ir.IRDst.size)
+    loc_div = ExprLoc(ir.loc_db.add_location(), ir.IRDst.size)
+    loc_except = ExprLoc(ir.loc_db.add_location(), ir.IRDst.size)
     loc_next = ExprLoc(ir.get_next_loc_key(instr), ir.IRDst.size)
 
     e.append(ExprAff(ir.IRDst, ExprCond(c, loc_div, loc_except)))
@@ -1266,7 +1266,7 @@ def add_condition_expr(ir, instr, cond, instr_ir, extra_ir):
 
     loc_next = ir.get_next_loc_key(instr)
     loc_next_expr = ExprLoc(loc_next, 32)
-    loc_do = ir.loc_db.gen_loc_key()
+    loc_do = ir.loc_db.add_location()
     loc_do_expr = ExprLoc(loc_do, 32)
 
     dst_cond = ExprCond(cond, loc_do_expr, loc_next_expr)
@@ -1556,7 +1556,7 @@ class ir_arml(IntermediateRepresentation):
             instr = block.lines[index]
 
             # Add conditionnal jump to current irblock
-            loc_do = self.loc_db.gen_loc_key()
+            loc_do = self.loc_db.add_location()
             loc_next = self.get_next_loc_key(instr)
 
             if hint:
diff --git a/miasm2/arch/mips32/arch.py b/miasm2/arch/mips32/arch.py
index a47c606b..974644dc 100644
--- a/miasm2/arch/mips32/arch.py
+++ b/miasm2/arch/mips32/arch.py
@@ -65,7 +65,7 @@ class instruction_mips32(cpu.instruction):
             return str(expr)
         elif expr.is_loc():
             if loc_db is not None:
-                return loc_db.str_loc_key(expr.loc_key)
+                return loc_db.pretty_str(expr.loc_key)
             else:
                 return str(expr)
         assert(isinstance(expr, ExprMem))
@@ -97,7 +97,7 @@ class instruction_mips32(cpu.instruction):
         if self.name in ["J", 'JAL']:
             expr = self.args[0].arg
             addr = (self.offset & (0xFFFFFFFF ^ ((1<< 28)-1))) + expr
-            loc_key = loc_db.getby_offset_create(addr)
+            loc_key = loc_db.get_or_create_offset_location(addr)
             self.args[0] = ExprLoc(loc_key, expr.size)
             return
 
@@ -107,7 +107,7 @@ class instruction_mips32(cpu.instruction):
         if not isinstance(expr, ExprInt):
             return
         addr = expr.arg + self.offset
-        loc_key = loc_db.getby_offset_create(addr)
+        loc_key = loc_db.get_or_create_offset_location(addr)
         self.args[ndx] = ExprLoc(loc_key, expr.size)
 
     def breakflow(self):
@@ -265,7 +265,7 @@ class mips32_arg(cpu.m_arg):
                 return arg.name
             if arg.name in gpregs.str:
                 return None
-            loc_key = loc_db.getby_name_create(arg.name)
+            loc_key = loc_db.get_or_create_name_location(arg.name)
             return ExprLoc(loc_key, 32)
         if isinstance(arg, AstOp):
             args = [self.asm_ast_to_expr(tmp, loc_db) for tmp in arg.args]
diff --git a/miasm2/arch/mips32/ira.py b/miasm2/arch/mips32/ira.py
index 791e67bf..53c2c6b3 100644
--- a/miasm2/arch/mips32/ira.py
+++ b/miasm2/arch/mips32/ira.py
@@ -28,7 +28,7 @@ class ir_a_mips32l(ir_mips32l, ira):
                 new_irblocks.append(irb)
                 continue
             if lr_val.is_loc():
-                offset = self.loc_db.loc_key_to_offset(lr_val.loc_key)
+                offset = self.loc_db.get_location_offset(lr_val.loc_key)
                 if offset is not None:
                     lr_val = ExprInt(offset, 32)
             if not lr_val.is_int():
diff --git a/miasm2/arch/mips32/jit.py b/miasm2/arch/mips32/jit.py
index 0c4eb85b..a0df64d6 100644
--- a/miasm2/arch/mips32/jit.py
+++ b/miasm2/arch/mips32/jit.py
@@ -70,7 +70,7 @@ class mipsCGen(CGen):
         """
 
         loc_key = self.get_block_post_label(block)
-        offset = self.ir_arch.loc_db.loc_key_to_offset(loc_key)
+        offset = self.ir_arch.loc_db.get_location_offset(loc_key)
         out = (self.CODE_RETURN_NO_EXCEPTION % (loc_key,
                                                 self.C_PC,
                                                 m2_expr.ExprId('branch_dst_irdst', 32),
diff --git a/miasm2/arch/mips32/sem.py b/miasm2/arch/mips32/sem.py
index df13cd2c..acf7370f 100644
--- a/miasm2/arch/mips32/sem.py
+++ b/miasm2/arch/mips32/sem.py
@@ -490,10 +490,10 @@ class ir_mips32l(IntermediateRepresentation):
         return instr_ir, new_extra_ir
 
     def get_next_instr(self, instr):
-        return self.loc_db.getby_offset_create(instr.offset  + 4)
+        return self.loc_db.get_or_create_offset_location(instr.offset  + 4)
 
     def get_next_break_loc_key(self, instr):
-        return self.loc_db.getby_offset_create(instr.offset  + 8)
+        return self.loc_db.get_or_create_offset_location(instr.offset  + 8)
 
 class ir_mips32b(ir_mips32l):
     def __init__(self, loc_db=None):
diff --git a/miasm2/arch/msp430/arch.py b/miasm2/arch/msp430/arch.py
index 7c739561..ecf4cb13 100644
--- a/miasm2/arch/msp430/arch.py
+++ b/miasm2/arch/msp430/arch.py
@@ -69,7 +69,7 @@ class msp430_arg(m_arg):
                 index = gpregs.str.index(name)
                 reg = gpregs.expr[index]
                 return reg
-            loc_key = loc_db.getby_name_create(value.name)
+            loc_key = loc_db.get_or_create_name_location(value.name)
             return ExprLoc(loc_key, 16)
         if isinstance(value, AstOp):
             args = [self.asm_ast_to_expr(tmp, loc_db) for tmp in value.args]
@@ -109,7 +109,7 @@ class instruction_msp430(instruction):
             o = str(expr)
         elif expr.is_loc():
             if loc_db is not None:
-                return loc_db.str_loc_key(expr.loc_key)
+                return loc_db.pretty_str(expr.loc_key)
             else:
                 return str(expr)
         elif isinstance(expr, ExprOp) and expr.op == "autoinc":
@@ -138,7 +138,7 @@ class instruction_msp430(instruction):
         else:
             addr = expr.arg + int(self.offset)
 
-        loc_key = loc_db.getby_offset_create(addr)
+        loc_key = loc_db.get_or_create_offset_location(addr)
         self.args[0] = ExprLoc(loc_key, expr.size)
 
     def breakflow(self):
diff --git a/miasm2/arch/ppc/arch.py b/miasm2/arch/ppc/arch.py
index 94b2b903..c100cde3 100644
--- a/miasm2/arch/ppc/arch.py
+++ b/miasm2/arch/ppc/arch.py
@@ -40,7 +40,7 @@ class ppc_arg(m_arg):
                 return arg.name
             if arg.name in gpregs.str:
                 return None
-            loc_key = loc_db.getby_name_create(arg.name)
+            loc_key = loc_db.get_or_create_name_location(arg.name)
             return ExprLoc(loc_key, 32)
         if isinstance(arg, AstOp):
             args = [self.asm_ast_to_expr(tmp, loc_db) for tmp in arg.args]
@@ -131,7 +131,7 @@ class instruction_ppc(instruction):
                 ad = e.arg + self.offset
             else:
                 ad = e.arg
-            loc_key = loc_db.getby_offset_create(ad)
+            loc_key = loc_db.get_or_create_offset_location(ad)
             s = ExprLoc(loc_key, e.size)
             self.args[address_index] = s
 
diff --git a/miasm2/arch/ppc/sem.py b/miasm2/arch/ppc/sem.py
index 77e4973a..678ab041 100644
--- a/miasm2/arch/ppc/sem.py
+++ b/miasm2/arch/ppc/sem.py
@@ -606,8 +606,8 @@ def mn_do_store(ir, instr, arg1, arg2, arg3=None):
             ret.append(ExprAff(arg2, address))
 
     if is_stwcx:
-        loc_do = ExprLoc(ir.loc_db.gen_loc_key(), ir.IRDst.size)
-        loc_dont = ExprLoc(ir.loc_db.gen_loc_key(), ir.IRDst.size)
+        loc_do = ExprLoc(ir.loc_db.add_location(), ir.IRDst.size)
+        loc_dont = ExprLoc(ir.loc_db.add_location(), ir.IRDst.size)
         loc_next = ExprLoc(ir.get_next_loc_key(instr), ir.IRDst.size)
         flags = [ ExprAff(CR0_LT, ExprInt(0,1)),
                   ExprAff(CR0_GT, ExprInt(0,1)),
@@ -916,9 +916,9 @@ class ir_ppc32b(IntermediateRepresentation):
         return instr_ir, extra_ir
 
     def get_next_instr(self, instr):
-        l = self.loc_db.getby_offset_create(instr.offset  + 4)
+        l = self.loc_db.get_or_create_offset_location(instr.offset  + 4)
         return l
 
     def get_next_break_loc_key(self, instr):
-        l = self.loc_db.getby_offset_create(instr.offset  + 4)
+        l = self.loc_db.get_or_create_offset_location(instr.offset  + 4)
         return l
diff --git a/miasm2/arch/sh4/arch.py b/miasm2/arch/sh4/arch.py
index 46e316f8..d5e9820e 100644
--- a/miasm2/arch/sh4/arch.py
+++ b/miasm2/arch/sh4/arch.py
@@ -102,7 +102,7 @@ class sh4_arg(m_arg):
                 return arg.name
             if arg.name in gpregs.str:
                 return None
-            loc_key = loc_db.getby_name_create(arg.name)
+            loc_key = loc_db.get_or_create_name_location(arg.name)
             return ExprLoc(loc_key, 32)
         if isinstance(arg, AstOp):
             args = [self.asm_ast_to_expr(tmp, loc_db) for tmp in arg.args]
@@ -411,7 +411,7 @@ class instruction_sh4(instruction):
             return str(expr)
         elif expr.is_loc():
             if loc_db is not None:
-                return loc_db.str_loc_key(expr.loc_key)
+                return loc_db.pretty_str(expr.loc_key)
             else:
                 return str(expr)
         assert(isinstance(expr, ExprMem))
@@ -443,7 +443,7 @@ class instruction_sh4(instruction):
             ad = e.arg+8+self.offset
         else:
             ad = e.arg+8+self.offset
-        l = loc_db.getby_offset_create(ad)
+        l = loc_db.get_or_create_offset_location(ad)
         s = ExprId(l, e.size)
         self.args[0] = s
     """
@@ -826,7 +826,7 @@ addop("bf", [bs('10001011'), s08imm])
     def dstflow2label(self, loc_db):
         e = self.args[0].expr
         ad = e.arg*2+4+self.offset
-        l = loc_db.getby_offset_create(ad)
+        l = loc_db.get_or_create_offset_location(ad)
         s = ExprId(l, e.size)
         self.args[0].expr = s
 """
@@ -849,7 +849,7 @@ addop("bra", [bs('1010'), s12imm])
     def dstflow2label(self, loc_db):
         e = self.args[0].expr
         ad = e.arg*2+4+self.offset
-        l = loc_db.getby_offset_create(ad)
+        l = loc_db.get_or_create_offset_location(ad)
         s = ExprId(l, e.size)
         self.args[0].expr = s
 """
diff --git a/miasm2/arch/x86/arch.py b/miasm2/arch/x86/arch.py
index 3a537c01..815eaee6 100644
--- a/miasm2/arch/x86/arch.py
+++ b/miasm2/arch/x86/arch.py
@@ -272,7 +272,7 @@ class x86_arg(m_arg):
             if value.name in ["FAR"]:
                 return None
 
-            loc_key = loc_db.getby_name_create(value.name)
+            loc_key = loc_db.get_or_create_name_location(value.name)
             return ExprLoc(loc_key, size_hint)
         if isinstance(value, AstOp):
             # First pass to retreive fixed_size
@@ -476,7 +476,7 @@ class instruction_x86(instruction):
         if not expr.is_int():
             return
         addr = expr.arg + int(self.offset)
-        loc_key = loc_db.getby_offset_create(addr)
+        loc_key = loc_db.get_or_create_offset_location(addr)
         self.args[0] = ExprLoc(loc_key, expr.size)
 
     def breakflow(self):
@@ -514,7 +514,7 @@ class instruction_x86(instruction):
     def getdstflow(self, loc_db):
         if self.additional_info.g1.value & 6 and self.name in repeat_mn:
             addr = int(self.offset)
-            loc_key = loc_db.getby_offset_create(addr)
+            loc_key = loc_db.get_or_create_offset_location(addr)
             return [ExprLoc(loc_key, self.v_opmode())]
         return [self.args[0]]
 
@@ -564,7 +564,7 @@ class instruction_x86(instruction):
             o = str(expr)
         elif expr.is_loc():
             if loc_db is not None:
-                o = loc_db.str_loc_key(expr.loc_key)
+                o = loc_db.pretty_str(expr.loc_key)
             else:
                 o = str(expr)
         elif ((isinstance(expr, ExprOp) and expr.op == 'far' and