Alexandre Julliard : winebuild: Get rid of support for register entry points on x86_64.

Alexandre Julliard julliard at winehq.org
Thu Jan 27 12:43:17 CST 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Jan 27 14:08:57 2011 +0100

winebuild: Get rid of support for register entry points on x86_64.

---

 tools/winebuild/relay.c  |  183 ----------------------------------------------
 tools/winebuild/spec32.c |    4 +-
 2 files changed, 3 insertions(+), 184 deletions(-)

diff --git a/tools/winebuild/relay.c b/tools/winebuild/relay.c
index 1c84394..4fa256f 100644
--- a/tools/winebuild/relay.c
+++ b/tools/winebuild/relay.c
@@ -992,186 +992,6 @@ void output_asm_relays16(void)
 
 
 /*******************************************************************
- *         build_call_from_regs_x86_64
- *
- * Build the register saving code for a 'register' entry point.
- *
- * Stack layout:
- *   ...
- * (rsp+16)  first arg
- * (rsp+8)   ret addr to user code
- * (rsp)     ret addr to relay code
- * (rsp-128) buffer area to allow stack frame manipulation
- *
- * Parameters:
- *  %rcx     number of args
- *  %rdx     entry point
- */
-static void build_call_from_regs_x86_64(void)
-{
-    static const int STACK_SPACE = 128 + 0x4d0; /* size of x86_64 context */
-    int i;
-
-    /* Function header */
-
-    output( "\t.text\n" );
-    function_header( "__wine_call_from_regs" );
-
-    output_cfi( ".cfi_startproc" );
-    output( "\tsubq $%u,%%rsp\n", STACK_SPACE );
-    output_cfi( ".cfi_adjust_cfa_offset %u", STACK_SPACE );
-
-    /* save registers into the context */
-
-    output( "\tmovq %%rax,0x78(%%rsp)\n" );
-    output_cfi( ".cfi_rel_offset %%rax,0x78" );
-    output( "\tmovq %u(%%rsp),%%rax\n", STACK_SPACE + 16 );  /* saved %rcx on stack */
-    output( "\tmovq %%rax,0x80(%%rsp)\n" );
-    output_cfi( ".cfi_rel_offset %%rcx,0x80" );
-    output( "\tmovq %u(%%rsp),%%rax\n", STACK_SPACE + 24 );  /* saved %rdx on stack */
-    output_cfi( ".cfi_rel_offset %%rdx,0x88" );
-    output( "\tmovq %%rax,0x88(%%rsp)\n" );
-    output( "\tmovq %%rbx,0x90(%%rsp)\n" );
-    output_cfi( ".cfi_rel_offset %%rbx,0x90" );
-    output( "\tleaq %u(%%rsp),%%rax\n", STACK_SPACE + 16 );
-    output( "\tmovq %%rax,0x98(%%rsp)\n" );
-    output( "\tmovq %%rbp,0xa0(%%rsp)\n" );
-    output_cfi( ".cfi_rel_offset %%rbp,0xa0" );
-    output( "\tmovq %%rsi,0xa8(%%rsp)\n" );
-    output_cfi( ".cfi_rel_offset %%rsi,0xa8" );
-    output( "\tmovq %%rdi,0xb0(%%rsp)\n" );
-    output_cfi( ".cfi_rel_offset %%rdi,0xb0" );
-    output( "\tmovq %%r8,0xb8(%%rsp)\n" );
-    output_cfi( ".cfi_rel_offset %%r8,0xb8" );
-    output( "\tmovq %%r9,0xc0(%%rsp)\n" );
-    output_cfi( ".cfi_rel_offset %%r9,0xc0" );
-    output( "\tmovq %%r10,0xc8(%%rsp)\n" );
-    output_cfi( ".cfi_rel_offset %%r10,0xc8" );
-    output( "\tmovq %%r11,0xd0(%%rsp)\n" );
-    output_cfi( ".cfi_rel_offset %%r11,0xd0" );
-    output( "\tmovq %%r12,0xd8(%%rsp)\n" );
-    output_cfi( ".cfi_rel_offset %%r12,0xd8" );
-    output( "\tmovq %%r13,0xe0(%%rsp)\n" );
-    output_cfi( ".cfi_rel_offset %%r13,0xe0" );
-    output( "\tmovq %%r14,0xe8(%%rsp)\n" );
-    output_cfi( ".cfi_rel_offset %%r14,0xe8" );
-    output( "\tmovq %%r15,0xf0(%%rsp)\n" );
-    output_cfi( ".cfi_rel_offset %%r15,0xf0" );
-    output( "\tmovq %u(%%rsp),%%rax\n", STACK_SPACE + 8 );
-    output( "\tmovq %%rax,0xf8(%%rsp)\n" );
-
-    output( "\tstmxcsr 0x34(%%rsp)\n" );
-    output( "\tfxsave 0x100(%%rsp)\n" );
-    for (i = 0; i < 16; i++)
-    {
-        output( "\tmovdqa %%xmm%u,0x%x(%%rsp)\n", i, 0x1a0 + 16 * i );
-        output_cfi( ".cfi_rel_offset %%xmm%u,0x%x", i, 0x1a0 + 16 * i );
-    }
-
-    output( "\tmovw %%cs,0x38(%%rsp)\n" );
-    output( "\tmovw %%ds,0x3a(%%rsp)\n" );
-    output( "\tmovw %%es,0x3c(%%rsp)\n" );
-    output( "\tmovw %%fs,0x3e(%%rsp)\n" );
-    output( "\tmovw %%gs,0x40(%%rsp)\n" );
-    output( "\tmovw %%ss,0x42(%%rsp)\n" );
-    output( "\tpushfq\n" );
-    output( "\tpopq %%rax\n" );
-    output( "\tmovl %%eax,0x44(%%rsp)\n" );
-
-    output( "\tmovl $0x%x,0x30(%%rsp)\n", 0x0010000f );
-
-    /* transfer the arguments */
-
-    output( "\tmovq %%r8,%u(%%rsp)\n", STACK_SPACE + 32 );
-    output( "\tmovq %%r9,%u(%%rsp)\n", STACK_SPACE + 40 );
-    output( "\tmovq $4,%%rax\n" );
-    output( "\tleaq %u(%%rsp),%%rsi\n", STACK_SPACE + 16 );
-    output( "\tcmpq %%rax,%%rcx\n" );
-    output( "\tcmovgq %%rcx,%%rax\n" );
-    output( "\tmovq %%rsp,%%rbx\n" );
-    output_cfi( ".cfi_def_cfa_register %%rbx" );
-    output( "\tleaq 16(,%%rax,8),%%rax\n" );  /* add 8 for context arg and 8 for rounding */
-    output( "\tandq $~15,%%rax\n" );
-    output( "\tsubq %%rax,%%rsp\n" );
-    output( "\tmovq %%rsp,%%rdi\n" );
-    output( "\tjrcxz 1f\n" );
-    output( "\tcld\n" );
-    output( "\trep\n\tmovsq\n" );
-    output( "1:\tmovq %%rbx,0(%%rdi)\n" );  /* context arg */
-
-    /* call the entry point */
-
-    output( "\tmovq %%rdx,%%rax\n" );
-    output( "\tmovq 0(%%rsp),%%rcx\n" );
-    output( "\tmovq 8(%%rsp),%%rdx\n" );
-    output( "\tmovq 16(%%rsp),%%r8\n" );
-    output( "\tmovq 24(%%rsp),%%r9\n" );
-    output( "\tcallq *%%rax\n" );
-
-    /* restore the context structure */
-
-    output( "1:\tmovq 0x80(%%rbx),%%rcx\n" );
-    output_cfi( ".cfi_same_value %%rcx" );
-    output( "\tmovq 0x88(%%rbx),%%rdx\n" );
-    output_cfi( ".cfi_same_value %%rdx" );
-    output( "\tmovq 0xa0(%%rbx),%%rbp\n" );
-    output_cfi( ".cfi_same_value %%rbp" );
-    output( "\tmovq 0xa8(%%rbx),%%rsi\n" );
-    output_cfi( ".cfi_same_value %%rsi" );
-    output( "\tmovq 0xb0(%%rbx),%%rdi\n" );
-    output_cfi( ".cfi_same_value %%rdi" );
-    output( "\tmovq 0xb8(%%rbx),%%r8\n" );
-    output_cfi( ".cfi_same_value %%r8" );
-    output( "\tmovq 0xc0(%%rbx),%%r9\n" );
-    output_cfi( ".cfi_same_value %%r9" );
-    output( "\tmovq 0xc8(%%rbx),%%r10\n" );
-    output_cfi( ".cfi_same_value %%r10" );
-    output( "\tmovq 0xd0(%%rbx),%%r11\n" );
-    output_cfi( ".cfi_same_value %%r11" );
-    output( "\tmovq 0xd8(%%rbx),%%r12\n" );
-    output_cfi( ".cfi_same_value %%r12" );
-    output( "\tmovq 0xe0(%%rbx),%%r13\n" );
-    output_cfi( ".cfi_same_value %%r13" );
-    output( "\tmovq 0xe8(%%rbx),%%r14\n" );
-    output_cfi( ".cfi_same_value %%r14" );
-    output( "\tmovq 0xf0(%%rbx),%%r15\n" );
-    output_cfi( ".cfi_same_value %%r15" );
-
-    for (i = 0; i < 16; i++)
-    {
-        output( "\tmovdqa 0x%x(%%rbx),%%xmm%u\n", 0x1a0 + 16 * i, i );
-        output_cfi( ".cfi_same_value %%xmm%u", i );
-    }
-    output( "\tfxrstor 0x100(%%rbx)\n" );
-    output( "\tldmxcsr 0x34(%%rbx)\n" );
-
-    output( "\tmovq 0xf8(%%rbx),%%rax\n" );  /* rip */
-    output( "\tmovq %%rax,0(%%rsp)\n" );
-    output( "\tmovw 0x38(%%rbx),%%ax\n" );   /* cs */
-    output( "\tmovq %%rax,0x8(%%rsp)\n" );
-    output( "\tmovl 0x44(%%rbx),%%eax\n" );  /* flags */
-    output( "\tmovq %%rax,0x10(%%rsp)\n" );
-    output( "\tmovq 0x98(%%rbx),%%rax\n" );  /* rsp */
-    output( "\tmovq %%rax,0x18(%%rsp)\n" );
-    output( "\tmovw 0x42(%%rbx),%%ax\n" );   /* ss */
-    output( "\tmovq %%rax,0x20(%%rsp)\n" );
-    output( "\tmovq 0x78(%%rbx),%%rax\n" );
-    output( "\tmovq 0x90(%%rbx),%%rbx\n" );
-    output( "\tiretq\n" );
-    output_cfi( ".cfi_endproc" );
-
-    output_function_size( "__wine_call_from_regs" );
-
-    function_header( "__wine_restore_regs" );
-    output_cfi( ".cfi_startproc" );
-    output( "\tmovq %%rcx,%%rbx\n" );
-    output( "\tjmp 1b\n" );
-    output_cfi( ".cfi_endproc" );
-    output_function_size( "__wine_restore_regs" );
-}
-
-
-/*******************************************************************
  *         output_asm_relays
  *
  * Build all the assembly relay callbacks
@@ -1183,9 +1003,6 @@ void output_asm_relays(void)
     case CPU_x86:
         build_call_from_regs_x86();
         break;
-    case CPU_x86_64:
-        build_call_from_regs_x86_64();
-        break;
     default:
         break;
     }
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index 29436f1..e16260a 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -55,6 +55,8 @@ static inline int needs_relay( const ORDDEF *odp )
     if (odp->type != TYPE_STDCALL && odp->type != TYPE_CDECL && odp->type != TYPE_THISCALL) return 0;
     /* skip norelay and forward entry points */
     if (odp->flags & (FLAG_NORELAY|FLAG_FORWARD)) return 0;
+    /* skip register entry points on x86_64 */
+    if (target_cpu == CPU_x86_64 && (odp->flags & FLAG_REGISTER)) return 0;
     return 1;
 }
 
@@ -206,7 +208,7 @@ static void output_relay_debug( DLLSPEC *spec )
             output( "\tleaq 40(%%rsp),%%r8\n" );
             output( "\tmovq $%u,%%rdx\n", (flags << 24) | (args << 16) | (i - spec->base) );
             output( "\tleaq .L__wine_spec_relay_descr(%%rip),%%rcx\n" );
-            output( "\tcallq *%u(%%rcx)\n", (odp->flags & FLAG_REGISTER) ? 16 : 8 );
+            output( "\tcallq *8(%%rcx)\n" );
             output( "\taddq $40,%%rsp\n" );
             output( "\t.cfi_adjust_cfa_offset -40\n" );
             output( "\tret\n" );




More information about the wine-cvs mailing list