Commit d896b119 authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Implement BaseThreadInitThunk in assembly also for PE builds.

parent 6b17d4d9
...@@ -33,8 +33,11 @@ ...@@ -33,8 +33,11 @@
#include "kernel_private.h" #include "kernel_private.h"
/***********************************************************************
* BaseThreadInitThunk (KERNEL32.@)
*/
#ifdef __i386__ #ifdef __i386__
__ASM_STDCALL_FUNC( __fastcall_BaseThreadInitThunk, 12, __ASM_FASTCALL_FUNC( BaseThreadInitThunk, 12,
"pushl %ebp\n\t" "pushl %ebp\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t")
__ASM_CFI(".cfi_rel_offset %ebp,0\n\t") __ASM_CFI(".cfi_rel_offset %ebp,0\n\t")
...@@ -50,16 +53,12 @@ __ASM_STDCALL_FUNC( __fastcall_BaseThreadInitThunk, 12, ...@@ -50,16 +53,12 @@ __ASM_STDCALL_FUNC( __fastcall_BaseThreadInitThunk, 12,
"call *%edx\n\t" "call *%edx\n\t"
"movl %eax,(%esp)\n\t" "movl %eax,(%esp)\n\t"
"call " __ASM_STDCALL( "RtlExitUserThread", 4 )) "call " __ASM_STDCALL( "RtlExitUserThread", 4 ))
#endif #else
/***********************************************************************
* BaseThreadInitThunk (KERNEL32.@)
*/
void __fastcall BaseThreadInitThunk( DWORD unknown, LPTHREAD_START_ROUTINE entry, void *arg ) void __fastcall BaseThreadInitThunk( DWORD unknown, LPTHREAD_START_ROUTINE entry, void *arg )
{ {
RtlExitUserThread( entry( arg ) ); RtlExitUserThread( entry( arg ) );
} }
#endif
/*********************************************************************** /***********************************************************************
* FreeLibraryAndExitThread (KERNEL32.@) * FreeLibraryAndExitThread (KERNEL32.@)
......
...@@ -28,9 +28,11 @@ ...@@ -28,9 +28,11 @@
#endif #endif
#if defined(_WIN32) && defined(__i386__) #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 #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 #endif
#if defined(__GCC_HAVE_DWARF2_CFI_ASM) || (defined(__clang__) && defined(__GNUC__) && !defined(__SEH__)) #if defined(__GCC_HAVE_DWARF2_CFI_ASM) || (defined(__clang__) && defined(__GNUC__) && !defined(__SEH__))
...@@ -78,21 +80,21 @@ ...@@ -78,21 +80,21 @@
__ASM_BLOCK_END __ASM_BLOCK_END
#define __ASM_GLOBAL_FUNC(name,code) __ASM_DEFINE_FUNC(__ASM_NAME(#name),code) #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_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 */ /* fastcall support */
#if defined(__i386__) && !defined(_WIN32) #if defined(__i386__) && !defined(_WIN32)
# define DEFINE_FASTCALL1_WRAPPER(func) \ # define DEFINE_FASTCALL1_WRAPPER(func) \
__ASM_STDCALL_FUNC( __fastcall_ ## func, 4, \ __ASM_FASTCALL_FUNC( func, 4, \
"popl %eax\n\t" \ "popl %eax\n\t" \
"pushl %ecx\n\t" \ "pushl %ecx\n\t" \
"pushl %eax\n\t" \ "pushl %eax\n\t" \
"jmp " __ASM_STDCALL(#func,4) ) "jmp " __ASM_STDCALL(#func,4) )
# define DEFINE_FASTCALL_WRAPPER(func,args) \ # define DEFINE_FASTCALL_WRAPPER(func,args) \
__ASM_STDCALL_FUNC( __fastcall_ ## func, args, \ __ASM_FASTCALL_FUNC( func, args, \
"popl %eax\n\t" \ "popl %eax\n\t" \
"pushl %edx\n\t" \ "pushl %edx\n\t" \
"pushl %ecx\n\t" \ "pushl %ecx\n\t" \
......
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