Date: Wed, 1 Sep 1999 23:19:30 +0200 From: Juergen Lock <nox@jelal.kn-bremen.de> To: wine-patches@winehq.com Cc: freebsd-emulation@FreeBSD.ORG Subject: wine EXC_segv + thread signal stack fix Message-ID: <19990901231929.A5858@saturn.kn-bremen.de>
next in thread | raw e-mail | index | archive | help
Changelog:
* dlls/ntdll/exception.c: Juergen Lock <nox@jelal.kn-bremen.de>
fix EXC_segv for the TRAP_sig undefined case (eg FreeBSD)
* scheduler/sysdeps.c: Juergen Lock <nox@jelal.kn-bremen.de>
give threads their own signal stack (partial fix, handles only
the HAVE_WORKING_SIGALTSTACK case), without this all threads
signal handlers run on the same stack and could stomp on
each other...
Together with the %fs hack (which works around what seems to be a
FreeBSD bug, therefore posted seperately) this solves the 16bit problems
which i asked about a while ago.
Index: dlls/ntdll/exception.c
@@ -524,7 +524,7 @@
}
#else /* TRAP_sig */
# ifdef __i386
- if (INSTR_EmulateInstruction( &context )) return;
+ if (INSTR_EmulateInstruction( &context )) goto restore;
# endif
rec.ExceptionCode = EXCEPTION_ILLEGAL_INSTRUCTION; /* generic error */
#endif /* TRAP_sig */
Index: scheduler/sysdeps.c
@@ -134,7 +134,26 @@
*/
static void SYSDEPS_StartThread( TEB *teb )
{
+#ifdef HAVE_WORKING_SIGALTSTACK
+ struct sigaltstack ss;
+#endif /* HAVE_SIGALTSTACK */
SYSDEPS_SetCurThread( teb );
+#define SIGALTSTACKSIZE 16384
+#ifdef HAVE_WORKING_SIGALTSTACK
+ ss.ss_sp = malloc(SIGALTSTACKSIZE);
+ ss.ss_size = SIGALTSTACKSIZE;
+ ss.ss_flags = 0;
+ if (!ss.ss_sp || !sigaltstack(&ss, NULL) < 0)
+ {
+ perror("SYSDEPS_StartThread sigaltstack");
+ /* fall through on error and try it differently */
+ }
+#else
+ /*
+ * FIXME: fix this for linux
+ * (XXX does it need fixing on linux? I would believe so but i don't run it...)
+ */
+#endif /* HAVE_SIGALTSTACK */
CLIENT_InitThread();
teb->startup();
SYSDEPS_ExitThread(); /* should never get here */
Regards,
--
Juergen Lock <nox.foo@jelal.kn-bremen.de>
(remove dot foo from address to reply)
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-emulation" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990901231929.A5858>
