Commit ee4db200 authored by Alexandre Julliard's avatar Alexandre Julliard

include: Define thiscall assembly wrappers globally.

parent 62fa748f
......@@ -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"
......
......@@ -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"
......
......@@ -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)
......
......@@ -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 {
......
......@@ -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;
......
......@@ -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 */
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