MS C related changes.
This commit is contained in:
parent
7e15e5d5c3
commit
3751ff045c
|
@ -31,7 +31,7 @@
|
|||
struct async_private;
|
||||
|
||||
typedef void (*async_handler)(struct async_private *ovp);
|
||||
typedef void CALLBACK (*async_call_completion_func)(ULONG_PTR data);
|
||||
typedef void (CALLBACK *async_call_completion_func)(ULONG_PTR data);
|
||||
typedef DWORD (*async_get_status)(const struct async_private *ovp);
|
||||
typedef DWORD (*async_get_count)(const struct async_private *ovp);
|
||||
typedef void (*async_set_status)(struct async_private *ovp, const DWORD status);
|
||||
|
|
|
@ -1244,7 +1244,7 @@ typedef CONTEXT *PCONTEXT;
|
|||
extern inline void __set_##seg(int val) { __asm__("movw %w0,%%" #seg : : "r" (val)); }
|
||||
# elif defined(_MSC_VER)
|
||||
# define __DEFINE_GET_SEG(seg) \
|
||||
extern inline unsigned short __get_##seg(void) { unsigned short res; __asm { mov res, fs } return res; }
|
||||
extern inline unsigned short __get_##seg(void) { unsigned short res; __asm { mov res, seg } return res; }
|
||||
# define __DEFINE_SET_SEG(seg) \
|
||||
extern inline void __set_##seg(unsigned short val) { __asm { mov seg, val } }
|
||||
# else /* __GNUC__ || _MSC_VER */
|
||||
|
@ -2360,6 +2360,14 @@ extern inline struct _TEB * WINAPI NtCurrentTeb(void)
|
|||
__asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
|
||||
return teb;
|
||||
}
|
||||
#elif defined(__i386__) && defined(_MSC_VER)
|
||||
extern inline struct _TEB * WINAPI NtCurrentTeb(void)
|
||||
{
|
||||
struct _TEB *teb;
|
||||
__asm mov eax, fs:[0x18];
|
||||
__asm mov teb, eax;
|
||||
return teb;
|
||||
}
|
||||
#else
|
||||
extern struct _TEB * WINAPI NtCurrentTeb(void);
|
||||
#endif
|
||||
|
|
|
@ -938,12 +938,26 @@ void WINAPI FreeMappedBuffer( CONTEXT86 *context )
|
|||
}
|
||||
|
||||
#ifdef __i386__
|
||||
__ASM_GLOBAL_FUNC( __get_cs, "movw %cs,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( __get_ds, "movw %ds,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( __get_es, "movw %es,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( __get_fs, "movw %fs,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( __get_gs, "movw %gs,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( __get_ss, "movw %ss,%ax\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( __set_fs, "movl 4(%esp),%eax\n\tmovw %ax,%fs\n\tret" )
|
||||
__ASM_GLOBAL_FUNC( __set_gs, "movl 4(%esp),%eax\n\tmovw %ax,%gs\n\tret" )
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
/* Nothing needs to be done. MS C make do with inline versions from the winnt.h */
|
||||
#else /* defined(_MSC_VER) */
|
||||
|
||||
#define __DEFINE_GET_SEG(seg) \
|
||||
__ASM_GLOBAL_FUNC( __get_##seg, "movw %" #seg ",%ax\n\tret" )
|
||||
#define __DEFINE_SET_SEG(seg) \
|
||||
__ASM_GLOBAL_FUNC( __set_##seg, "movl 4(%esp),%eax\n\tmovw %ax,%" #seg "\n\tret" )
|
||||
|
||||
__DEFINE_GET_SEG(cs)
|
||||
__DEFINE_GET_SEG(ds)
|
||||
__DEFINE_GET_SEG(es)
|
||||
__DEFINE_GET_SEG(fs)
|
||||
__DEFINE_GET_SEG(gs)
|
||||
__DEFINE_GET_SEG(ss)
|
||||
__DEFINE_SET_SEG(fs)
|
||||
__DEFINE_SET_SEG(gs)
|
||||
|
||||
#undef __DEFINE_GET_SEG
|
||||
#undef __DEFINE_SET_SEG
|
||||
|
||||
#endif /* defined(_MSC_VER) */
|
||||
#endif /* defined(__i386__) */
|
||||
|
|
|
@ -228,6 +228,7 @@ int SYSDEPS_SpawnThread( TEB *teb )
|
|||
*/
|
||||
void SYSDEPS_CallOnStack( void (*func)(LPVOID), LPVOID arg ) WINE_NORETURN;
|
||||
#ifdef __i386__
|
||||
#ifdef __GNUC__
|
||||
__ASM_GLOBAL_FUNC( SYSDEPS_CallOnStack,
|
||||
"movl 4(%esp),%ecx\n\t" /* func */
|
||||
"movl 8(%esp),%edx\n\t" /* arg */
|
||||
|
@ -236,13 +237,25 @@ __ASM_GLOBAL_FUNC( SYSDEPS_CallOnStack,
|
|||
"xorl %ebp,%ebp\n\t"
|
||||
"call *%ecx\n\t"
|
||||
"int $3" /* we never return here */ );
|
||||
#else
|
||||
#elif defined(_MSC_VER)
|
||||
__declspec(naked) void SYSDEPS_CallOnStack( void (*func)(LPVOID), LPVOID arg )
|
||||
{
|
||||
__asm mov ecx, 4[esp];
|
||||
__asm mov edx, 8[esp];
|
||||
__asm mov fs:[0x04], esp;
|
||||
__asm push edx;
|
||||
__asm xor ebp, ebp;
|
||||
__asm call [ecx];
|
||||
__asm int 3;
|
||||
}
|
||||
#endif /* defined(__GNUC__) || defined(_MSC_VER) */
|
||||
#else /* defined(__i386__) */
|
||||
void SYSDEPS_CallOnStack( void (*func)(LPVOID), LPVOID arg )
|
||||
{
|
||||
func( arg );
|
||||
while(1); /* avoid warning */
|
||||
}
|
||||
#endif
|
||||
#endif /* defined(__i386__) */
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -279,7 +292,7 @@ void SYSDEPS_ExitThread( int status )
|
|||
close( teb->reply_fd );
|
||||
close( teb->request_fd );
|
||||
teb->stack_low = get_temp_stack();
|
||||
teb->stack_top = teb->stack_low + TEMP_STACK_SIZE;
|
||||
teb->stack_top = (char *) teb->stack_low + TEMP_STACK_SIZE;
|
||||
SYSDEPS_CallOnStack( cleanup_thread, &info );
|
||||
}
|
||||
|
||||
|
@ -312,11 +325,7 @@ void SYSDEPS_AbortThread( int status )
|
|||
#if defined(__i386__) && defined(__GNUC__)
|
||||
__ASM_GLOBAL_FUNC( NtCurrentTeb, ".byte 0x64\n\tmovl 0x18,%eax\n\tret" );
|
||||
#elif defined(__i386__) && defined(_MSC_VER)
|
||||
__declspec(naked) struct _TEB * WINAPI NtCurrentTeb(void)
|
||||
{
|
||||
__asm mov eax, fs:[0x18];
|
||||
__asm ret;
|
||||
}
|
||||
/* Nothing needs to be done. MS C "magically" exports the inline version from winnt.h */
|
||||
#elif defined(HAVE__LWP_CREATE)
|
||||
/***********************************************************************
|
||||
* NtCurrentTeb (NTDLL.@)
|
||||
|
|
|
@ -36,9 +36,13 @@
|
|||
#include "build.h"
|
||||
|
||||
#ifdef __i386__
|
||||
#ifdef _MSC_VER
|
||||
extern unsigned short __get_cs(void) { unsigned short res; __asm { mov res, cs } return res; }
|
||||
#else
|
||||
extern unsigned short __get_cs(void);
|
||||
__ASM_GLOBAL_FUNC( __get_cs, "movw %cs,%ax\n\tret" );
|
||||
#endif /* __i386__ */
|
||||
#endif /* defined(_MSC_VER) */
|
||||
#endif /* defined(__i386__) */
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
|
|
Loading…
Reference in New Issue