diff options
| author | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-04-14 13:32:59 +0200 |
|---|---|---|
| committer | Fabrice Desclaux <fabrice.desclaux@cea.fr> | 2017-04-20 12:31:33 +0200 |
| commit | 16fc339e53bfc908dbcd73fc912d7d75aed7218c (patch) | |
| tree | f13faa66157ddd4c12dff191d314d81e5f2bf33f /miasm2/arch/x86 | |
| parent | ff981a11ef71960a239ec44295f06bb384124521 (diff) | |
| download | miasm-16fc339e53bfc908dbcd73fc912d7d75aed7218c.tar.gz miasm-16fc339e53bfc908dbcd73fc912d7d75aed7218c.zip | |
Ir: make AssignBlock immutable
Diffstat (limited to 'miasm2/arch/x86')
| -rw-r--r-- | miasm2/arch/x86/sem.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/miasm2/arch/x86/sem.py b/miasm2/arch/x86/sem.py index 98866e65..b0cdc280 100644 --- a/miasm2/arch/x86/sem.py +++ b/miasm2/arch/x86/sem.py @@ -21,7 +21,7 @@ from miasm2.expression.simplifications import expr_simp from miasm2.arch.x86.regs import * from miasm2.arch.x86.arch import mn_x86, repeat_mn, replace_regs from miasm2.expression.expression_helper import expr_cmps, expr_cmpu -from miasm2.ir.ir import IntermediateRepresentation, IRBlock +from miasm2.ir.ir import IntermediateRepresentation, IRBlock, AssignBlock from miasm2.core.sembuilder import SemBuilder import math import struct @@ -4602,9 +4602,10 @@ class ir_x86_16(IntermediateRepresentation): return m2_expr.ExprAff(dst, src) def irbloc_fix_regs_for_mode(self, irbloc, mode=64): - for assignblk in irbloc.irs: - for dst, src in assignblk.items(): - del assignblk[dst] + for idx, assignblk in enumerate(irbloc.irs): + new_assignblk = dict(assignblk) + for dst, src in assignblk.iteritems(): + del new_assignblk[dst] # Special case for 64 bits: # If destination is a 32 bit reg, zero extend the 64 bit reg if mode == 64: @@ -4615,7 +4616,8 @@ class ir_x86_16(IntermediateRepresentation): dst = replace_regs[64][dst].arg dst = self.expr_fix_regs_for_mode(dst, mode) src = self.expr_fix_regs_for_mode(src, mode) - assignblk[dst] = src + new_assignblk[dst] = src + irbloc.irs[idx] = AssignBlock(new_assignblk) if irbloc.dst is not None: irbloc.dst = self.expr_fix_regs_for_mode(irbloc.dst, mode) |