riched20: Implement MSVC asm wrappers.
Signed-off-by: Thomas Faber <thomas.faber@reactos.org> Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b5058ada58
commit
b64511c00a
|
@ -502,6 +502,16 @@ 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, \
|
||||
|
@ -509,6 +519,7 @@ DECLSPEC_HIDDEN HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *i
|
|||
"pushl %ecx\n\t" \
|
||||
"pushl %eax\n\t" \
|
||||
"jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#else /* __i386__ */
|
||||
|
||||
|
@ -560,6 +571,17 @@ DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSelectionBarWidth,8)
|
|||
#ifdef __i386__ /* thiscall functions are i386-specific */
|
||||
|
||||
#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) \
|
||||
extern HRESULT __stdcall_ ## func(void); \
|
||||
__ASM_GLOBAL_FUNC(__stdcall_ ## func, \
|
||||
|
@ -568,6 +590,7 @@ DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetSelectionBarWidth,8)
|
|||
"pushl %eax\n\t" \
|
||||
"movl (%ecx), %eax\n\t" \
|
||||
"jmp *(4*(" #num "))(%eax)" )
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
DEFINE_STDCALL_WRAPPER(3,ITextHostImpl_TxGetDC,4)
|
||||
DEFINE_STDCALL_WRAPPER(4,ITextHostImpl_TxReleaseDC,8)
|
||||
|
|
|
@ -36,6 +36,16 @@
|
|||
#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, \
|
||||
|
@ -43,6 +53,8 @@
|
|||
"pushl %ecx\n\t" \
|
||||
"pushl %eax\n\t" \
|
||||
"jmp " __ASM_NAME(#func) __ASM_STDCALL(args) )
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
#else /* __i386__ */
|
||||
|
||||
#define THISCALL(func) func
|
||||
|
|
Loading…
Reference in New Issue