Module: wine Branch: master Commit: ee4db2005eaafdab8996527c134c52d9d03e785c URL: https://source.winehq.org/git/wine.git/?a=commit;h=ee4db2005eaafdab8996527c1...
Author: Alexandre Julliard julliard@winehq.org Date: Wed May 15 20:06:32 2019 +0200
include: Define thiscall assembly wrappers globally.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/msvcp90/cxx.h | 23 ----------------------- dlls/msvcrt/cxx.h | 22 ---------------------- dlls/riched20/txthost.c | 29 ----------------------------- dlls/riched20/txtsrv.c | 29 ----------------------------- dlls/vssapi/main.c | 22 ---------------------- include/wine/asm.h | 37 +++++++++++++++++++++++++++++++++++++ 6 files changed, 37 insertions(+), 125 deletions(-)
diff --git a/dlls/msvcp90/cxx.h b/dlls/msvcp90/cxx.h index fd69756..e14b7de 100644 --- a/dlls/msvcp90/cxx.h +++ b/dlls/msvcp90/cxx.h @@ -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" diff --git a/dlls/msvcrt/cxx.h b/dlls/msvcrt/cxx.h index 75677e2..68783f5 100644 --- a/dlls/msvcrt/cxx.h +++ b/dlls/msvcrt/cxx.h @@ -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" diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c index ab94503..e4c4e0c 100644 --- a/dlls/riched20/txthost.c +++ b/dlls/riched20/txthost.c @@ -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) diff --git a/dlls/riched20/txtsrv.c b/dlls/riched20/txtsrv.c index a9ceef4..6777f97 100644 --- a/dlls/riched20/txtsrv.c +++ b/dlls/riched20/txtsrv.c @@ -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 { diff --git a/dlls/vssapi/main.c b/dlls/vssapi/main.c index 2ebd204..526772a 100644 --- a/dlls/vssapi/main.c +++ b/dlls/vssapi/main.c @@ -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; diff --git a/include/wine/asm.h b/include/wine/asm.h index f1c50fd..a581b12 100644 --- a/include/wine/asm.h +++ b/include/wine/asm.h @@ -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 */