diff options
| author | Camille Mougey <commial@gmail.com> | 2018-07-18 19:03:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-18 19:03:47 +0200 |
| commit | b531a52db0a966f0882e386e164a349ae581f956 (patch) | |
| tree | beac929c4c085dee0a484f50f9a0fdf92ea3d75b /miasm2/ir/analysis.py | |
| parent | e789c705c064d8c1526fa76d85f174003dfaa9ab (diff) | |
| parent | 7c519fe7b3088adffd15d6bbbbd34f53f69cb862 (diff) | |
| download | miasm-b531a52db0a966f0882e386e164a349ae581f956.tar.gz miasm-b531a52db0a966f0882e386e164a349ae581f956.zip | |
Merge pull request #805 from serpilliere/fix_call_effects_arm
Fix call effects arm
Diffstat (limited to '')
| -rw-r--r-- | miasm2/ir/analysis.py | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/miasm2/ir/analysis.py b/miasm2/ir/analysis.py index 962b9889..d49f6b4e 100644 --- a/miasm2/ir/analysis.py +++ b/miasm2/ir/analysis.py @@ -4,7 +4,7 @@ import warnings import logging from miasm2.ir.ir import IntermediateRepresentation, AssignBlock -from miasm2.expression.expression import ExprOp +from miasm2.expression.expression import ExprOp, ExprAff from miasm2.analysis.data_flow import dead_simp as new_dead_simp_imp @@ -35,15 +35,22 @@ class ira(IntermediateRepresentation): * insert dependencies to arguments (stack base, registers, ...) * add some side effects (stack clean, return value, ...) + Return a couple: + * list of assignments to add to the current irblock + * list of additional irblocks + @addr: (Expr) address of the called function @instr: native instruction which is responsible of the call """ - assignblk = AssignBlock({ - self.ret_reg: ExprOp('call_func_ret', addr, self.sp), - self.sp: ExprOp('call_func_stack', addr, self.sp)}, - instr) - return [assignblk] + call_assignblk = AssignBlock( + [ + ExprAff(self.ret_reg, ExprOp('call_func_ret', addr, self.sp)), + ExprAff(self.sp, ExprOp('call_func_stack', addr, self.sp)) + ], + instr + ) + return [call_assignblk], [] def add_instr_to_current_state(self, instr, block, assignments, ir_blocks_all, gen_pc_updt): """ @@ -62,8 +69,12 @@ class ira(IntermediateRepresentation): @gen_pc_updt: insert PC update effects between instructions """ if instr.is_subcall(): - call_effects = self.call_effects(instr.args[0], instr) - assignments+= call_effects + call_assignblks, extra_irblocks = self.call_effects( + instr.args[0], + instr + ) + assignments += call_assignblks + ir_blocks_all += extra_irblocks return True if gen_pc_updt is not False: |