about summary refs log tree commit diff stats
path: root/miasm2/jitter/os_dep/linux_stdlib.py
diff options
context:
space:
mode:
authorserpilliere <devnull@localhost>2014-07-03 13:34:01 +0200
committerserpilliere <devnull@localhost>2014-07-03 13:34:01 +0200
commit7c42f6f2139a550f099f6d0ff7b95712abff37ef (patch)
treed443a9bc62ef964de945a9302802850d0d1cbe7c /miasm2/jitter/os_dep/linux_stdlib.py
parenta8003c034b1460186d615bbc09cc926168f2c796 (diff)
downloadmiasm-7c42f6f2139a550f099f6d0ff7b95712abff37ef.tar.gz
miasm-7c42f6f2139a550f099f6d0ff7b95712abff37ef.zip
Jitter: Fix fastcall/stdcall arch arm and linux
Diffstat (limited to 'miasm2/jitter/os_dep/linux_stdlib.py')
-rw-r--r--miasm2/jitter/os_dep/linux_stdlib.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/miasm2/jitter/os_dep/linux_stdlib.py b/miasm2/jitter/os_dep/linux_stdlib.py
index 0a1e0bfb..50208b93 100644
--- a/miasm2/jitter/os_dep/linux_stdlib.py
+++ b/miasm2/jitter/os_dep/linux_stdlib.py
@@ -12,9 +12,9 @@ def xxx_isprint(jitter):
 
     checks for any printable character including space.
     '''
-    c,  = jitter.func_args_fastcall(1)
+    ret_addr, (c,)  = jitter.func_args_stdcall(1)
     ret = chr(c & 0xFF) in printable and 1 or 0
-    return jitter.func_ret_fastcall(ret)
+    return jitter.func_ret_stdcall(ret_addr, ret)
 
 
 def xxx_memcpy(jitter):
@@ -24,9 +24,9 @@ def xxx_memcpy(jitter):
 
     copies n bytes from memory area src to memory area dest.
     '''
-    dest, src, n, = jitter.func_args_fastcall(3)
+    ret_addr, (dest, src, n) = jitter.func_args_stdcall(3)
     jitter.vm.vm_set_mem(dest, jitter.vm.vm_get_mem(src, n))
-    return jitter.func_ret_fastcall(dest)
+    return jitter.func_ret_stdcall(ret_addr, dest)
 
 
 def xxx_puts(jitter):
@@ -36,7 +36,7 @@ def xxx_puts(jitter):
 
     writes the string s and a trailing newline to stdout.
     '''
-    s, = jitter.func_args_fastcall(1)
+    ret_addr, (s,) = jitter.func_args_stdcall(1)
     while True:
         c = jitter.vm.vm_get_mem(s, 1)
         s += 1
@@ -44,7 +44,7 @@ def xxx_puts(jitter):
             break
         stdout.write(c)
     stdout.write('\n')
-    return jitter.func_ret_fastcall(1)
+    return jitter.func_ret_stdcall(ret_addr, 1)
 
 
 def xxx_snprintf(jitter):
@@ -54,8 +54,8 @@ def xxx_snprintf(jitter):
 
     writes to string str according to format format and at most size bytes.
     '''
-    str, size, format, = jitter.func_args_fastcall(3)
-    curarg, output = 4, ''
+    ret_addr, (str, size, format) = jitter.func_args_stdcall(3)
+    curarg, output = 3, ''
     while True:
         c = jitter.vm.vm_get_mem(format, 1)
         format += 1
@@ -69,10 +69,10 @@ def xxx_snprintf(jitter):
                 token += c
                 if c in '%cdfsux':
                     break
-            c = token % jitter.func_args_fastcall(curarg)[-1]
+            c = token % jitter.get_arg_n_stdcall(curarg)
             curarg += 1
         output += c
     output = output[:size - 1]
     ret = len(output)
     jitter.vm.vm_set_mem(str, output + '\x00')
-    return jitter.func_ret_fastcall(ret)
+    return jitter.func_ret_stdcall(ret_addr, ret)