* dcrt0.cc (init_windows_system_directory): Record system_wow64_directory

information.
* exceptions.cc (_cygtls::inside_kernel): Modernize comment.  Consider
executing a DLL from the Wow64 directory as being "in the kernel".
(_cygtls::call_signal_handler): For now, only deal with main_tls signals if
main_tls is known to be executing in the cygwin DLL.  To more closely emulate
linux, consider the operation to be restartable if not executing in the main
thread.
* globals.cc (windows_system_directory): Remove NO_COPY.
(windows_system_directory_length): Ditto.
(system_wow64_directory): New variable.
(system_wow64_directory_length): Ditto.
* select.cc (cygwin_select): Don't issue a EINTR on non-main threads since that
seems to be what Linux does.  Add missing break to signal case/switch.
(select_stuff::wait): Don't issue a EINTR on non-main threads since that seems
to be what Linux does.  Remove now-unneeded accommodation for
WAIT_IO_COMPLETION.  Add a comment.
* sigproc.h (cygwait): Ditto.  Don't return if signal_received noticed and it's
not the main thread.
* signal.cc (sigprocmask): Add standard syscall debug stuff.
* thread.cc (pthread_sigmask): Ditto.
This commit is contained in:
Christopher Faylor
2011-12-13 20:06:31 +00:00
parent 8d1bda71b4
commit 45d7b637fa
8 changed files with 95 additions and 43 deletions

View File

@@ -326,10 +326,7 @@ _cygtls::inside_kernel (CONTEXT *cx)
memset (checkdir, 0, size);
# define h ((HMODULE) m.AllocationBase)
/* Apparently Windows 95 can sometimes return bogus addresses from
GetThreadContext. These resolve to a strange allocation base.
These should *never* be treated as interruptible. */
if (!h || m.State != MEM_COMMIT)
if (!h || m.State != MEM_COMMIT) /* Be defensive */
res = true;
else if (h == user_data->hmodule)
res = false;
@@ -340,8 +337,12 @@ _cygtls::inside_kernel (CONTEXT *cx)
/* Skip potential long path prefix. */
if (!wcsncmp (checkdir, L"\\\\?\\", 4))
checkdir += 4;
res = !wcsncasecmp (windows_system_directory, checkdir,
windows_system_directory_length);
res = wcsncasecmp (windows_system_directory, checkdir,
windows_system_directory_length) == 0;
if (!res && system_wow64_directory_length)
res = wcsncasecmp (system_wow64_directory, checkdir,
system_wow64_directory_length) == 0;
}
sigproc_printf ("pc %p, h %p, inside_kernel %d", cx->Eip, h, res);
# undef h
@@ -828,7 +829,6 @@ set_sig_errno (int e)
{
*_my_tls.errno_addr = e;
_my_tls.saved_errno = e;
// sigproc_printf ("errno %d", e);
}
static int setup_handler (int, void *, struct sigaction&, _cygtls *tls)
@@ -1328,9 +1328,9 @@ _cygtls::call_signal_handler ()
else if (this != _main_tls)
{
_main_tls->lock ();
if (_main_tls->sig)
if (_main_tls->sig && _main_tls->incyg)
{
paranoid_printf ("Redirecting to main_tls signal %d", _main_tls->sig);
small_printf ("Redirecting to main_tls signal %d", _main_tls->sig);
sig = _main_tls->sig;
sa_flags = _main_tls->sa_flags;
func = _main_tls->func;
@@ -1373,7 +1373,7 @@ _cygtls::call_signal_handler ()
}
unlock ();
return this_sa_flags & SA_RESTART;
return this_sa_flags & SA_RESTART || (this != _main_tls);
}
void