diff options
Diffstat (limited to 'miasm2/arch/ppc')
| -rw-r--r-- | miasm2/arch/ppc/arch.py | 9 | ||||
| -rw-r--r-- | miasm2/arch/ppc/sem.py | 24 |
2 files changed, 16 insertions, 17 deletions
diff --git a/miasm2/arch/ppc/arch.py b/miasm2/arch/ppc/arch.py index 429fd22d..5336ea21 100644 --- a/miasm2/arch/ppc/arch.py +++ b/miasm2/arch/ppc/arch.py @@ -5,7 +5,6 @@ from miasm2.expression.expression import * from miasm2.core.cpu import * from collections import defaultdict from miasm2.core.bin_stream import bin_stream -from miasm2.core.asmblock import asm_label import miasm2.arch.ppc.regs as regs_module from miasm2.arch.ppc.regs import * from miasm2.core.asm_ast import AstInt, AstId, AstMem, AstOp @@ -41,8 +40,8 @@ class ppc_arg(m_arg): return arg.name if arg.name in gpregs.str: return None - label = symbol_pool.getby_name_create(arg.name) - return ExprLoc(label.loc_key, 32) + loc_key = symbol_pool.getby_name_create(arg.name) + return ExprLoc(loc_key, 32) if isinstance(arg, AstOp): args = [self.asm_ast_to_expr(tmp, symbol_pool) for tmp in arg.args] if None in args: @@ -132,8 +131,8 @@ class instruction_ppc(instruction): ad = e.arg + self.offset else: ad = e.arg - label = symbol_pool.getby_offset_create(ad) - s = ExprLoc(label.loc_key, e.size) + loc_key = symbol_pool.getby_offset_create(ad) + s = ExprLoc(loc_key, e.size) self.args[address_index] = s def breakflow(self): diff --git a/miasm2/arch/ppc/sem.py b/miasm2/arch/ppc/sem.py index 775e24d3..8ddb43ef 100644 --- a/miasm2/arch/ppc/sem.py +++ b/miasm2/arch/ppc/sem.py @@ -606,21 +606,21 @@ def mn_do_store(ir, instr, arg1, arg2, arg3=None): ret.append(ExprAff(arg2, address)) if is_stwcx: - lbl_do = ExprId(ir.gen_label(), ir.IRDst.size) - lbl_dont = ExprId(ir.gen_label(), ir.IRDst.size) - lbl_next = ExprId(ir.get_next_label(instr), ir.IRDst.size) + loc_do = ExprLoc(ir.symbol_pool.gen_loc_key(), ir.IRDst.size) + loc_dont = ExprLoc(ir.symbol_pool.gen_loc_key(), 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)), ExprAff(CR0_SO, XER_SO)] ret += flags ret.append(ExprAff(CR0_EQ, ExprInt(1,1))) - ret.append(ExprAff(ir.IRDst, lbl_next)) + ret.append(ExprAff(ir.IRDst, loc_next)) dont = flags + [ ExprAff(CR0_EQ, ExprInt(0,1)), - ExprAff(ir.IRDst, lbl_next) ] - additional_ir = [ IRBlock(lbl_do.name, [ AssignBlock(ret) ]), - IRBlock(lbl_dont.name, [ AssignBlock(dont) ]) ] + ExprAff(ir.IRDst, loc_next) ] + additional_ir = [ IRBlock(loc_do, [ AssignBlock(ret) ]), + IRBlock(loc_dont, [ AssignBlock(dont) ]) ] ret = [ ExprAff(reserve, ExprInt(0, 1)), - ExprAff(ir.IRDst, ExprCond(reserve, lbl_do, lbl_dont)) ] + ExprAff(ir.IRDst, ExprCond(reserve, loc_do, loc_dont)) ] return ret, additional_ir @@ -691,7 +691,7 @@ def mn_bl(ir, instr, arg1, arg2 = None): if arg2 is not None: arg1 = arg2 dst = ir.get_next_instr(instr) - return [ ExprAff(LR, ExprLoc(dst.loc_key, 32)), + return [ ExprAff(LR, ExprLoc(dst, 32)), ExprAff(PC, arg1), ExprAff(ir.IRDst, arg1) ], [] @@ -729,13 +729,13 @@ def mn_do_cond_branch(ir, instr, dest): condition = cond_cond dst = ir.get_next_instr(instr) dest_expr = ExprCond(condition, dest, - ExprLoc(dst.loc_key, 32)) + ExprLoc(dst, 32)) else: dest_expr = dest if instr.name[-1] == 'L' or instr.name[-2:-1] == 'LA': dst = ir.get_next_instr(instr) - ret.append(ExprAff(LR, ExprLoc(dst.loc_key, 32))) + ret.append(ExprAff(LR, ExprLoc(dst, 32))) ret.append(ExprAff(PC, dest_expr)) ret.append(ExprAff(ir.IRDst, dest_expr)) @@ -919,6 +919,6 @@ class ir_ppc32b(IntermediateRepresentation): l = self.symbol_pool.getby_offset_create(instr.offset + 4) return l - def get_next_break_label(self, instr): + def get_next_break_loc_key(self, instr): l = self.symbol_pool.getby_offset_create(instr.offset + 4) return l |