diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-12-11 14:26:23 +0100 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2018-06-08 17:35:05 +0200 |
| commit | a2637cdf0b40df074865d23a7fd71f082ad7f40a (patch) | |
| tree | f6c958ca8481e6e29760078e5d1bdc2d2b64da53 /miasm2/arch/mips32/sem.py | |
| parent | dadfaabc3fff5edb9bf4ef7e7e8c4cfc4baccb94 (diff) | |
| download | miasm-a2637cdf0b40df074865d23a7fd71f082ad7f40a.tar.gz miasm-a2637cdf0b40df074865d23a7fd71f082ad7f40a.zip | |
Expr: Add new word ExprLoc
This word represents a location in the binary. Thus, the hack of ExprId containing an AsmLabel ends here.
Diffstat (limited to 'miasm2/arch/mips32/sem.py')
| -rw-r--r-- | miasm2/arch/mips32/sem.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/miasm2/arch/mips32/sem.py b/miasm2/arch/mips32/sem.py index 99c81a33..bb0f812d 100644 --- a/miasm2/arch/mips32/sem.py +++ b/miasm2/arch/mips32/sem.py @@ -35,7 +35,7 @@ def jal(arg1): "Jumps to the calculated address @arg1 and stores the return address in $RA" PC = arg1 ir.IRDst = arg1 - RA = ExprId(ir.get_next_break_label(instr), 32) + RA = ExprLoc(ir.get_next_break_label(instr).loc_key, RA.size) @sbuild.parse def jalr(arg1, arg2): @@ -43,13 +43,13 @@ def jalr(arg1, arg2): address in another register @arg2""" PC = arg1 ir.IRDst = arg1 - arg2 = ExprId(ir.get_next_break_label(instr), 32) + arg2 = ExprLoc(ir.get_next_break_label(instr).loc_key, arg2.size) @sbuild.parse def bal(arg1): PC = arg1 ir.IRDst = arg1 - RA = ExprId(ir.get_next_break_label(instr), 32) + RA = ExprLoc(ir.get_next_break_label(instr).loc_key, RA.size) @sbuild.parse def l_b(arg1): @@ -76,7 +76,7 @@ def lb(arg1, arg2): @sbuild.parse def beq(arg1, arg2, arg3): "Branches on @arg3 if the quantities of two registers @arg1, @arg2 are eq" - dst = ExprId(ir.get_next_break_label(instr), 32) if arg1 - arg2 else arg3 + dst = ExprLoc(ir.get_next_break_label(instr).loc_key, ir.IRDst.size) if arg1 - arg2 else arg3 PC = dst ir.IRDst = dst @@ -84,7 +84,7 @@ def beq(arg1, arg2, arg3): def bgez(arg1, arg2): """Branches on @arg2 if the quantities of register @arg1 is greater than or equal to zero""" - dst = ExprId(ir.get_next_break_label(instr), 32) if arg1.msb() else arg2 + dst = ExprLoc(ir.get_next_break_label(instr).loc_key, ir.IRDst.size) if arg1.msb() else arg2 PC = dst ir.IRDst = dst @@ -92,7 +92,7 @@ def bgez(arg1, arg2): def bne(arg1, arg2, arg3): """Branches on @arg3 if the quantities of two registers @arg1, @arg2 are NOT equal""" - dst = arg3 if arg1 - arg2 else ExprId(ir.get_next_break_label(instr), 32) + dst = arg3 if arg1 - arg2 else ExprLoc(ir.get_next_break_label(instr).loc_key, ir.IRDst.size) PC = dst ir.IRDst = dst @@ -230,7 +230,7 @@ def seh(arg1, arg2): @sbuild.parse def bltz(arg1, arg2): """Branches on @arg2 if the register @arg1 is less than zero""" - dst_o = arg2 if arg1.msb() else ExprId(ir.get_next_break_label(instr), 32) + dst_o = arg2 if arg1.msb() else ExprLoc(ir.get_next_break_label(instr).loc_key, ir.IRDst.size) PC = dst_o ir.IRDst = dst_o @@ -238,7 +238,7 @@ def bltz(arg1, arg2): def blez(arg1, arg2): """Branches on @arg2 if the register @arg1 is less than or equal to zero""" cond = (i1(1) if arg1 else i1(0)) | arg1.msb() - dst_o = arg2 if cond else ExprId(ir.get_next_break_label(instr), 32) + dst_o = arg2 if cond else ExprLoc(ir.get_next_break_label(instr).loc_key, ir.IRDst.size) PC = dst_o ir.IRDst = dst_o @@ -246,7 +246,7 @@ def blez(arg1, arg2): def bgtz(arg1, arg2): """Branches on @arg2 if the register @arg1 is greater than zero""" cond = (i1(1) if arg1 else i1(0)) | arg1.msb() - dst_o = ExprId(ir.get_next_break_label(instr), 32) if cond else arg2 + dst_o = ExprLoc(ir.get_next_break_label(instr).loc_key, ir.IRDst.size) if cond else arg2 PC = dst_o ir.IRDst = dst_o @@ -346,13 +346,13 @@ def c_le_d(arg1, arg2, arg3): @sbuild.parse def bc1t(arg1, arg2): - dst_o = arg2 if arg1 else ExprId(ir.get_next_break_label(instr), 32) + dst_o = arg2 if arg1 else ExprLoc(ir.get_next_break_label(instr).loc_key, ir.IRDst.size) PC = dst_o ir.IRDst = dst_o @sbuild.parse def bc1f(arg1, arg2): - dst_o = ExprId(ir.get_next_break_label(instr), 32) if arg1 else arg2 + dst_o = ExprLoc(ir.get_next_break_label(instr).loc_key, ir.IRDst.size) if arg1 else arg2 PC = dst_o ir.IRDst = dst_o @@ -423,7 +423,7 @@ def teq(ir, instr, arg1, arg2): do_except.append(m2_expr.ExprAff(exception_flags, m2_expr.ExprInt( EXCEPT_DIV_BY_ZERO, exception_flags.size))) do_except.append(m2_expr.ExprAff(ir.IRDst, lbl_next_expr)) - blk_except = IRBlock(lbl_except, [AssignBlock(do_except, instr)]) + blk_except = IRBlock(lbl_except.index, [AssignBlock(do_except, instr)]) cond = arg1 - arg2 |