From owner-freebsd-emulation Wed Sep 1 15:13:33 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from blaubaer.kn-bremen.de (blaubaer.kn-bremen.de [195.37.179.254]) by hub.freebsd.org (Postfix) with ESMTP id E1BF6150FA for ; Wed, 1 Sep 1999 15:13:08 -0700 (PDT) (envelope-from nox@saturn.kn-bremen.de) Received: from saturn.kn-bremen.de (uucp@localhost) by blaubaer.kn-bremen.de (8.9.1/8.9.1) with UUCP id AAA13464; Thu, 2 Sep 1999 00:07:00 +0200 Received: (from nox@localhost) by saturn.kn-bremen.de (8.9.3/8.8.5) id XAA07311; Wed, 1 Sep 1999 23:19:30 +0200 (MET DST) From: Juergen Lock Date: Wed, 1 Sep 1999 23:19:30 +0200 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.7i Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Changelog: * dlls/ntdll/exception.c: Juergen Lock fix EXC_segv for the TRAP_sig undefined case (eg FreeBSD) * scheduler/sysdeps.c: Juergen Lock 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 (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