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@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-11-23 13:58:27 +01:00
parent 6b17d4d90b
commit d896b1195d
2 changed files with 13 additions and 12 deletions

View file

@ -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.@)

View file

@ -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" \