Module: wine Branch: master Commit: 56cfbf6b860b46768eeae60eef7dfe0a988c4df3 URL: https://gitlab.winehq.org/wine/wine/-/commit/56cfbf6b860b46768eeae60eef7dfe0...
Author: Alexandre Julliard julliard@winehq.org Date: Wed May 31 11:27:56 2023 +0200
include: Only enable the non-inline NtCurrentTeb() on the Unix side.
---
include/winnt.h | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/include/winnt.h b/include/winnt.h index 409dbceee59..c0967ac4459 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -2357,14 +2357,20 @@ typedef struct _NT_TIB
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) { struct _TEB *teb; __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (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) { struct _TEB *teb; @@ -2372,34 +2378,34 @@ static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) __asm mov teb, eax; 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) { struct _TEB *teb; __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (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); #pragma intrinsic(__readgsqword) static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) { 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) { struct _TEB *teb; __asm__("mrc p15, 0, %0, c13, c0, 2" : "=r" (teb)); return teb; } -#elif defined(__arm__) && defined(_MSC_VER) && !defined(WINE_UNIX_LIB) +#elif defined(__arm__) && defined(_MSC_VER) #pragma intrinsic(_MoveFromCoprocessor) static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) { 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"); static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) { @@ -2412,10 +2418,8 @@ static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void) { return (struct _TEB *)__getReg(18); } -#elif defined(__GNUC__) -extern struct _TEB * WINAPI NtCurrentTeb(void) __attribute__((pure)); -#else -extern struct _TEB * WINAPI NtCurrentTeb(void); +#elif !defined(RC_INVOKED) +# error You must define NtCurrentTeb() for your architecture #endif
#ifdef NONAMELESSUNION