ntdll: Don't inline NtCurrentTeb() in Unix libraries.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-11-09 13:52:49 +01:00
parent 1ebf0f2b31
commit 988d9ddbf5
3 changed files with 18 additions and 6 deletions

View file

@ -1770,4 +1770,9 @@ __ASM_GLOBAL_FUNC( __wine_longjmp,
"mov r0, r1\n\t" /* retval */
"bx r2" )
/**********************************************************************
* NtCurrentTeb (NTDLL.@)
*/
__ASM_GLOBAL_FUNC( NtCurrentTeb, "mrc p15, 0, r0, c13, c0, 2; bx lr" )
#endif /* __arm__ */

View file

@ -2896,4 +2896,9 @@ __ASM_GLOBAL_FUNC( __wine_longjmp,
"movq 0x10(%rcx),%rsp\n\t" /* jmp_buf->Rsp */
"jmp *%rdx" )
/**********************************************************************
* NtCurrentTeb (NTDLL.@)
*/
__ASM_GLOBAL_FUNC( NtCurrentTeb, "movq %gs:0x30,%rax; ret" )
#endif /* __x86_64__ */

View file

@ -2223,14 +2223,14 @@ typedef struct _NT_TIB
struct _TEB;
#if defined(__i386__) && defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
#if defined(__i386__) && defined(__GNUC__) && !defined(WINE_UNIX_LIB)
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)
#elif defined(__i386__) && defined(_MSC_VER) && !defined(WINE_UNIX_LIB)
static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
{
struct _TEB *teb;
@ -2238,33 +2238,35 @@ static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
__asm mov teb, eax;
return teb;
}
#elif defined(__x86_64__) && defined(__GNUC__)
#elif defined(__x86_64__) && defined(__GNUC__) && !defined(WINE_UNIX_LIB)
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)
#elif defined(__x86_64__) && defined(_MSC_VER) && !defined(WINE_UNIX_LIB)
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__)
#elif defined(__arm__) && defined(__GNUC__) && !defined(WINE_UNIX_LIB)
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)
#elif defined(__arm__) && defined(_MSC_VER) && !defined(WINE_UNIX_LIB)
#pragma intrinsic(_MoveFromCoprocessor)
static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
{
return (struct _TEB *)(ULONG_PTR)_MoveFromCoprocessor(15, 0, 13, 0, 2);
}
#elif defined(__GNUC__)
extern struct _TEB * WINAPI NtCurrentTeb(void) __attribute__((pure));
#else
extern struct _TEB * WINAPI NtCurrentTeb(void);
#endif