about summary refs log tree commit diff stats
path: root/miasm2/arch/arm/jit.py
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2017-04-05 15:51:14 +0200
committerAjax <commial@gmail.com>2017-04-06 13:47:38 +0200
commit9ba85c8fb0e1e0bdcbeb93d500a6bebac963a0b0 (patch)
treee29782e2699b1c6624489dae5c5635d3df7ad4eb /miasm2/arch/arm/jit.py
parent620c96e891d0ad356332713a23b39b9d2382470c (diff)
downloadmiasm-9ba85c8fb0e1e0bdcbeb93d500a6bebac963a0b0.tar.gz
miasm-9ba85c8fb0e1e0bdcbeb93d500a6bebac963a0b0.zip
Introduce a new API 'func_prepare_<callingconv>' for calling a function
Diffstat (limited to 'miasm2/arch/arm/jit.py')
-rw-r--r--miasm2/arch/arm/jit.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/miasm2/arch/arm/jit.py b/miasm2/arch/arm/jit.py
index e0d08679..545d60de 100644
--- a/miasm2/arch/arm/jit.py
+++ b/miasm2/arch/arm/jit.py
@@ -44,6 +44,12 @@ class jitter_arml(jitter):
             self.cpu.R0 = ret_value
         return True
 
+    def func_prepare_stdcall(self, ret_addr, *args):
+        for index in xrange(min(len(args), 4)):
+            setattr(self.cpu, 'R%d' % index, args[index])
+        for index in xrange(4, len(args)):
+            self.vm.set_mem(self.cpu.SP + 4 * (index - 4), pck32(args[index]))
+        self.cpu.LR = ret_addr
 
     def get_arg_n_stdcall(self, index):
         if index < 4:
@@ -54,6 +60,7 @@ class jitter_arml(jitter):
 
     func_args_systemv = func_args_stdcall
     func_ret_systemv = func_ret_stdcall
+    func_prepare_systemv = func_prepare_stdcall
     get_arg_n_systemv = get_arg_n_stdcall
 
     def init_run(self, *args, **kwargs):