Ken Thomases : ntdll: On Mac, use the Mach API as preferred approach to get a thread's GS.base.
Alexandre Julliard
julliard at winehq.org
Fri Sep 13 15:34:19 CDT 2019
Module: wine
Branch: master
Commit: 84760a8fb2cf9ed577c63957c5bdfc621d748a7f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=84760a8fb2cf9ed577c63957c5bdfc621d748a7f
Author: Ken Thomases <ken at codeweavers.com>
Date: Thu Sep 12 20:52:31 2019 -0500
ntdll: On Mac, use the Mach API as preferred approach to get a thread's GS.base.
The previous technique was a gross hack peeking at the internals of the pthreads
implementation.
Signed-off-by: Ken Thomases <ken at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/signal_x86_64.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index 5eca0432a0..e76e5be6aa 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -3204,9 +3204,18 @@ void signal_free_thread( TEB *teb )
*/
static void *mac_thread_gsbase(void)
{
+ struct thread_identifier_info tiinfo;
+ unsigned int info_count = THREAD_IDENTIFIER_INFO_COUNT;
static int gsbase_offset = -1;
void *ret;
+ kern_return_t kr = thread_info(mach_thread_self(), THREAD_IDENTIFIER_INFO, (thread_identifier_info_t) &tiinfo, &info_count);
+ if (kr == KERN_SUCCESS)
+ {
+ TRACE("pthread_self() %p thread ID %lx gsbase %lx\n", pthread_self(), tiinfo.thread_id, tiinfo.thread_handle);
+ return (void*)tiinfo.thread_handle;
+ }
+
if (gsbase_offset < 0)
{
/* Search for the array of TLS slots within the pthread data structure.
More information about the wine-cvs
mailing list