Commit bea2be5c authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent b41cc486
...@@ -992,186 +992,6 @@ void output_asm_relays16(void) ...@@ -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 * output_asm_relays
* *
* Build all the assembly relay callbacks * Build all the assembly relay callbacks
...@@ -1183,9 +1003,6 @@ void output_asm_relays(void) ...@@ -1183,9 +1003,6 @@ void output_asm_relays(void)
case CPU_x86: case CPU_x86:
build_call_from_regs_x86(); build_call_from_regs_x86();
break; break;
case CPU_x86_64:
build_call_from_regs_x86_64();
break;
default: default:
break; break;
} }
......
...@@ -55,6 +55,8 @@ static inline int needs_relay( const ORDDEF *odp ) ...@@ -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; if (odp->type != TYPE_STDCALL && odp->type != TYPE_CDECL && odp->type != TYPE_THISCALL) return 0;
/* skip norelay and forward entry points */ /* skip norelay and forward entry points */
if (odp->flags & (FLAG_NORELAY|FLAG_FORWARD)) return 0; 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; return 1;
} }
...@@ -206,7 +208,7 @@ static void output_relay_debug( DLLSPEC *spec ) ...@@ -206,7 +208,7 @@ static void output_relay_debug( DLLSPEC *spec )
output( "\tleaq 40(%%rsp),%%r8\n" ); output( "\tleaq 40(%%rsp),%%r8\n" );
output( "\tmovq $%u,%%rdx\n", (flags << 24) | (args << 16) | (i - spec->base) ); output( "\tmovq $%u,%%rdx\n", (flags << 24) | (args << 16) | (i - spec->base) );
output( "\tleaq .L__wine_spec_relay_descr(%%rip),%%rcx\n" ); 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( "\taddq $40,%%rsp\n" );
output( "\t.cfi_adjust_cfa_offset -40\n" ); output( "\t.cfi_adjust_cfa_offset -40\n" );
output( "\tret\n" ); output( "\tret\n" );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment