From owner-freebsd-emulation Sun Aug 29 7:25:29 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from iclub.nsu.ru (iclub.nsu.ru [193.124.222.66]) by hub.freebsd.org (Postfix) with ESMTP id 9496C15094 for ; Sun, 29 Aug 1999 07:25:10 -0700 (PDT) (envelope-from fjoe@iclub.nsu.ru) Received: from localhost (fjoe@localhost) by iclub.nsu.ru (8.9.3/8.9.3) with ESMTP id VAA08146 for ; Sun, 29 Aug 1999 21:24:47 +0700 (NSS) (envelope-from fjoe@iclub.nsu.ru) Date: Sun, 29 Aug 1999 21:24:46 +0700 (NSS) From: Max Khon To: emulation@freebsd.org Subject: dosemu Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org hi, there! Is there anyone successfully compiled dosemu under FreeBSD? /fjoe To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Sun Aug 29 7:55:31 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from atdot.dotat.org (atdot.dotat.org [150.101.89.3]) by hub.freebsd.org (Postfix) with ESMTP id 6DCB014C2F for ; Sun, 29 Aug 1999 07:55:20 -0700 (PDT) (envelope-from newton@atdot.dotat.org) Received: (from newton@localhost) by atdot.dotat.org (8.9.3/8.7) id AAA97632; Mon, 30 Aug 1999 00:19:06 +0930 (CST) From: Mark Newton Message-Id: <199908291449.AAA97632@atdot.dotat.org> Subject: Re: dosemu To: fjoe@iclub.nsu.ru (Max Khon) Date: Mon, 30 Aug 1999 00:19:05 +0930 (CST) Cc: emulation@FreeBSD.ORG In-Reply-To: from "Max Khon" at Aug 29, 99 09:24:46 pm X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Max Khon wrote: > Is there anyone successfully compiled dosemu under FreeBSD? "man doscmd" - mark -------------------------------------------------------------------- I tried an internal modem, newton@atdot.dotat.org but it hurt when I walked. Mark Newton ----- Voice: +61-4-1620-2223 ------------- Fax: +61-8-82231777 ----- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Sun Aug 29 22: 8:50 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from iclub.nsu.ru (iclub.nsu.ru [193.124.222.66]) by hub.freebsd.org (Postfix) with ESMTP id E2F4914CB6 for ; Sun, 29 Aug 1999 22:08:08 -0700 (PDT) (envelope-from fjoe@iclub.nsu.ru) Received: from localhost (fjoe@localhost) by iclub.nsu.ru (8.9.3/8.9.3) with ESMTP id MAA19131; Mon, 30 Aug 1999 12:04:13 +0700 (NSS) (envelope-from fjoe@iclub.nsu.ru) Date: Mon, 30 Aug 1999 12:04:13 +0700 (NSS) From: Max Khon To: Mark Newton Cc: emulation@FreeBSD.ORG Subject: Re: dosemu In-Reply-To: <199908291449.AAA97632@atdot.dotat.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org hi, there! On Mon, 30 Aug 1999, Mark Newton wrote: > > Is there anyone successfully compiled dosemu under FreeBSD? > > "man doscmd" I asked about dosemu, not doscmd doscmd does not support DPMI, right? /fjoe To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Sun Aug 29 23:50:54 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from dingo.cdrom.com (castles523.castles.com [208.214.165.87]) by hub.freebsd.org (Postfix) with ESMTP id 21063152BC for ; Sun, 29 Aug 1999 23:50:51 -0700 (PDT) (envelope-from mike@dingo.cdrom.com) Received: from dingo.cdrom.com (LOCALHOST [127.0.0.1]) by dingo.cdrom.com (8.9.3/8.8.8) with ESMTP id XAA17770; Sun, 29 Aug 1999 23:42:28 -0700 (PDT) (envelope-from mike@dingo.cdrom.com) Message-Id: <199908300642.XAA17770@dingo.cdrom.com> X-Mailer: exmh version 2.0.2 2/24/98 To: Max Khon Cc: Mark Newton , emulation@FreeBSD.ORG Subject: Re: dosemu In-reply-to: Your message of "Mon, 30 Aug 1999 12:04:13 +0700." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 29 Aug 1999 23:42:28 -0700 From: Mike Smith Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > hi, there! > > On Mon, 30 Aug 1999, Mark Newton wrote: > > > > Is there anyone successfully compiled dosemu under FreeBSD? > > > > "man doscmd" > > I asked about dosemu, not doscmd > doscmd does not support DPMI, right? No. As a general rule, emulating DOS is a dead science. I'd recommend you port your application to native FreeBSD, or use a comparable native application. -- \\ The mind's the standard \\ Mike Smith \\ of the man. \\ msmith@freebsd.org \\ -- Joseph Merrick \\ msmith@cdrom.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Mon Aug 30 0:18:39 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from m4.c2.telstra-mm.net.au (m4.c2.telstra-mm.net.au [24.192.3.19]) by hub.freebsd.org (Postfix) with ESMTP id 0FBD414DBD for ; Mon, 30 Aug 1999 00:18:34 -0700 (PDT) (envelope-from areilly@nsw.bigpond.net.au) Received: from m5.c2.telstra-mm.net.au (m5.c2.telstra-mm.net.au [24.192.3.20]) by m4.c2.telstra-mm.net.au (8.8.6 (PHNE_14041)/8.8.6) with ESMTP id RAA20268 for ; Mon, 30 Aug 1999 17:17:37 +1000 (EST) X-BPC-Relay-Envelope-From: areilly@nsw.bigpond.net.au X-BPC-Relay-Envelope-To: X-BPC-Relay-Sender-Host: m5.c2.telstra-mm.net.au [24.192.3.20] X-BPC-Relay-Info: Message delivered directly. Received: from areilly.bpc-users.org (CPE-24-192-49-170.nsw.bigpond.net.au [24.192.49.170]) by m5.c2.telstra-mm.net.au (8.8.6 (PHNE_14041)/8.8.6) with SMTP id RAA13282 for ; Mon, 30 Aug 1999 17:17:34 +1000 (EST) Received: (qmail 46440 invoked by uid 1000); 30 Aug 1999 07:17:35 -0000 From: "Andrew Reilly" Date: Mon, 30 Aug 1999 17:17:35 +1000 To: Mike Smith Cc: Max Khon , Mark Newton , emulation@FreeBSD.ORG Subject: Re: dosemu Message-ID: <19990830171735.A45268@gurney.reilly.home> References: <199908300642.XAA17770@dingo.cdrom.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.4i In-Reply-To: <199908300642.XAA17770@dingo.cdrom.com>; from Mike Smith on Sun, Aug 29, 1999 at 11:42:28PM -0700 Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Sun, Aug 29, 1999 at 11:42:28PM -0700, Mike Smith wrote: > > On Mon, 30 Aug 1999, Mark Newton wrote: > > > > > > Is there anyone successfully compiled dosemu under FreeBSD? > > > > > > "man doscmd" > > > > I asked about dosemu, not doscmd > > doscmd does not support DPMI, right? > > No. As a general rule, emulating DOS is a dead science. I'd recommend > you port your application to native FreeBSD, or use a comparable native > application. If that turns out not to be feasible, you might want to try Wine. Recent snapshots have a fair bit of support for DOS, or so says the doco. Also, a few command-line DOS tools have been re-jigged by their makers as Win32 console applications, and most of those _do_ run fine under Wine. I had to use a very recent egcs/gcc (gcc-2.95.1) to compile the most recent wine (Wine990815), because of some dubious calling convention stuff in some code generated during the build, but that's running fine, otherwise. -- Andrew To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Mon Aug 30 1: 1:47 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from iclub.nsu.ru (iclub.nsu.ru [193.124.222.66]) by hub.freebsd.org (Postfix) with ESMTP id 7EDFB15124 for ; Mon, 30 Aug 1999 01:00:33 -0700 (PDT) (envelope-from fjoe@iclub.nsu.ru) Received: from localhost (fjoe@localhost) by iclub.nsu.ru (8.9.3/8.9.3) with ESMTP id OAA23961; Mon, 30 Aug 1999 14:50:28 +0700 (NSS) (envelope-from fjoe@iclub.nsu.ru) Date: Mon, 30 Aug 1999 14:50:28 +0700 (NSS) From: Max Khon To: Mike Smith Cc: Mark Newton , emulation@FreeBSD.ORG Subject: Re: dosemu In-Reply-To: <199908300642.XAA17770@dingo.cdrom.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org hi, there! On Sun, 29 Aug 1999, Mike Smith wrote: > > > > Is there anyone successfully compiled dosemu under FreeBSD? > > > > > > "man doscmd" > > > > I asked about dosemu, not doscmd > > doscmd does not support DPMI, right? > > No. As a general rule, emulating DOS is a dead science. dosemu builds under NetBSD and it is said (in dosemu docs) that it probably can be built under FreeBSD. I tried this but with no luck. That's why I asked here about dosemu. > I'd recommend > you port your application to native FreeBSD, or use a comparable native > application. It would be quit hard and I have no docs on hardware (this is an ISA card which allows to store >2G on 180 min. video casette) /fjoe To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Mon Aug 30 1:41:50 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from dingo.cdrom.com (castles523.castles.com [208.214.165.87]) by hub.freebsd.org (Postfix) with ESMTP id E08DD1586C for ; Mon, 30 Aug 1999 01:41:38 -0700 (PDT) (envelope-from mike@dingo.cdrom.com) Received: from dingo.cdrom.com (LOCALHOST [127.0.0.1]) by dingo.cdrom.com (8.9.3/8.8.8) with ESMTP id BAA18522; Mon, 30 Aug 1999 01:31:11 -0700 (PDT) (envelope-from mike@dingo.cdrom.com) Message-Id: <199908300831.BAA18522@dingo.cdrom.com> X-Mailer: exmh version 2.0.2 2/24/98 To: Max Khon Cc: Mark Newton , emulation@FreeBSD.ORG Subject: Re: dosemu In-reply-to: Your message of "Mon, 30 Aug 1999 14:50:28 +0700." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 30 Aug 1999 01:31:11 -0700 From: Mike Smith Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > > > I asked about dosemu, not doscmd > > > doscmd does not support DPMI, right? > > > > No. As a general rule, emulating DOS is a dead science. > > dosemu builds under NetBSD and it is said (in dosemu docs) that it > probably can be built under FreeBSD. I tried this but with no luck. > That's why I asked here about dosemu. Dosemu once used to build under NetBSD; I'm not sure that it still does (last time I spoke with John Kohl I got the impression that making it work was a once-off thing). > > I'd recommend > > you port your application to native FreeBSD, or use a comparable native > > application. > > It would be quit hard and I have no docs on hardware (this is > an ISA card which allows to store >2G on 180 min. video casette) The hardware is unlikely to work correctly under emulation anyway. I think I'm reasonably familiar with the hardware in question, and you would do well to just give up now and get a real backup device. -- \\ The mind's the standard \\ Mike Smith \\ of the man. \\ msmith@freebsd.org \\ -- Joseph Merrick \\ msmith@cdrom.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message 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 From owner-freebsd-emulation Wed Sep 1 15:13:37 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 80AE414F71 for ; Wed, 1 Sep 1999 15:13:11 -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 AAA13467; Thu, 2 Sep 1999 00:07:01 +0200 Received: (from nox@localhost) by saturn.kn-bremen.de (8.9.3/8.8.5) id AAA08306; Thu, 2 Sep 1999 00:02:46 +0200 (MET DST) From: Juergen Lock Date: Thu, 2 Sep 1999 00:02:46 +0200 To: wine-devel@winehq.com Cc: freebsd-emulation@FreeBSD.ORG Subject: wine signal handlers lose %fs on FreeBSD Message-ID: <19990902000245.A7319@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 Here's a strange one: Sometimes apparently wine's signal handlers receive %fs messed up (zeroed actually) and therefore crash/hang on FreeBSD (3.2-stable, wine current-cvs). Patch this and watch for `warn:seh:EXC_SaveContext teb=0xsomewhere teb_sel=something, fs=0, gs=foo' messages, teb_sel is what fs really should have been (and what is loaded back there after the message, so the program actually continues too.) Any idea/explanation from the experts? I have looked at the sources a bit but came up empty. (well i found out that fs and gs aren't set/used in the sigcontext struct for non-vm86 processes but wine knows that and simply uses the registers directly, and i couldn't find anything that looked like it would change them on the way into and out of the signal handler, or anywhere else in the kernel for that matter...) Btw could someone please subscribe this address to -emulation for me? freebsd-emulation-l@jelal.kn-bremen.de (which is a local mailpost alias in case anyone wonders, i prefer reading the lists with trn...) I mailed majordomo with this a while ago (and yes i did send the auth command back :) but alas, no messages. Index: dlls/ntdll/exception.c =================================================================== RCS file: /home/wine/wine/dlls/ntdll/exception.c,v retrieving revision 1.10 diff -u -u -r1.10 exception.c --- dlls/ntdll/exception.c 1999/08/01 14:54:16 1.10 +++ dlls/ntdll/exception.c 1999/09/01 16:21:49 @@ -152,7 +152,8 @@ EXCEPTION_RECORD newrec; DWORD res; - TRACE( "code=%lx flags=%lx\n", rec->ExceptionCode, rec->ExceptionFlags ); + /*TRACE( "code=%lx flags=%lx\n", rec->ExceptionCode, rec->ExceptionFlags );*/ + TRACE( "code=%lx flags=%lx, fs=%lx, gs=%lx\n", rec->ExceptionCode, rec->ExceptionFlags, (long)FS_reg(context), (long)GS_reg(context) ); if ((PROCESS_Current()->flags & PDB32_DEBUGGED) && (DEBUG_SendExceptionEvent( rec, TRUE ) == DBG_CONTINUE)) @@ -372,6 +373,28 @@ #else GET_FS( FS_reg(context) ); FS_reg(context) &= 0xffff; +#if 1 + { + extern TEB *THREAD_First; + TEB *teb = THREAD_First; + int pid = getpid(); + + while (teb) + { + if (teb->pid == pid) break; + teb = teb->next; + } + if (teb) { + if (teb->teb_sel != FS_reg(context)) { + WARN( "teb=%p teb_sel=%x, fs=%lx, gs=%lx\n", teb, (int)teb->teb_sel, (long)FS_reg(context), (long)GS_reg(context) ); + FS_reg(context) = teb->teb_sel; + SET_FS(teb->teb_sel); + } + } else { + WARN( "teb=%p, fs=%lx, gs=%lx\n", teb, (long)FS_reg(context), (long)GS_reg(context) ); + } + } +#endif #endif #ifdef GS_sig GS_reg(context) = LOWORD(GS_sig(sigcontext)); Index: include/thread.h =================================================================== RCS file: /home/wine/wine/include/thread.h,v retrieving revision 1.23 diff -u -u -r1.23 thread.h --- include/thread.h 1999/06/26 08:43:27 1.23 +++ include/thread.h 1999/09/01 16:21:54 @@ -71,6 +71,7 @@ /* The following are Wine-specific fields */ struct _TEB *next; /* Global thread list */ DWORD cleanup; /* Cleanup service handle */ + int pid; } TEB; /* Thread exception flags */ Index: scheduler/sysdeps.c =================================================================== RCS file: /home/wine/wine/scheduler/sysdeps.c,v retrieving revision 1.14 diff -u -u -r1.14 sysdeps.c --- scheduler/sysdeps.c 1999/06/22 11:43:43 1.14 +++ scheduler/sysdeps.c 1999/09/01 16:22:05 @@ -112,6 +112,11 @@ */ void SYSDEPS_SetCurThread( TEB *teb ) { +#if 1 + int pid = getpid(); + TRACE("teb %p, teb->teb_sel 0x%x, pid %d\n", teb, (int)teb->teb_sel, pid ); + teb->pid = pid; +#endif #ifdef __i386__ /* On the i386, the current thread is in the %fs register */ SET_FS( teb->teb_sel ); Thanx and 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 From owner-freebsd-emulation Wed Sep 1 22: 2:15 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from lor.watermarkgroup.com (lor.watermarkgroup.com [207.202.73.33]) by hub.freebsd.org (Postfix) with ESMTP id 0206F14D68 for ; Wed, 1 Sep 1999 22:02:11 -0700 (PDT) (envelope-from luoqi@watermarkgroup.com) Received: (from luoqi@localhost) by lor.watermarkgroup.com (8.8.8/8.8.8) id BAA17295; Thu, 2 Sep 1999 01:01:43 -0400 (EDT) (envelope-from luoqi) Date: Thu, 2 Sep 1999 01:01:43 -0400 (EDT) From: Luoqi Chen Message-Id: <199909020501.BAA17295@lor.watermarkgroup.com> To: nox@jelal.kn-bremen.de, wine-devel@winehq.com Subject: Re: wine signal handlers lose %fs on FreeBSD Cc: freebsd-emulation@FreeBSD.ORG Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > Here's a strange one: Sometimes apparently wine's signal handlers receive > %fs messed up (zeroed actually) and therefore crash/hang on FreeBSD > (3.2-stable, wine current-cvs). Patch this and watch for > `warn:seh:EXC_SaveContext teb=0xsomewhere teb_sel=something, fs=0, gs=foo' > messages, teb_sel is what fs really should have been (and what is loaded > back there after the message, so the program actually continues too.) > > Any idea/explanation from the experts? I have looked at the sources a bit > but came up empty. (well i found out that fs and gs aren't set/used in > the sigcontext struct for non-vm86 processes but wine knows that and simply > uses the registers directly, and i couldn't find anything that looked like > it would change them on the way into and out of the signal handler, or > anywhere else in the kernel for that matter...) > The kernel sets %fs to 0 during a context switch if it triggers a fault (protection fault or segment not present) and signals SIGBUS. Most likely the EXC_segv in your previous email is this signal. Unfortunately there is no easy way to know which %fs value is causing the fault (probably you could add a kernel printf, in file sys/i386/i386/trap.c, search for cpu_switch_load_fs). I took a brief look at the exception code, it probably would not work under 4.0-current because the kernel uses %fs and signal handlers are called with a default %fs value (the same as the default %ds). You might need to restore %fs from the value in sigcontext at beginning of your signal handlers (yes, fs in sigcontext is set for 4.0-current. Regarding this, we could change the kernel, both -current and -stable, so that fs/gs are always saved in sigcontext when the signal is delivered, and restored during the signal trampoline, hence a consistent interface to application authors). Alternatively, we could change the kernel to call signal handlers with the original fs. > Btw could someone please subscribe this address to -emulation for me? > freebsd-emulation-l@jelal.kn-bremen.de (which is a local mailpost alias > in case anyone wonders, i prefer reading the lists with trn...) > > I mailed majordomo with this a while ago (and yes i did send the auth > command back :) but alas, no messages. > This is a low traffic list, chances are there were no messages... -lq To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Thu Sep 2 1:54:33 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from mail.scc.nl (node1374.a2000.nl [62.108.19.116]) by hub.freebsd.org (Postfix) with ESMTP id 9A80614C39 for ; Thu, 2 Sep 1999 01:54:29 -0700 (PDT) (envelope-from freebsd-emulation@scc.nl) Received: (from daemon@localhost) by mail.scc.nl (8.9.3/8.9.3) id KAA30275 for emulation@FreeBSD.ORG; Thu, 2 Sep 1999 10:34:43 +0200 (CEST) (envelope-from freebsd-emulation@scc.nl) Received: from GATEWAY by dwarf.hq.scc.nl with netnews for emulation@FreeBSD.ORG (emulation@FreeBSD.ORG) To: emulation@FreeBSD.ORG Date: Thu, 02 Sep 1999 10:34:39 +0200 From: Marcel Moolenaar Message-ID: <37CE369F.60575559@scc.nl> Organization: SCC vof Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Minor changes to USER_LDT related code Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Hi, In order to implement the Linux modify_ldt syscall, I like to propose some changes to the current USER_LDT code. The changes are: 1) Don't make i386_get_ldt and i386_set_ldt static so they can be used by the linuxulator. 2) When ``option USER_LDT'' is not present, provide stubs for the functions. These simply return ENOSYS. 3) Add the proper prototypes to i386/include/sysarch.h For details see http://www.FreeBSD.org/~marcel/modify_ldt.diff Thanks, -- Marcel Moolenaar mailto:marcel@scc.nl SCC Internetworking & Databases http://www.scc.nl/ Amsterdam, The Netherlands tel: +31 20 4200655 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Thu Sep 2 5:21:17 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from faui11.informatik.uni-erlangen.de (faui11.informatik.uni-erlangen.de [131.188.31.2]) by hub.freebsd.org (Postfix) with ESMTP id DEBBA14C8B for ; Thu, 2 Sep 1999 05:20:35 -0700 (PDT) (envelope-from weigand@faui11.informatik.uni-erlangen.de) Received: (from weigand@localhost) by faui11.informatik.uni-erlangen.de (8.9.1/8.1.4-FAU) id OAA21251; Thu, 2 Sep 1999 14:18:21 +0200 (MET DST) Date: Thu, 2 Sep 1999 14:18:21 +0200 (MET DST) From: Ulrich Weigand Message-Id: <199909021218.OAA21251@faui11.informatik.uni-erlangen.de> To: nox@jelal.kn-bremen.de, wine-devel@winehq.com, luoqi@watermarkgroup.com Subject: Re: wine signal handlers lose %fs on FreeBSD Cc: freebsd-emulation@FreeBSD.ORG X-Sun-Charset: US-ASCII Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Luoqi Chen wrote: > > Here's a strange one: Sometimes apparently wine's signal handlers receive > > %fs messed up (zeroed actually) and therefore crash/hang on FreeBSD > > (3.2-stable, wine current-cvs). Patch this and watch for > > `warn:seh:EXC_SaveContext teb=0xsomewhere teb_sel=something, fs=0, gs=foo' > > messages, teb_sel is what fs really should have been (and what is loaded > > back there after the message, so the program actually continues too.) Well, this problem would seem to be caused by Wine. The problem is that while any Wine signal handler is running, %fs needs to be loaded with the value %fs had in the code that was interrupted by the signal *if that code is 32-bit*. If *16-bit* code was interrupted, however, %fs needs to be loaded with the value had at the time the switch from 32-bit to 16-bit took place (this value was saved at the time) ... The reason for this is that Wine, like 32-bit Windows, uses the %fs register to identify the current thread. On 16-bit Windows, however, %fs has no special meaning and is freely used by apps ... To achieve this, Wine calls a macro HANDLER_INIT() at the start of every signal handler which is supposed to set %fs correctly. This is defined as follows: #ifdef FS_sig #include "syslevel.h" #define HANDLER_INIT() \ do { int fs = IS_SELECTOR_SYSTEM(CS_sig(HANDLER_CONTEXT)) ? \ FS_sig(HANDLER_CONTEXT) : SYSLEVEL_Win16CurrentTeb; \ if (!fs) fs = SYSLEVEL_EmergencyTeb; \ SET_FS(fs); } while (0) #else #define HANDLER_INIT() /* nothing */ #endif The problem is that the second case (which is active only if FS_sig is undefined, meaning that the sigcontext structure doesn't contain the %fs value, like on FreeBSD) is clearly wrong. Try changing this to #define HANDLER_INIT() \ do { int fs; GET_FS(fs); fs &= 0xffff; \ if (!IS_SELECTOR_SYSTEM(CS_sig(HANDLER_CONTEXT))) \ fs = SYSLEVEL_Win16CurrentTeb; \ if (!fs) fs = SYSLEVEL_EmergencyTeb; \ SET_FS(fs); } while (0) \ > The kernel sets %fs to 0 during a context switch if it triggers a fault > (protection fault or segment not present) and signals SIGBUS. Most likely > the EXC_segv in your previous email is this signal. Unfortunately there > is no easy way to know which %fs value is causing the fault (probably you > could add a kernel printf, in file sys/i386/i386/trap.c, search for > cpu_switch_load_fs). This is probably not a problem for Wine. If I understand it correctly, this should trigger only if a 16-bit app running under Wine loads %fs with a selector that becomes invalid while still loaded (and on next context switch to that thread, the fault happens). In this case the app is broken anyway and the only thing Wine will want to do in the handler is to run the built-in debugger; for this the EmergencyTeb is enough ... > I took a brief look at the exception code, it probably would not work > under 4.0-current because the kernel uses %fs and signal handlers are > called with a default %fs value (the same as the default %ds). You might > need to restore %fs from the value in sigcontext at beginning of your > signal handlers (yes, fs in sigcontext is set for 4.0-current. Regarding > this, we could change the kernel, both -current and -stable, so that fs/gs > are always saved in sigcontext when the signal is delivered, and restored > during the signal trampoline, hence a consistent interface to application > authors). Alternatively, we could change the kernel to call signal handlers > with the original fs. Well, Wine can work with both ways, as long as there is way to find out what method the OS uses! What should we use as a check? Bye, Ulrich To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Thu Sep 2 8:10:36 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from pop111.ocn.ne.jp (pop111.ocn.ne.jp [202.234.233.71]) by hub.freebsd.org (Postfix) with ESMTP id B1B8615626 for ; Thu, 2 Sep 1999 08:10:31 -0700 (PDT) (envelope-from academy@academyjapan.co.jp) Received: from pop111.ocn.ne.jp by pop111.ocn.ne.jp (8.9.1a/OCN) id AAA20134; Fri, 3 Sep 1999 00:09:50 +0900 (JST) Date: Fri, 3 Sep 1999 00:09:50 +0900 (JST) Message-Id: <199909021509.AAA20134@pop111.ocn.ne.jp> From: =?ISO-2022-JP?B?QWNhZGVteSBKYXBhbn==?= To: =?ISO-2022-JP?B?ZnJlZWJzZC1lbXVsYXRpb25ARnJlZUJTRC5vcmd=?= X-Mailer: Direct Email v0.22 Subject: =?ISO-2022-JP?B?GyRCJUYlbCVTRUVPQyROJCpDTiRpJDshIRsoQkluZm8gb24gVmlkZW9waG9uZW==?= Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org こんにちわ、 これは便利! Here's a good news for you, ホテル、旅館、単身赴任、留学にも a news of the Videophone 最適なニュース! over the normal coloer telephone line. 今、世界で話題の簡単テレビ電話 All you have to do is just の紹介です。 connect this videophone with 自宅のテレビと電話につなぐだけで the telephone and television. TV電話に早変わり!(工事不要) which you have in your home. 電話代は、今までと同じです。 Telephone charge is the same as ever. 遠くの友人や家族と、顔を見ながら Face to face communication with distant 話せるので一安心!! your distant family 値段は一台で69,000円です。 Price per unit: 6,9000 yen 下をクリックしてみて下さい。 Please click left below. http://www.academyjapan.co.jp academy@academyjpan.co.jp アカデミー・ジャパン 担当:山本 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Thu Sep 2 10:43:36 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from lor.watermarkgroup.com (lor.watermarkgroup.com [207.202.73.33]) by hub.freebsd.org (Postfix) with ESMTP id 65D93155E5 for ; Thu, 2 Sep 1999 10:43:30 -0700 (PDT) (envelope-from luoqi@watermarkgroup.com) Received: (from luoqi@localhost) by lor.watermarkgroup.com (8.8.8/8.8.8) id NAA26555; Thu, 2 Sep 1999 13:38:15 -0400 (EDT) (envelope-from luoqi) Date: Thu, 2 Sep 1999 13:38:15 -0400 (EDT) From: Luoqi Chen Message-Id: <199909021738.NAA26555@lor.watermarkgroup.com> To: emulation@FreeBSD.ORG, marcel@scc.nl Subject: Re: Minor changes to USER_LDT related code Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > Hi, > > In order to implement the Linux modify_ldt syscall, I like to propose some > changes to the current USER_LDT code. The changes are: > > 1) Don't make i386_get_ldt and i386_set_ldt static so they can be > used by the linuxulator. > 2) When ``option USER_LDT'' is not present, provide stubs for the > functions. These simply return ENOSYS. > 3) Add the proper prototypes to i386/include/sysarch.h > > For details see http://www.FreeBSD.org/~marcel/modify_ldt.diff > Thanks, > > -- > Marcel Moolenaar mailto:marcel@scc.nl > SCC Internetworking & Databases http://www.scc.nl/ > Amsterdam, The Netherlands tel: +31 20 4200655 > I am in favor of calling generic sysarch() interface instead, it should be the only API outside world knows about. And there will be no need to do any of the three items you listed above. -lq To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Thu Sep 2 11:22:25 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from gaia.euronet.nl (gaia.euronet.nl [194.134.0.10]) by hub.freebsd.org (Postfix) with ESMTP id 3E8A2155E5 for ; Thu, 2 Sep 1999 11:22:19 -0700 (PDT) (envelope-from marcel@scc.nl) Received: from scones.sup.scc.nl (i208.ztm.euronet.nl [194.134.67.9]) by gaia.euronet.nl (8.8.8/8.8.8) with ESMTP id UAA08499; Thu, 2 Sep 1999 20:22:15 +0200 (MET DST) Received: from scc.nl (scones.sup.scc.nl [192.168.2.4]) by scones.sup.scc.nl (8.9.3/8.9.3) with ESMTP id UAA27349; Thu, 2 Sep 1999 20:22:13 +0200 (CEST) (envelope-from marcel@scc.nl) Message-ID: <37CEC055.3DEF49D@scc.nl> Date: Thu, 02 Sep 1999 20:22:13 +0200 From: Marcel Moolenaar Organization: SCC vof X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.2.5 i386) X-Accept-Language: en MIME-Version: 1.0 To: Luoqi Chen Cc: emulation@FreeBSD.ORG Subject: Re: Minor changes to USER_LDT related code References: <199909021738.NAA26555@lor.watermarkgroup.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Luoqi Chen wrote: > > 1) Don't make i386_get_ldt and i386_set_ldt static so they can be > > used by the linuxulator. > > 2) When ``option USER_LDT'' is not present, provide stubs for the > > functions. These simply return ENOSYS. > > 3) Add the proper prototypes to i386/include/sysarch.h > > > I am in favor of calling generic sysarch() interface instead, it should be > the only API outside world knows about. And there will be no need to do > any of the three items you listed above. Well, I don't like to redefine i386_get_ldt_args or i386_set_ldt_args in the Linuxulator, so I think (3) should be done anyway. Furthermore, using the sysarch() interface when USER_LDT is not defined will return EINVAL and not ENOSYS. That's a bit inconvenient because I can't tell which EINVAL should actually be ENOSYS. As a third remark, a kernel module is hardly "outside world" :-) Anyway, I see your point, but don't think the sysarch interface is what I need. -- Marcel Moolenaar mailto:marcel@scc.nl SCC Internetworking & Databases http://www.scc.nl/ The FreeBSD project mailto:marcel@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Thu Sep 2 12: 4: 4 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from lor.watermarkgroup.com (lor.watermarkgroup.com [207.202.73.33]) by hub.freebsd.org (Postfix) with ESMTP id 57A6215656 for ; Thu, 2 Sep 1999 12:03:59 -0700 (PDT) (envelope-from luoqi@watermarkgroup.com) Received: (from luoqi@localhost) by lor.watermarkgroup.com (8.8.8/8.8.8) id PAA27772; Thu, 2 Sep 1999 15:02:45 -0400 (EDT) (envelope-from luoqi) Date: Thu, 2 Sep 1999 15:02:45 -0400 (EDT) From: Luoqi Chen Message-Id: <199909021902.PAA27772@lor.watermarkgroup.com> To: luoqi@watermarkgroup.com, marcel@scc.nl Subject: Re: Minor changes to USER_LDT related code Cc: emulation@FreeBSD.ORG Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > Luoqi Chen wrote: > > > > 1) Don't make i386_get_ldt and i386_set_ldt static so they can be > > > used by the linuxulator. > > > 2) When ``option USER_LDT'' is not present, provide stubs for the > > > functions. These simply return ENOSYS. > > > 3) Add the proper prototypes to i386/include/sysarch.h > > > > > I am in favor of calling generic sysarch() interface instead, it should be > > the only API outside world knows about. And there will be no need to do > > any of the three items you listed above. > > Well, I don't like to redefine i386_get_ldt_args or i386_set_ldt_args in > the Linuxulator, so I think (3) should be done anyway. Furthermore, using > the sysarch() interface when USER_LDT is not defined will return EINVAL and > not ENOSYS. That's a bit inconvenient because I can't tell which EINVAL > should actually be ENOSYS. As a third remark, a kernel module is hardly > "outside world" :-) > I like your idea to merge i386_get_ldt_args and i386_set_ldt_args into one i386_ldt_args and make it public in sysarch.h. We probably also want to change sysarch and libc code to use it. With regard to the EINVAL return value, we could change it to EOPNOTSUPP and later map to ENOSYS in linuxulator. > Anyway, I see your point, but don't think the sysarch interface is what I > need. > Now do you think the sysarch() interface is still unusable? I feel strongly about externalize i386_get_ldt/i386_set_ldt, especially there is a standard API available and it takes very little effort to change the code to use it (5 more lines in your diff file). > -- > Marcel Moolenaar mailto:marcel@scc.nl > SCC Internetworking & Databases http://www.scc.nl/ > The FreeBSD project mailto:marcel@FreeBSD.org > -lq To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Thu Sep 2 12:35:21 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from gaia.euronet.nl (gaia.euronet.nl [194.134.0.10]) by hub.freebsd.org (Postfix) with ESMTP id C756D14E6F for ; Thu, 2 Sep 1999 12:35:17 -0700 (PDT) (envelope-from marcel@scc.nl) Received: from scones.sup.scc.nl (i102.ztm.euronet.nl [194.134.112.63]) by gaia.euronet.nl (8.8.8/8.8.8) with ESMTP id VAA10719; Thu, 2 Sep 1999 21:34:36 +0200 (MET DST) Received: from scc.nl (scones.sup.scc.nl [192.168.2.4]) by scones.sup.scc.nl (8.9.3/8.9.3) with ESMTP id VAA29975; Thu, 2 Sep 1999 21:34:33 +0200 (CEST) (envelope-from marcel@scc.nl) Message-ID: <37CED149.D460F9EB@scc.nl> Date: Thu, 02 Sep 1999 21:34:33 +0200 From: Marcel Moolenaar Organization: SCC vof X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.2.5 i386) X-Accept-Language: en MIME-Version: 1.0 To: Luoqi Chen Cc: emulation@FreeBSD.ORG Subject: Re: Minor changes to USER_LDT related code References: <199909021902.PAA27772@lor.watermarkgroup.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Luoqi Chen wrote: > I like your idea to merge i386_get_ldt_args and i386_set_ldt_args into one > i386_ldt_args and make it public in sysarch.h. We probably also want to > change sysarch and libc code to use it. With regard to the EINVAL return > value, we could change it to EOPNOTSUPP and later map to ENOSYS in > linuxulator. Agreed. > Now do you think the sysarch() interface is still unusable? I feel strongly > about externalize i386_get_ldt/i386_set_ldt, especially there is a standard > API available and it takes very little effort to change the code to use it > (5 more lines in your diff file). Yes, with such a change sysarch can be used. I'll prepare a new diff with the proper changes. Just to make sure: We change the sysarch() interface, because EOPNOTSUPP has not previously been returned, right? I'll send you the changes asap for a final review. Thanks, -- Marcel Moolenaar mailto:marcel@scc.nl SCC Internetworking & Databases http://www.scc.nl/ The FreeBSD project mailto:marcel@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Thu Sep 2 12:39:47 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from lor.watermarkgroup.com (lor.watermarkgroup.com [207.202.73.33]) by hub.freebsd.org (Postfix) with ESMTP id 54FB614E05 for ; Thu, 2 Sep 1999 12:39:42 -0700 (PDT) (envelope-from luoqi@watermarkgroup.com) Received: (from luoqi@localhost) by lor.watermarkgroup.com (8.8.8/8.8.8) id PAA28408; Thu, 2 Sep 1999 15:39:41 -0400 (EDT) (envelope-from luoqi) Date: Thu, 2 Sep 1999 15:39:41 -0400 (EDT) From: Luoqi Chen Message-Id: <199909021939.PAA28408@lor.watermarkgroup.com> To: luoqi@watermarkgroup.com, marcel@scc.nl Subject: Re: Minor changes to USER_LDT related code Cc: emulation@FreeBSD.ORG Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > Yes, with such a change sysarch can be used. I'll prepare a new diff with > the proper changes. Great! > Just to make sure: We change the sysarch() interface, because EOPNOTSUPP > has not previously been returned, right? > Yes. > I'll send you the changes asap for a final review. > Thanks, > Do you want me to make changes to sysarch.h? I plan to add i386_ioperm_args and i386_vm86_args as well, make appropriate changes to sys_machdep.c and libc. > -- > Marcel Moolenaar mailto:marcel@scc.nl > SCC Internetworking & Databases http://www.scc.nl/ > The FreeBSD project mailto:marcel@FreeBSD.org > -lq To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Thu Sep 2 12:46: 5 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 65F1D14E05 for ; Thu, 2 Sep 1999 12:45:53 -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 VAA04404; Thu, 2 Sep 1999 21:40:09 +0200 Received: (from nox@localhost) by saturn.kn-bremen.de (8.9.3/8.8.5) id UAA05859; Thu, 2 Sep 1999 20:38:30 +0200 (MET DST) From: Juergen Lock Date: Thu, 2 Sep 1999 20:38:30 +0200 To: Luoqi Chen Cc: nox@jelal.kn-bremen.de, wine-devel@winehq.com, freebsd-emulation@FreeBSD.ORG Subject: Re: wine signal handlers lose %fs on FreeBSD Message-ID: <19990902203830.A5073@saturn.kn-bremen.de> References: <199909020501.BAA17295@lor.watermarkgroup.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.7i In-Reply-To: <199909020501.BAA17295@lor.watermarkgroup.com> Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Thu, Sep 02, 1999 at 01:01:43AM -0400, Luoqi Chen wrote: > > Here's a strange one: Sometimes apparently wine's signal handlers receive > > %fs messed up (zeroed actually) and therefore crash/hang on FreeBSD > > (3.2-stable, wine current-cvs). Patch this and watch for > > `warn:seh:EXC_SaveContext teb=0xsomewhere teb_sel=something, fs=0, gs=foo' > > messages, teb_sel is what fs really should have been (and what is loaded > > back there after the message, so the program actually continues too.) > > > > Any idea/explanation from the experts? I have looked at the sources a bit > > but came up empty. (well i found out that fs and gs aren't set/used in > > the sigcontext struct for non-vm86 processes but wine knows that and simply > > uses the registers directly, and i couldn't find anything that looked like > > it would change them on the way into and out of the signal handler, or > > anywhere else in the kernel for that matter...) > > > The kernel sets %fs to 0 during a context switch if it triggers a fault > (protection fault or segment not present) and signals SIGBUS. Most likely > the EXC_segv in your previous email is this signal. Unfortunately there > is no easy way to know which %fs value is causing the fault (probably you > could add a kernel printf, in file sys/i386/i386/trap.c, search for > cpu_switch_load_fs). > I actually already put a printf there while searching for this, but it wasn't triggered. > I took a brief look at the exception code, it probably would not work > under 4.0-current because the kernel uses %fs and signal handlers are > called with a default %fs value (the same as the default %ds). You might > need to restore %fs from the value in sigcontext at beginning of your > signal handlers (yes, fs in sigcontext is set for 4.0-current. Regarding > this, we could change the kernel, both -current and -stable, so that fs/gs > are always saved in sigcontext when the signal is delivered, and restored > during the signal trampoline, hence a consistent interface to application > authors). That sounds useful, go for it... (and commit the LDT fix too while your at it please? :) > Alternatively, we could change the kernel to call signal handlers > with the original fs. Probably not necessary once fs is in sigcontext, tho one might want to do it for backward compatibility. > > > Btw could someone please subscribe this address to -emulation for me? > > freebsd-emulation-l@jelal.kn-bremen.de (which is a local mailpost alias > > in case anyone wonders, i prefer reading the lists with trn...) > > > > I mailed majordomo with this a while ago (and yes i did send the auth > > command back :) but alas, no messages. > > > This is a low traffic list, chances are there were no messages... I doubt that, I believe it was _quite_ a while ago. (and no, this message didn't end up in my local.list.freebsd.emulation either, i only received the Cc.) > > -lq 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 From owner-freebsd-emulation Thu Sep 2 12:46: 8 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 A152C14D77 for ; Thu, 2 Sep 1999 12:45:34 -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 VAA04398; Thu, 2 Sep 1999 21:40:07 +0200 Received: (from nox@localhost) by saturn.kn-bremen.de (8.9.3/8.8.5) id VAA06598; Thu, 2 Sep 1999 21:09:26 +0200 (MET DST) From: Juergen Lock Date: Thu, 2 Sep 1999 21:09:26 +0200 To: Ulrich Weigand Cc: nox@jelal.kn-bremen.de, wine-devel@winehq.com, luoqi@watermarkgroup.com, freebsd-emulation@FreeBSD.ORG Subject: Re: wine signal handlers lose %fs on FreeBSD Message-ID: <19990902210926.B5073@saturn.kn-bremen.de> References: <199909021218.OAA21251@faui11.informatik.uni-erlangen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.7i In-Reply-To: <199909021218.OAA21251@faui11.informatik.uni-erlangen.de> Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Thu, Sep 02, 1999 at 02:18:21PM +0200, Ulrich Weigand wrote: > > Luoqi Chen wrote: > (That was me actually:) > > > Here's a strange one: Sometimes apparently wine's signal handlers receive > > > %fs messed up (zeroed actually) and therefore crash/hang on FreeBSD > > > (3.2-stable, wine current-cvs). Patch this and watch for > > > `warn:seh:EXC_SaveContext teb=0xsomewhere teb_sel=something, fs=0, gs=foo' > > > messages, teb_sel is what fs really should have been (and what is loaded > > > back there after the message, so the program actually continues too.) > > Well, this problem would seem to be caused by Wine. *DOH!* > The problem is > that while any Wine signal handler is running, %fs needs to be loaded > with the value %fs had in the code that was interrupted by the signal > *if that code is 32-bit*. If *16-bit* code was interrupted, however, > %fs needs to be loaded with the value had at the time the switch from > 32-bit to 16-bit took place (this value was saved at the time) ... > > The reason for this is that Wine, like 32-bit Windows, uses the %fs > register to identify the current thread. On 16-bit Windows, however, > %fs has no special meaning and is freely used by apps ... > > To achieve this, Wine calls a macro HANDLER_INIT() at the start of > every signal handler which is supposed to set %fs correctly. This is > defined as follows: > > #ifdef FS_sig > #include "syslevel.h" > #define HANDLER_INIT() \ > do { int fs = IS_SELECTOR_SYSTEM(CS_sig(HANDLER_CONTEXT)) ? \ > FS_sig(HANDLER_CONTEXT) : SYSLEVEL_Win16CurrentTeb; \ > if (!fs) fs = SYSLEVEL_EmergencyTeb; \ > SET_FS(fs); } while (0) > #else > #define HANDLER_INIT() /* nothing */ > #endif > > The problem is that the second case (which is active only if FS_sig > is undefined, meaning that the sigcontext structure doesn't contain > the %fs value, like on FreeBSD) is clearly wrong. Try changing this to > > #define HANDLER_INIT() \ > do { int fs; GET_FS(fs); fs &= 0xffff; \ > if (!IS_SELECTOR_SYSTEM(CS_sig(HANDLER_CONTEXT))) \ > fs = SYSLEVEL_Win16CurrentTeb; \ > if (!fs) fs = SYSLEVEL_EmergencyTeb; \ > SET_FS(fs); } while (0) \ > Heh. I did search the wine sources for SET_FS but seems i forgot its includes! Yes, looks like this is the real fix (after removing the last \) Thank you for restoring my confidence in FreeBSD's kernel... :) > > I took a brief look at the exception code, it probably would not work > > under 4.0-current because the kernel uses %fs and signal handlers are > > called with a default %fs value (the same as the default %ds). You might > > need to restore %fs from the value in sigcontext at beginning of your > > signal handlers (yes, fs in sigcontext is set for 4.0-current. Regarding > > this, we could change the kernel, both -current and -stable, so that fs/gs > > are always saved in sigcontext when the signal is delivered, and restored > > during the signal trampoline, hence a consistent interface to application > > authors). Alternatively, we could change the kernel to call signal handlers > > with the original fs. > > Well, Wine can work with both ways, as long as there is way to find > out what method the OS uses! What should we use as a check? True, there needs to be some way to find out whether the fs/gs in the sigcontext struct are for real or not... 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 From owner-freebsd-emulation Thu Sep 2 13:30:13 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from gaia.euronet.nl (gaia.euronet.nl [194.134.0.10]) by hub.freebsd.org (Postfix) with ESMTP id 62BE115016 for ; Thu, 2 Sep 1999 13:29:44 -0700 (PDT) (envelope-from marcel@scc.nl) Received: from scones.sup.scc.nl (i226.ztm.euronet.nl [194.134.67.27]) by gaia.euronet.nl (8.8.8/8.8.8) with ESMTP id WAA04635; Thu, 2 Sep 1999 22:29:08 +0200 (MET DST) Received: from scc.nl (scones.sup.scc.nl [192.168.2.4]) by scones.sup.scc.nl (8.9.3/8.9.3) with ESMTP id WAA02111; Thu, 2 Sep 1999 22:29:07 +0200 (CEST) (envelope-from marcel@scc.nl) Message-ID: <37CEDE13.E7A2A284@scc.nl> Date: Thu, 02 Sep 1999 22:29:07 +0200 From: Marcel Moolenaar Organization: SCC vof X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.2.5 i386) X-Accept-Language: en MIME-Version: 1.0 To: Luoqi Chen Cc: emulation@FreeBSD.ORG Subject: Re: Minor changes to USER_LDT related code References: <199909021939.PAA28408@lor.watermarkgroup.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Luoqi Chen wrote: > Do you want me to make changes to sysarch.h? I plan to add i386_ioperm_args > and i386_vm86_args as well, make appropriate changes to sys_machdep.c and > libc. I've already done it. If there's anything you wanted to do extra, let me know. The new diffs are: kernel changes: http://www.FreeBSD.org/~marcel/i386.diff libc changes: http://www.FreeBSD.org/~marcel/libc.diff -- Marcel Moolenaar mailto:marcel@scc.nl SCC Internetworking & Databases http://www.scc.nl/ The FreeBSD project mailto:marcel@FreeBSD.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Thu Sep 2 21:39:42 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from lor.watermarkgroup.com (lor.watermarkgroup.com [207.202.73.33]) by hub.freebsd.org (Postfix) with ESMTP id 74CC814F78 for ; Thu, 2 Sep 1999 21:39:38 -0700 (PDT) (envelope-from luoqi@watermarkgroup.com) Received: (from luoqi@localhost) by lor.watermarkgroup.com (8.8.8/8.8.8) id AAA02576; Fri, 3 Sep 1999 00:39:32 -0400 (EDT) (envelope-from luoqi) Date: Fri, 3 Sep 1999 00:39:32 -0400 (EDT) From: Luoqi Chen Message-Id: <199909030439.AAA02576@lor.watermarkgroup.com> To: luoqi@watermarkgroup.com, nox@jelal.kn-bremen.de, weigand@informatik.uni-erlangen.de, wine-devel@winehq.com Subject: Re: wine signal handlers lose %fs on FreeBSD Cc: freebsd-emulation@FreeBSD.ORG Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org > > > I took a brief look at the exception code, it probably would not work > > under 4.0-current because the kernel uses %fs and signal handlers are > > called with a default %fs value (the same as the default %ds). You might > > need to restore %fs from the value in sigcontext at beginning of your > > signal handlers (yes, fs in sigcontext is set for 4.0-current. Regarding > > this, we could change the kernel, both -current and -stable, so that fs/gs > > are always saved in sigcontext when the signal is delivered, and restored > > during the signal trampoline, hence a consistent interface to application > > authors). Alternatively, we could change the kernel to call signal handlers > > with the original fs. > > Well, Wine can work with both ways, as long as there is way to find > out what method the OS uses! What should we use as a check? > Use #if __FreeBSD__ >= 4 , define FS_sig in this case. -lq To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Fri Sep 3 8:13:41 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from smtp1.xs4all.nl (smtp1.xs4all.nl [194.109.127.48]) by hub.freebsd.org (Postfix) with ESMTP id 8103F14FD5; Fri, 3 Sep 1999 08:13:27 -0700 (PDT) (envelope-from arnout@tomcat.xs4all.nl) Received: from tomcat.xs4all.nl (tomcat.xs4all.nl [194.109.15.187]) by smtp1.xs4all.nl (8.9.3/8.9.3) with ESMTP id RAA06397; Fri, 3 Sep 1999 17:13:13 +0200 (CEST) Received: (from arnout@localhost) by tomcat.xs4all.nl (8.9.3/8.9.1) id RAA10998; Fri, 3 Sep 1999 17:16:27 +0200 (CEST) Date: Fri, 3 Sep 1999 17:16:27 +0200 From: Arnout Boer To: freebsd-emulation@freebsd.org, freebsd-stable@freebsd.org Subject: SO 5.1 and SMP under stable!? Message-ID: <19990903171627.B10976@tomcat.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.6i X-Operating-System: FreeBSD 3.3-RC i386 Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org I like to play with an office Suite under FreeBSD but SO doens't work onder an SMP stable kernel... StarOffice is ok.. It does crash frequently while playing with 'new things' but I like it.... A Free Office package on BSD is a plus! But can anybody tell me why it doesn't work ok a SMP kernel... I would like to play with it on my dual P200 instead of only one proc... Is there any change SMP changes will be ported to stable that make this work... Probably threags stuff.... I Think it's about problems with PosixThread vs SMP!? Btw.. I'm running STABLE 3.3 RC Single proc now because of SO :-( Greetz, Arnout p.s. If patches will be ported to stable I'll love to test them! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message From owner-freebsd-emulation Fri Sep 3 8:34:20 1999 Delivered-To: freebsd-emulation@freebsd.org Received: from lrcsun15.epfl.ch (lrcsun15.epfl.ch [128.178.156.77]) by hub.freebsd.org (Postfix) with ESMTP id C53F515078 for ; Fri, 3 Sep 1999 08:34:17 -0700 (PDT) (envelope-from julliard@lrcsun15.epfl.ch) Received: (from julliard@localhost) by lrcsun15.epfl.ch (8.8.X/EPFL-8.1a) id RAA23982; Fri, 3 Sep 1999 17:21:45 +0200 (MET DST) To: Luoqi Chen Cc: nox@jelal.kn-bremen.de, weigand@informatik.uni-erlangen.de, wine-devel@winehq.com, freebsd-emulation@FreeBSD.ORG Subject: Re: wine signal handlers lose %fs on FreeBSD References: <199909030439.AAA02576@lor.watermarkgroup.com> From: Alexandre Julliard Date: 03 Sep 1999 17:21:44 +0200 In-Reply-To: Luoqi Chen's message of "Fri, 3 Sep 1999 00:39:32 -0400 (EDT)" Message-ID: <1s4shcuik7.fsf@lrcsun15.epfl.ch> Lines: 10 X-Mailer: Gnus v5.5/XEmacs 20.4 - "Emerald" Sender: owner-freebsd-emulation@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Luoqi Chen writes: > Use #if __FreeBSD__ >= 4 , define FS_sig in this case. Doesn't work, since the same binary could be run under both FreeBSD 3 and FreeBSD 4. It needs to be checked at run-time. -- Alexandre Julliard julliard@lrc.epfl.ch To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message