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