* 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.
This commit is contained in:
@ -18,6 +18,8 @@ details. */
|
||||
#include <ntdef.h>
|
||||
#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;
|
||||
|
Reference in New Issue
Block a user