Commit 56cfbf6b authored by Alexandre Julliard's avatar Alexandre Julliard

include: Only enable the non-inline NtCurrentTeb() on the Unix side.

parent 0fac6bcf
...@@ -2357,14 +2357,20 @@ typedef struct _NT_TIB ...@@ -2357,14 +2357,20 @@ typedef struct _NT_TIB
struct _TEB; struct _TEB;
#if defined(__i386__) && defined(__GNUC__) && !defined(WINE_UNIX_LIB) #ifdef WINE_UNIX_LIB
# ifdef __GNUC__
struct _TEB * WINAPI NtCurrentTeb(void) __attribute__((pure));
# else
struct _TEB * WINAPI NtCurrentTeb(void);
# endif
#elif defined(__i386__) && defined(__GNUC__)
static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) static FORCEINLINE 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;
} }
#elif defined(__i386__) && defined(_MSC_VER) && !defined(WINE_UNIX_LIB) #elif defined(__i386__) && defined(_MSC_VER)
static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
{ {
struct _TEB *teb; struct _TEB *teb;
...@@ -2372,34 +2378,34 @@ static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) ...@@ -2372,34 +2378,34 @@ static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
__asm mov teb, eax; __asm mov teb, eax;
return teb; return teb;
} }
#elif defined(__x86_64__) && defined(__GNUC__) && !defined(WINE_UNIX_LIB) #elif defined(__x86_64__) && defined(__GNUC__)
static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
{ {
struct _TEB *teb; struct _TEB *teb;
__asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb)); __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb));
return teb; return teb;
} }
#elif defined(__x86_64__) && defined(_MSC_VER) && !defined(WINE_UNIX_LIB) #elif defined(__x86_64__) && defined(_MSC_VER)
unsigned __int64 __readgsqword(unsigned long); unsigned __int64 __readgsqword(unsigned long);
#pragma intrinsic(__readgsqword) #pragma intrinsic(__readgsqword)
static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
{ {
return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self)); return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self));
} }
#elif defined(__arm__) && defined(__GNUC__) && !defined(WINE_UNIX_LIB) #elif defined(__arm__) && defined(__GNUC__)
static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
{ {
struct _TEB *teb; struct _TEB *teb;
__asm__("mrc p15, 0, %0, c13, c0, 2" : "=r" (teb)); __asm__("mrc p15, 0, %0, c13, c0, 2" : "=r" (teb));
return teb; return teb;
} }
#elif defined(__arm__) && defined(_MSC_VER) && !defined(WINE_UNIX_LIB) #elif defined(__arm__) && defined(_MSC_VER)
#pragma intrinsic(_MoveFromCoprocessor) #pragma intrinsic(_MoveFromCoprocessor)
static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
{ {
return (struct _TEB *)(ULONG_PTR)_MoveFromCoprocessor(15, 0, 13, 0, 2); return (struct _TEB *)(ULONG_PTR)_MoveFromCoprocessor(15, 0, 13, 0, 2);
} }
#elif defined(__aarch64__) && defined(__MINGW32__) #elif defined(__aarch64__) && defined(__GNUC__)
register struct _TEB *__wine_current_teb __asm__("x18"); register struct _TEB *__wine_current_teb __asm__("x18");
static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
{ {
...@@ -2412,10 +2418,8 @@ static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) ...@@ -2412,10 +2418,8 @@ static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
{ {
return (struct _TEB *)__getReg(18); return (struct _TEB *)__getReg(18);
} }
#elif defined(__GNUC__) #elif !defined(RC_INVOKED)
extern struct _TEB * WINAPI NtCurrentTeb(void) __attribute__((pure)); # error You must define NtCurrentTeb() for your architecture
#else
extern struct _TEB * WINAPI NtCurrentTeb(void);
#endif #endif
#ifdef NONAMELESSUNION #ifdef NONAMELESSUNION
......
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