Alexandre Julliard : winebuild: Generate stub entry points for x86_64.

Alexandre Julliard julliard at winehq.org
Tue Dec 16 08:40:31 CST 2008


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Dec 16 12:20:30 2008 +0100

winebuild: Generate stub entry points for x86_64.

---

 tools/winebuild/import.c |   75 ++++++++++++++++++++++++++++-----------------
 tools/winebuild/parser.c |    2 +-
 2 files changed, 48 insertions(+), 29 deletions(-)

diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index 2698430..4d52626 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -1192,45 +1192,64 @@ void output_stubs( DLLSPEC *spec )
         output( "\t%s\n", func_declaration(name) );
         output( "%s:\n", asm_name(name) );
 
-        /* flesh out the stub a bit to make safedisc happy */
-        output(" \tnop\n" );
-        output(" \tnop\n" );
-        output(" \tnop\n" );
-        output(" \tnop\n" );
-        output(" \tnop\n" );
-        output(" \tnop\n" );
-        output(" \tnop\n" );
-        output(" \tnop\n" );
-        output(" \tnop\n" );
-
-        output( "\tsubl $4,%%esp\n" );
-        if (UsePIC)
+        switch (target_cpu)
         {
-            output( "\tcall %s\n", asm_name("__wine_spec_get_pc_thunk_eax") );
-            output( "1:" );
-            if (exp_name)
+        case CPU_x86:
+            /* flesh out the stub a bit to make safedisc happy */
+            output(" \tnop\n" );
+            output(" \tnop\n" );
+            output(" \tnop\n" );
+            output(" \tnop\n" );
+            output(" \tnop\n" );
+            output(" \tnop\n" );
+            output(" \tnop\n" );
+            output(" \tnop\n" );
+            output(" \tnop\n" );
+
+            output( "\tsubl $4,%%esp\n" );
+            if (UsePIC)
             {
-                output( "\tleal .L%s_string-1b(%%eax),%%ecx\n", name );
+                output( "\tcall %s\n", asm_name("__wine_spec_get_pc_thunk_eax") );
+                output( "1:" );
+                if (exp_name)
+                {
+                    output( "\tleal .L%s_string-1b(%%eax),%%ecx\n", name );
+                    output( "\tpushl %%ecx\n" );
+                    count++;
+                }
+                else
+                    output( "\tpushl $%d\n", odp->ordinal );
+                output( "\tleal .L__wine_spec_file_name-1b(%%eax),%%ecx\n" );
                 output( "\tpushl %%ecx\n" );
-                count++;
             }
             else
-                output( "\tpushl $%d\n", odp->ordinal );
-            output( "\tleal .L__wine_spec_file_name-1b(%%eax),%%ecx\n" );
-            output( "\tpushl %%ecx\n" );
-        }
-        else
-        {
+            {
+                if (exp_name)
+                {
+                    output( "\tpushl $.L%s_string\n", name );
+                    count++;
+                }
+                else
+                    output( "\tpushl $%d\n", odp->ordinal );
+                output( "\tpushl $.L__wine_spec_file_name\n" );
+            }
+            output( "\tcall %s\n", asm_name("__wine_spec_unimplemented_stub") );
+            break;
+        case CPU_x86_64:
+            output( "\tleaq .L__wine_spec_file_name(%%rip),%%rdi\n" );
             if (exp_name)
             {
-                output( "\tpushl $.L%s_string\n", name );
+                output( "leaq .L%s_string(%%rip),%%rsi\n", name );
                 count++;
             }
             else
-                output( "\tpushl $%d\n", odp->ordinal );
-            output( "\tpushl $.L__wine_spec_file_name\n" );
+                output( "\tmovq $%d,%%rsi\n", odp->ordinal );
+            output( "\tsubq $8,%%rsp\n" );
+            output( "\tcall %s\n", asm_name("__wine_spec_unimplemented_stub") );
+            break;
+        default:
+            assert(0);
         }
-        output( "\tcall %s\n", asm_name("__wine_spec_unimplemented_stub") );
         output_function_size( name );
     }
 
diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c
index 84281c5..ee39dcf 100644
--- a/tools/winebuild/parser.c
+++ b/tools/winebuild/parser.c
@@ -377,7 +377,7 @@ static int parse_spec_stub( ORDDEF *odp, DLLSPEC *spec )
 {
     odp->u.func.arg_types[0] = '\0';
     odp->link_name = xstrdup("");
-    odp->flags |= FLAG_CPU(CPU_x86); /* don't bother generating stubs for Winelib */
+    odp->flags |= FLAG_CPU(CPU_x86) | FLAG_CPU(CPU_x86_64); /* don't bother generating stubs for Winelib */
     return 1;
 }
 




More information about the wine-cvs mailing list