Module: wine Branch: master Commit: 2a5191a74ad9f1ad3ffde7e4aaa7e4ef8a0c8e44 URL: https://gitlab.winehq.org/wine/wine/-/commit/2a5191a74ad9f1ad3ffde7e4aaa7e4e...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Nov 10 10:18:15 2022 +0100
ntdll: Use a separate function pointer for the TEB hack on ARM64.
---
dlls/ntdll/ntdll.spec | 1 + dlls/ntdll/signal_arm64.c | 4 +++- dlls/ntdll/unix/loader.c | 10 +++++++--- dlls/ntdll/unixlib.h | 5 +---- 4 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index d9071bb826e..74e37fccbb6 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -1696,6 +1696,7 @@ @ stdcall __wine_ctrl_routine(ptr) @ extern __wine_syscall_dispatcher @ extern -arch=i386 __wine_ldt_copy +@ extern -arch=arm64 __wine_current_teb
# Debugging @ stdcall -syscall -norelay __wine_dbg_write(ptr long) diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c index f644816fb1c..76108f69c9f 100644 --- a/dlls/ntdll/signal_arm64.c +++ b/dlls/ntdll/signal_arm64.c @@ -40,6 +40,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(seh); WINE_DECLARE_DEBUG_CHANNEL(threadname);
+TEB * (* WINAPI __wine_current_teb)(void) = NULL; + typedef struct _SCOPE_TABLE { ULONG Count; @@ -1528,7 +1530,7 @@ __ASM_STDCALL_FUNC( DbgUserBreakPoint, 0, "brk #0xf000; ret" */ TEB * WINAPI NtCurrentTeb(void) { - return unix_funcs->NtCurrentTeb(); + return __wine_current_teb(); }
#endif /* __aarch64__ */ diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index 9f24aa5eb68..c25b373bc5e 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1071,6 +1071,13 @@ static void load_ntdll_functions( HMODULE module ) *p__wine_ldt_copy = &__wine_ldt_copy; } #endif +#ifdef __aarch64__ + { + void **p__wine_current_teb; + GET_FUNC( __wine_current_teb ); + *p__wine_current_teb = NtCurrentTeb; + } +#endif #undef GET_FUNC }
@@ -2149,9 +2156,6 @@ static struct unix_funcs unix_funcs = init_builtin_dll, unwind_builtin_dll, RtlGetSystemTimePrecise, -#ifdef __aarch64__ - NtCurrentTeb, -#endif };
diff --git a/dlls/ntdll/unixlib.h b/dlls/ntdll/unixlib.h index cb184431f82..fa5fad73980 100644 --- a/dlls/ntdll/unixlib.h +++ b/dlls/ntdll/unixlib.h @@ -26,7 +26,7 @@ struct _DISPATCHER_CONTEXT;
/* increment this when you change the function table */ -#define NTDLL_UNIXLIB_VERSION 134 +#define NTDLL_UNIXLIB_VERSION 135
struct unix_funcs { @@ -37,9 +37,6 @@ struct unix_funcs CONTEXT *context ); /* other Win32 API functions */ LONGLONG (WINAPI *RtlGetSystemTimePrecise)(void); -#ifdef __aarch64__ - TEB * (WINAPI *NtCurrentTeb)(void); -#endif };
#endif /* __NTDLL_UNIXLIB_H */