The previous technique was a gross hack peeking at the internals of the pthreads implementation.
Signed-off-by: Ken Thomases ken@codeweavers.com --- 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 5eca0432a06..e76e5be6aad 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.