about summary refs log tree commit diff stats
path: root/src/miasm/arch/msp430/lifter_model_call.py
diff options
context:
space:
mode:
authorTheofilos Augoustis <theofilos.augoustis@gmail.com>2025-10-14 09:09:29 +0000
committerTheofilos Augoustis <theofilos.augoustis@gmail.com>2025-10-14 09:09:29 +0000
commit579cf1d03fb932083e6317967d1613d5c2587fb6 (patch)
tree629f039935382a2a7391bce9253f6c9968159049 /src/miasm/arch/msp430/lifter_model_call.py
parent51c15d3ea2e16d4fc5f0f01a3b9befc66b1f982e (diff)
downloadfocaccia-miasm-ta/nix.tar.gz
focaccia-miasm-ta/nix.zip
Convert to src-layout ta/nix
Diffstat (limited to 'src/miasm/arch/msp430/lifter_model_call.py')
-rw-r--r--src/miasm/arch/msp430/lifter_model_call.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/miasm/arch/msp430/lifter_model_call.py b/src/miasm/arch/msp430/lifter_model_call.py
new file mode 100644
index 00000000..05f649e5
--- /dev/null
+++ b/src/miasm/arch/msp430/lifter_model_call.py
@@ -0,0 +1,31 @@
+#-*- coding:utf-8 -*-
+
+from miasm.ir.analysis import LifterModelCall
+from miasm.arch.msp430.sem import Lifter_MSP430
+from miasm.ir.ir import AssignBlock
+from miasm.expression.expression import *
+
+class LifterModelCallMsp430Base(Lifter_MSP430, LifterModelCall):
+
+    def __init__(self, loc_db):
+        Lifter_MSP430.__init__(self, loc_db)
+        self.ret_reg = self.arch.regs.R15
+
+    def call_effects(self, addr, instr):
+        call_assignblk = AssignBlock(
+            [
+                ExprAssign(self.ret_reg, ExprOp('call_func_ret', addr, self.sp, self.arch.regs.R15)),
+                ExprAssign(self.sp, ExprOp('call_func_stack', addr, self.sp))
+            ],
+            instr
+        )
+        return [call_assignblk], []
+
+class LifterModelCallMsp430(LifterModelCallMsp430Base):
+
+    def __init__(self, loc_db):
+        LifterModelCallMsp430Base.__init__(self, loc_db)
+
+    def get_out_regs(self, _):
+        return set([self.ret_reg, self.sp])
+