Alexandre Julliard : kernel32: Implement BaseThreadInitThunk in assembly also for PE builds.

Alexandre Julliard julliard at winehq.org
Mon Nov 23 15:43:24 CST 2020


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Nov 23 13:58:27 2020 +0100

kernel32: Implement BaseThreadInitThunk in assembly also for PE builds.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50171
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/thread.c | 13 ++++++-------
 include/wine/asm.h     | 12 +++++++-----
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/dlls/kernel32/thread.c b/dlls/kernel32/thread.c
index 1cd309d84b4..1f4f938af51 100644
--- a/dlls/kernel32/thread.c
+++ b/dlls/kernel32/thread.c
@@ -33,8 +33,11 @@
 #include "kernel_private.h"
 
 
+/***********************************************************************
+ *           BaseThreadInitThunk (KERNEL32.@)
+ */
 #ifdef __i386__
-__ASM_STDCALL_FUNC( __fastcall_BaseThreadInitThunk, 12,
+__ASM_FASTCALL_FUNC( BaseThreadInitThunk, 12,
                     "pushl %ebp\n\t"
                     __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
                     __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
@@ -50,16 +53,12 @@ __ASM_STDCALL_FUNC( __fastcall_BaseThreadInitThunk, 12,
                     "call *%edx\n\t"
                     "movl %eax,(%esp)\n\t"
                     "call " __ASM_STDCALL( "RtlExitUserThread", 4 ))
-#endif
-
-/***********************************************************************
- *           BaseThreadInitThunk (KERNEL32.@)
- */
+#else
 void __fastcall BaseThreadInitThunk( DWORD unknown, LPTHREAD_START_ROUTINE entry, void *arg )
 {
     RtlExitUserThread( entry( arg ) );
 }
-
+#endif
 
 /***********************************************************************
  *           FreeLibraryAndExitThread (KERNEL32.@)
diff --git a/include/wine/asm.h b/include/wine/asm.h
index 788e26126cb..2d1607ca772 100644
--- a/include/wine/asm.h
+++ b/include/wine/asm.h
@@ -28,9 +28,11 @@
 #endif
 
 #if defined(_WIN32) && defined(__i386__)
-# define __ASM_STDCALL(name,args) __ASM_NAME(name) "@" #args
+# define __ASM_STDCALL(name,args)  "_" name "@" #args
+# define __ASM_FASTCALL(name,args) "@" name "@" #args
 #else
-# define __ASM_STDCALL(name,args) __ASM_NAME(name)
+# define __ASM_STDCALL(name,args)  __ASM_NAME(name)
+# define __ASM_FASTCALL(name,args) __ASM_NAME("__fastcall_" name)
 #endif
 
 #if defined(__GCC_HAVE_DWARF2_CFI_ASM) || (defined(__clang__) && defined(__GNUC__) && !defined(__SEH__))
@@ -78,21 +80,21 @@
     __ASM_BLOCK_END
 
 #define __ASM_GLOBAL_FUNC(name,code) __ASM_DEFINE_FUNC(__ASM_NAME(#name),code)
-
 #define __ASM_STDCALL_FUNC(name,args,code) __ASM_DEFINE_FUNC(__ASM_STDCALL(#name,args),code)
+#define __ASM_FASTCALL_FUNC(name,args,code) __ASM_DEFINE_FUNC(__ASM_FASTCALL(#name,args),code)
 
 /* fastcall support */
 
 #if defined(__i386__) && !defined(_WIN32)
 
 # define DEFINE_FASTCALL1_WRAPPER(func) \
-    __ASM_STDCALL_FUNC( __fastcall_ ## func, 4, \
+    __ASM_FASTCALL_FUNC( func, 4, \
                         "popl %eax\n\t"  \
                         "pushl %ecx\n\t" \
                         "pushl %eax\n\t" \
                         "jmp " __ASM_STDCALL(#func,4) )
 # define DEFINE_FASTCALL_WRAPPER(func,args) \
-    __ASM_STDCALL_FUNC( __fastcall_ ## func, args, \
+    __ASM_FASTCALL_FUNC( func, args, \
                         "popl %eax\n\t"  \
                         "pushl %edx\n\t" \
                         "pushl %ecx\n\t" \




More information about the wine-cvs mailing list