Commit b64511c0 authored by Thomas Faber's avatar Thomas Faber Committed by Alexandre Julliard

riched20: Implement MSVC asm wrappers.

parent b5058ada
...@@ -502,6 +502,16 @@ DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *i ...@@ -502,6 +502,16 @@ DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *i
#ifdef __i386__ /* thiscall functions are i386-specific */ #ifdef __i386__ /* thiscall functions are i386-specific */
#define THISCALL(func) (void *) __thiscall_ ## func #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) \ #define DEFINE_THISCALL_WRAPPER(func,args) \
extern HRESULT __thiscall_ ## func(void); \ extern HRESULT __thiscall_ ## func(void); \
__ASM_GLOBAL_FUNC(__thiscall_ ## func, \ __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
...@@ -509,6 +519,7 @@ DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *i ...@@ -509,6 +519,7 @@ DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *i
"pushl %ecx\n\t" \ "pushl %ecx\n\t" \
"pushl %eax\n\t" \ "pushl %eax\n\t" \
"jmp " __ASM_NAME(#func) __ASM_STDCALL(args) ) "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
#endif /* _MSC_VER */
#else /* __i386__ */ #else /* __i386__ */
...@@ -560,6 +571,17 @@ DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSelectionBarWidth,8) ...@@ -560,6 +571,17 @@ DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSelectionBarWidth,8)
#ifdef __i386__ /* thiscall functions are i386-specific */ #ifdef __i386__ /* thiscall functions are i386-specific */
#define STDCALL(func) (void *) __stdcall_ ## func #define STDCALL(func) (void *) __stdcall_ ## func
#ifdef _MSC_VER
#define DEFINE_STDCALL_WRAPPER(num,func,args) \
__declspec(naked) HRESULT __stdcall_##func(void) \
{ \
__asm pop eax \
__asm pop ecx \
__asm push eax \
__asm mov eax, [ecx] \
__asm jmp dword ptr [eax + 4*num] \
}
#else /* _MSC_VER */
#define DEFINE_STDCALL_WRAPPER(num,func,args) \ #define DEFINE_STDCALL_WRAPPER(num,func,args) \
extern HRESULT __stdcall_ ## func(void); \ extern HRESULT __stdcall_ ## func(void); \
__ASM_GLOBAL_FUNC(__stdcall_ ## func, \ __ASM_GLOBAL_FUNC(__stdcall_ ## func, \
...@@ -568,6 +590,7 @@ DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSelectionBarWidth,8) ...@@ -568,6 +590,7 @@ DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSelectionBarWidth,8)
"pushl %eax\n\t" \ "pushl %eax\n\t" \
"movl (%ecx), %eax\n\t" \ "movl (%ecx), %eax\n\t" \
"jmp *(4*(" #num "))(%eax)" ) "jmp *(4*(" #num "))(%eax)" )
#endif /* _MSC_VER */
DEFINE_STDCALL_WRAPPER(3,ITextHostImpl_TxGetDC,4) DEFINE_STDCALL_WRAPPER(3,ITextHostImpl_TxGetDC,4)
DEFINE_STDCALL_WRAPPER(4,ITextHostImpl_TxReleaseDC,8) DEFINE_STDCALL_WRAPPER(4,ITextHostImpl_TxReleaseDC,8)
......
...@@ -36,6 +36,16 @@ ...@@ -36,6 +36,16 @@
#ifdef __i386__ /* thiscall functions are i386-specific */ #ifdef __i386__ /* thiscall functions are i386-specific */
#define THISCALL(func) (void *) __thiscall_ ## func #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) \ #define DEFINE_THISCALL_WRAPPER(func,args) \
extern HRESULT __thiscall_ ## func(void); \ extern HRESULT __thiscall_ ## func(void); \
__ASM_GLOBAL_FUNC(__thiscall_ ## func, \ __ASM_GLOBAL_FUNC(__thiscall_ ## func, \
...@@ -43,6 +53,8 @@ ...@@ -43,6 +53,8 @@
"pushl %ecx\n\t" \ "pushl %ecx\n\t" \
"pushl %eax\n\t" \ "pushl %eax\n\t" \
"jmp " __ASM_NAME(#func) __ASM_STDCALL(args) ) "jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
#endif /* _MSC_VER */
#else /* __i386__ */ #else /* __i386__ */
#define THISCALL(func) func #define THISCALL(func) func
......
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