about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2020-01-29 16:26:41 +0100
committerGitHub <noreply@github.com>2020-01-29 16:26:41 +0100
commitf847fcc06fc6720c4fc6b2d5be3c087b46c904f8 (patch)
treea314a4d3f4da9e28b9d0414c310e0ac107c7cb07
parent1dc08a7276e2732358c3f4c158fd452a1fb081f4 (diff)
parenteb98df0bcab321ebb45ed6b307baee3b9cca00bc (diff)
downloadmiasm-f847fcc06fc6720c4fc6b2d5be3c087b46c904f8.tar.gz
miasm-f847fcc06fc6720c4fc6b2d5be3c087b46c904f8.zip
Merge pull request #1128 from Frky/patch-1
Fix bug in Microsoft x86-64 calling convention
-rw-r--r--miasm/arch/x86/jit.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/miasm/arch/x86/jit.py b/miasm/arch/x86/jit.py
index 8ecab5fa..3c0d1b33 100644
--- a/miasm/arch/x86/jit.py
+++ b/miasm/arch/x86/jit.py
@@ -229,7 +229,10 @@ class jitter_x86_64(Jitter):
         for i in range(min(n_args, 4)):
             args.append(self.cpu.get_gpreg()[args_regs[i]])
         for i in range(max(0, n_args - 4)):
-            args.append(self.get_stack_arg(i))
+            # Take into account the shadow registers on the stack 
+            # (Microsoft 64bit stdcall ABI)
+            # => Skip the first 4 stack parameters
+            args.append(self.get_stack_arg(4 + i))
         return ret_ad, args
 
     def func_prepare_stdcall(self, ret_addr, *args):