Alexandre Julliard : winebuild: Fix delay load code to preserve stack alignment and save the correct registers .

Alexandre Julliard julliard at winehq.org
Sat Dec 27 13:45:18 CST 2008


Module: wine
Branch: master
Commit: 913354e75ba9bfa512856237ab523388dffb72d4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=913354e75ba9bfa512856237ab523388dffb72d4

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sat Dec 27 19:58:42 2008 +0100

winebuild: Fix delay load code to preserve stack alignment and save the correct registers.

---

 tools/winebuild/import.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index 4d52626..dca18ab 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -971,22 +971,22 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
         output( "\tjmp *%%eax\n" );
         break;
     case CPU_x86_64:
-        output( "\tpushq %%rdi\n" );
-        output( "\tpushq %%rsi\n" );
         output( "\tpushq %%rdx\n" );
         output( "\tpushq %%rcx\n" );
         output( "\tpushq %%r8\n" );
         output( "\tpushq %%r9\n" );
-        output( "\tsubq $32,%%rsp\n" );
-        output( "\tmovq %%r11,%%rcx\n" );
+        output( "\tpushq %%r10\n" );
+        output( "\tpushq %%r11\n" );
+        output( "\tsubq $40,%%rsp\n" );
+        output( "\tmovq %%rax,%%rcx\n" );
         output( "\tcall %s\n", asm_name("__wine_spec_delay_load") );
-        output( "\taddq $32,%%rsp\n" );
+        output( "\taddq $40,%%rsp\n" );
+        output( "\tpopq %%r11\n" );
+        output( "\tpopq %%r10\n" );
         output( "\tpopq %%r9\n" );
         output( "\tpopq %%r8\n" );
         output( "\tpopq %%rcx\n" );
         output( "\tpopq %%rdx\n" );
-        output( "\tpopq %%rsi\n" );
-        output( "\tpopq %%rdi\n" );
         output( "\tjmp *%%rax\n" );
         break;
     case CPU_SPARC:
@@ -1069,7 +1069,7 @@ static void output_delayed_import_thunks( const DLLSPEC *spec )
                 output( "\tjmp %s\n", asm_name("__wine_delay_load_asm") );
                 break;
             case CPU_x86_64:
-                output( "\tmovq $%d,%%r11\n", (idx << 16) | j );
+                output( "\tmovq $%d,%%rax\n", (idx << 16) | j );
                 output( "\tjmp %s\n", asm_name("__wine_delay_load_asm") );
                 break;
             case CPU_SPARC:




More information about the wine-cvs mailing list