Date: Thu, 2 Sep 1999 20:38:30 +0200 From: Juergen Lock <nox@jelal.kn-bremen.de> To: Luoqi Chen <luoqi@watermarkgroup.com> 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> In-Reply-To: <199909020501.BAA17295@lor.watermarkgroup.com> References: <199909020501.BAA17295@lor.watermarkgroup.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <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?19990902203830.A5073>