include: Define thiscall assembly wrappers globally.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-05-15 20:06:32 +02:00
parent 62fa748f23
commit ee4db2005e
6 changed files with 37 additions and 125 deletions

View File

@ -18,29 +18,6 @@
#include "wine/asm.h"
/* Copied from dlls/msvcrt/cxx.h */
#undef __thiscall
#ifdef __i386__ /* thiscall functions are i386-specific */
#define THISCALL(func) __thiscall_ ## func
#define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func)
#define __thiscall __stdcall
#define DEFINE_THISCALL_WRAPPER(func,args) \
extern void THISCALL(func)(void); \
__ASM_GLOBAL_FUNC(__thiscall_ ## func, \
"popl %eax\n\t" \
"pushl %ecx\n\t" \
"pushl %eax\n\t" \
"jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
#else /* __i386__ */
#define THISCALL(func) func
#define THISCALL_NAME(func) __ASM_NAME(#func)
#define __thiscall __cdecl
#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
#endif /* __i386__ */
#ifdef _WIN64
#define VTABLE_ADD_FUNC(name) "\t.quad " THISCALL_NAME(name) "\n"

View File

@ -18,28 +18,6 @@
#include "wine/asm.h"
#undef __thiscall
#ifdef __i386__ /* thiscall functions are i386-specific */
#define THISCALL(func) __thiscall_ ## func
#define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func)
#define __thiscall __stdcall
#define DEFINE_THISCALL_WRAPPER(func,args) \
extern void THISCALL(func)(void); \
__ASM_GLOBAL_FUNC(__thiscall_ ## func, \
"popl %eax\n\t" \
"pushl %ecx\n\t" \
"pushl %eax\n\t" \
"jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
#else /* __i386__ */
#define THISCALL(func) func
#define THISCALL_NAME(func) __ASM_NAME(#func)
#define __thiscall __cdecl
#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
#endif /* __i386__ */
#ifdef _WIN64
#define VTABLE_ADD_FUNC(name) "\t.quad " THISCALL_NAME(name) "\n"

View File

@ -500,35 +500,6 @@ DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *i
}
#ifdef __i386__ /* thiscall functions are i386-specific */
#define THISCALL(func) (void *) __thiscall_ ## func
#ifdef _MSC_VER
#define DEFINE_THISCALL_WRAPPER(func,args) \
__declspec(naked) HRESULT __thiscall_##func(void) \
{ \
__asm pop eax \
__asm push ecx \
__asm push eax \
__asm jmp func \
}
#else /* _MSC_VER */
#define DEFINE_THISCALL_WRAPPER(func,args) \
extern HRESULT __thiscall_ ## func(void); \
__ASM_GLOBAL_FUNC(__thiscall_ ## func, \
"popl %eax\n\t" \
"pushl %ecx\n\t" \
"pushl %eax\n\t" \
"jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
#endif /* _MSC_VER */
#else /* __i386__ */
#define THISCALL(func) func
#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
#endif /* __i386__ */
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetDC,4)
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxReleaseDC,8)
DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxShowScrollBar,12)

View File

@ -34,35 +34,6 @@
#include "wine/debug.h"
#include "editstr.h"
#ifdef __i386__ /* thiscall functions are i386-specific */
#define THISCALL(func) (void *) __thiscall_ ## func
#ifdef _MSC_VER
#define DEFINE_THISCALL_WRAPPER(func,args) \
__declspec(naked) HRESULT __thiscall_##func(void) \
{ \
__asm pop eax \
__asm push ecx \
__asm push eax \
__asm jmp func \
}
#else /* _MSC_VER */
#define DEFINE_THISCALL_WRAPPER(func,args) \
extern HRESULT __thiscall_ ## func(void); \
__ASM_GLOBAL_FUNC(__thiscall_ ## func, \
"popl %eax\n\t" \
"pushl %ecx\n\t" \
"pushl %eax\n\t" \
"jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
#endif /* _MSC_VER */
#else /* __i386__ */
#define THISCALL(func) func
#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
#endif /* __i386__ */
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
typedef struct ITextServicesImpl {

View File

@ -28,28 +28,6 @@
WINE_DEFAULT_DEBUG_CHANNEL( vssapi );
#undef __thiscall
#ifdef __i386__ /* thiscall functions are i386-specific */
#define THISCALL(func) __thiscall_ ## func
#define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func)
#define __thiscall __stdcall
#define DEFINE_THISCALL_WRAPPER(func,args) \
extern void THISCALL(func)(void); \
__ASM_GLOBAL_FUNC(__thiscall_ ## func, \
"popl %eax\n\t" \
"pushl %ecx\n\t" \
"pushl %eax\n\t" \
"jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
#else /* __i386__ */
#define THISCALL(func) func
#define THISCALL_NAME(func) __ASM_NAME(#func)
#define __thiscall __cdecl
#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
#endif /* __i386__ */
struct CVssWriter
{
void **vtable;

View File

@ -88,4 +88,41 @@
#endif /* __i386__ */
/* thiscall support */
#undef __thiscall
#define __thiscall __stdcall
#ifdef __i386__
# ifdef _MSC_VER
# define DEFINE_THISCALL_WRAPPER(func,args) \
__declspec(naked) HRESULT __thiscall_##func(void) \
{ __asm { \
pop eax \
push ecx \
push eax \
jmp func \
} }
# else /* _MSC_VER */
# define DEFINE_THISCALL_WRAPPER(func,args) \
extern void __thiscall_ ## func(void); \
__ASM_GLOBAL_FUNC( __thiscall_ ## func, \
"popl %eax\n\t" \
"pushl %ecx\n\t" \
"pushl %eax\n\t" \
"jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
# endif /* _MSC_VER */
# define THISCALL(func) (void *)__thiscall_ ## func
# define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func)
#else /* __i386__ */
# define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
# define THISCALL(func) func
# define THISCALL_NAME(func) __ASM_NAME(#func)
#endif /* __i386__ */
#endif /* __WINE_WINE_ASM_H */