Microsoft C related changes.

This commit is contained in:
Patrik Stridvall 2002-04-29 18:37:36 +00:00 committed by Alexandre Julliard
parent 9fe4deb7de
commit 441a7dcf7e
2 changed files with 27 additions and 6 deletions

View File

@ -69,6 +69,8 @@
# if defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) # if defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
# define __stdcall __attribute__((__stdcall__)) # define __stdcall __attribute__((__stdcall__))
# define __cdecl __attribute__((__cdecl__)) # define __cdecl __attribute__((__cdecl__))
# elif defined(_MSC_VER)
/* Nothing needs to be done. __cdecl/__stdcall already exists */
# else # else
# error You need gcc >= 2.7 to build Wine on a 386 # error You need gcc >= 2.7 to build Wine on a 386
# endif /* __GNUC__ */ # endif /* __GNUC__ */
@ -154,6 +156,14 @@
#define WINE_NORETURN /* nothing */ #define WINE_NORETURN /* nothing */
#endif #endif
#ifndef DECLSPEC_NORETURN
# if _MSVC_VER > 1200
# define DECLSPEC_NORETURN __declspec(noreturn)
# else
# define DECLSPEC_NORETURN
# endif
#endif
/* Anonymous union/struct handling */ /* Anonymous union/struct handling */
#ifdef __WINE__ #ifdef __WINE__
@ -1232,10 +1242,15 @@ typedef CONTEXT *PCONTEXT;
{ unsigned short res; __asm__("movw %%" #seg ",%w0" : "=r"(res)); return res; } { unsigned short res; __asm__("movw %%" #seg ",%w0" : "=r"(res)); return res; }
# define __DEFINE_SET_SEG(seg) \ # define __DEFINE_SET_SEG(seg) \
extern inline void __set_##seg(int val) { __asm__("movw %w0,%%" #seg : : "r" (val)); } extern inline void __set_##seg(int val) { __asm__("movw %w0,%%" #seg : : "r" (val)); }
# else /* __GNUC__ */ # 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; }
# define __DEFINE_SET_SEG(seg) \
extern inline void __set_##seg(unsigned short val) { __asm { mov seg, val } }
# else /* __GNUC__ || _MSC_VER */
# define __DEFINE_GET_SEG(seg) extern unsigned short __get_##seg(void); # define __DEFINE_GET_SEG(seg) extern unsigned short __get_##seg(void);
# define __DEFINE_SET_SEG(seg) extern void __set_##seg(unsigned int); # define __DEFINE_SET_SEG(seg) extern void __set_##seg(unsigned int);
# endif /* __GNUC__ */ # endif /* __GNUC__ || _MSC_VER */
#else /* __i386__ */ #else /* __i386__ */
# define __DEFINE_GET_SEG(seg) inline static unsigned short __get_##seg(void) { return 0; } # define __DEFINE_GET_SEG(seg) inline static unsigned short __get_##seg(void) { return 0; }
# define __DEFINE_SET_SEG(seg) /* nothing */ # define __DEFINE_SET_SEG(seg) /* nothing */
@ -2338,15 +2353,15 @@ typedef struct _NT_TIB
struct _TEB; struct _TEB;
#if defined(__i386__) && defined(__GNUC__) #if defined(__i386__) && defined(__GNUC__)
extern inline struct _TEB WINAPI *NtCurrentTeb(void); extern inline struct _TEB * WINAPI NtCurrentTeb(void);
extern inline struct _TEB WINAPI *NtCurrentTeb(void) extern inline struct _TEB * WINAPI NtCurrentTeb(void)
{ {
struct _TEB *teb; struct _TEB *teb;
__asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb)); __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
return teb; return teb;
} }
#else #else
extern struct _TEB WINAPI *NtCurrentTeb(void); extern struct _TEB * WINAPI NtCurrentTeb(void);
#endif #endif

View File

@ -309,8 +309,14 @@ void SYSDEPS_AbortThread( int status )
* *
* This will crash and burn if called before threading is initialized * This will crash and burn if called before threading is initialized
*/ */
#ifdef __i386__ #if defined(__i386__) && defined(__GNUC__)
__ASM_GLOBAL_FUNC( NtCurrentTeb, ".byte 0x64\n\tmovl 0x18,%eax\n\tret" ); __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;
}
#elif defined(HAVE__LWP_CREATE) #elif defined(HAVE__LWP_CREATE)
/*********************************************************************** /***********************************************************************
* NtCurrentTeb (NTDLL.@) * NtCurrentTeb (NTDLL.@)