Module: wine Branch: master Commit: b337c5b1a1757b2abbc90a7c6955d64242861ab9 URL: https://gitlab.winehq.org/wine/wine/-/commit/b337c5b1a1757b2abbc90a7c6955d64...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Jun 2 09:35:29 2023 +0200
ntdll: Use the default ABI for all functions on the Unix side.
---
dlls/ntdll/unix/signal_x86_64.c | 31 ++++++++++++++++++++++++------- include/msvcrt/corecrt.h | 4 ++++ include/windef.h | 6 +++++- 3 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c index a1ee73fe5fb..48443799ef6 100644 --- a/dlls/ntdll/unix/signal_x86_64.c +++ b/dlls/ntdll/unix/signal_x86_64.c @@ -2694,10 +2694,12 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher, "leaq -0x98(%rbp),%rcx\n" "2:\n\t" #endif - "leaq 0x28(%rsp),%rsi\n\t" /* first argument */ + "movq 0x28(%rsp),%r12\n\t" /* 5th argument */ + "movq 0x30(%rsp),%r13\n\t" /* 6th argument */ + "leaq 0x38(%rsp),%rsi\n\t" /* 7th argument */ "movq %rcx,%rsp\n\t" "movq 0x00(%rcx),%rax\n\t" - "movq 0x18(%rcx),%rdx\n\t" + "movq 0x18(%rcx),%r11\n\t" /* 2nd argument */ "movl %eax,%ebx\n\t" "shrl $8,%ebx\n\t" "andl $0x30,%ebx\n\t" /* syscall table number */ @@ -2708,7 +2710,7 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher, "jae 5f\n\t" "movq 24(%rbx),%rcx\n\t" /* table->ArgumentTable */ "movzbl (%rcx,%rax),%ecx\n\t" - "subq $0x20,%rcx\n\t" + "subq $0x30,%rcx\n\t" "jbe 1f\n\t" "subq %rcx,%rsp\n\t" "shrq $3,%rcx\n\t" @@ -2716,8 +2718,12 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher, "movq %rsp,%rdi\n\t" "cld\n\t" "rep; movsq\n" - "1:\tmovq %r10,%rcx\n\t" - "subq $0x20,%rsp\n\t" + "1:\tmovq %r10,%rdi\n\t" /* 1st argument */ + "movq %r11,%rsi\n\t" /* 2nd argument */ + "movq %r8,%rdx\n\t" /* 3rd argument */ + "movq %r9,%rcx\n\t" /* 4th argument */ + "movq %r12,%r8\n\t" /* 5th argument */ + "movq %r13,%r9\n\t" /* 6th argument */ "movq (%rbx),%r10\n\t" /* table->ServiceTable */ "callq *(%r10,%rax,8)\n\t" "leaq -0x98(%rbp),%rcx\n\t" @@ -2732,8 +2738,19 @@ __ASM_GLOBAL_FUNC( __wine_syscall_dispatcher, "1:\n\t" #endif "testl $0x48,%edx\n\t" /* CONTEXT_FLOATING_POINT | CONTEXT_XSTATE */ - "jz 4f\n\t" - "testl $3,%r14d\n\t" /* SYSCALL_HAVE_XSAVE | SYSCALL_HAVE_XSAVEC */ + "jnz 2f\n\t" + "movaps 0x1c0(%rcx),%xmm6\n\t" + "movaps 0x1d0(%rcx),%xmm7\n\t" + "movaps 0x1e0(%rcx),%xmm8\n\t" + "movaps 0x1f0(%rcx),%xmm9\n\t" + "movaps 0x200(%rcx),%xmm10\n\t" + "movaps 0x210(%rcx),%xmm11\n\t" + "movaps 0x220(%rcx),%xmm12\n\t" + "movaps 0x230(%rcx),%xmm13\n\t" + "movaps 0x240(%rcx),%xmm14\n\t" + "movaps 0x250(%rcx),%xmm15\n\t" + "jmp 4f\n" + "2:\ttestl $3,%r14d\n\t" /* SYSCALL_HAVE_XSAVE | SYSCALL_HAVE_XSAVEC */ "jz 3f\n\t" "movq %rax,%r11\n\t" "movl $7,%eax\n\t" diff --git a/include/msvcrt/corecrt.h b/include/msvcrt/corecrt.h index 02f3c2f8a09..9ad707824ff 100644 --- a/include/msvcrt/corecrt.h +++ b/include/msvcrt/corecrt.h @@ -29,6 +29,10 @@ # error You cannot use config.h with msvcrt #endif
+#ifdef WINE_UNIX_LIB +# error msvcrt headers cannot be used in Unix code +#endif + #ifndef _WIN32 # define _WIN32 #endif diff --git a/include/windef.h b/include/windef.h index 827e9f92a26..28aa7d6a237 100644 --- a/include/windef.h +++ b/include/windef.h @@ -54,7 +54,11 @@ extern "C" { # endif #endif
-#if !defined(_MSC_VER) && !defined(__MINGW32__) +#ifdef WINE_UNIX_LIB +# define __stdcall +# define __cdecl +# define __fastcall +#elif !defined(_MSC_VER) && !defined(__MINGW32__) # undef __stdcall # ifdef __i386__ # ifdef __GNUC__