From 562adf789066f0bbcd2999944a2648b42e8e8df9 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Tue, 16 May 2006 03:14:24 +0000 Subject: * sigproc.cc (no_signals_available): Detect hwait_sig == INVALID_HANDLE_VALUE. (wait_sig): Set hwait_sig to INVALID_HANDLE_VALUE on __SIGEXIT. * cygtls.cc (_cygtls::init_thread): Zero entire _my_tls structure and no more. * cygtls.h (_my_tls::padding): Delete. (CYGTLS_PADSIZE): Redefine concept of padding to mean padding at the end of the stack. * dcrt0.cc (initialize_main_tls): Change return to void. * gentls_offsets: Treat const specially, too. Keep going after a '}' is found. Change negative offset calculation to use CYGTLS_PADSIZE. * init.cc (_my_oldfunc): New variable. (threadfunc_fe): Use stored tls value for oldfunc rather than blindly writing to the stack. (munge_threadfunc): Set oldfunc in tls. (dll_entry): Initialize tls allocation. * tlsoffsets.h: Regenerate. --- winsup/cygwin/init.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/init.cc') diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc index f8b6cd652..f73be7236 100644 --- a/winsup/cygwin/init.cc +++ b/winsup/cygwin/init.cc @@ -18,6 +18,8 @@ details. */ #include #include "ntdll.h" +static DWORD _my_oldfunc; + int NO_COPY dynamically_loaded; static char NO_COPY *search_for = (char *) cygthread::stub; unsigned threadfunc_ix[8] __attribute__((section (".cygwin_dll_common"), shared)); @@ -30,7 +32,7 @@ threadfunc_fe (VOID *arg) { (void)__builtin_return_address(1); asm volatile ("andl $-16,%%esp" ::: "%esp"); - _cygtls::call ((DWORD (*) (void *, void *)) (((char **) _tlsbase)[OLDFUNC_OFFSET]), arg); + _cygtls::call ((DWORD (*) (void *, void *)) TlsGetValue (_my_oldfunc), arg); } /* If possible, redirect the thread entry point to a cygwin routine which @@ -62,7 +64,7 @@ munge_threadfunc () search_for = NULL; for (i = 0; threadfunc_ix[i]; i++) ebp[threadfunc_ix[i]] = (char *) threadfunc_fe; - ((char **) _tlsbase)[OLDFUNC_OFFSET] = threadfunc; + TlsSetValue (_my_oldfunc, threadfunc); } } } @@ -145,6 +147,7 @@ dll_entry (HANDLE h, DWORD reason, void *static_load) respawn_wow64_process (); dll_crt0_0 (); + _my_oldfunc = TlsAlloc (); break; case DLL_PROCESS_DETACH: break; -- cgit v1.2.3