From owner-freebsd-current Fri May 4 5: 2:28 2001 Delivered-To: freebsd-current@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 5750437B424 for ; Fri, 4 May 2001 05:02:24 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id WAA05727; Fri, 4 May 2001 22:02:17 +1000 Date: Fri, 4 May 2001 21:59:45 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Daniel Eischen Cc: current@FreeBSD.ORG Subject: Re: Rfork'd threads, signals, and LDTs In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Wed, 2 May 2001, Daniel Eischen wrote: > On Wed, 2 May 2001, Bruce Evans wrote: > > > I am planning on using %fs for TSD/KSD and want it to be valid > > > in signal handlers. > > > > Imagine doing the same thing with %ds, or better yet, %ss. %ss must > > be set to the default for the kernel to even provide a "normal" stack > > for the signal handler. Similarly for %ds, except it is possible for > > signal handlers to set up their own %ds as necessary provided both > > the user code and the signal trampoline is written to avoid using %ds > > before initializing it. > > Well, we're not using %ds or %ss for TSD. It was discussed on Someone else might :-). > -arch some time ago that we would reserve %fs for TSD, so we > really on care about that case. I threw in %gs because that > was also an option except that WINE used it. > > [ patch snipped ] > > > There is also the osendsig() case, and corresponding code in several > > emulators. > > I don't think we care too much about osendsig() since anything > that uses a new threads library will have to be recompiled > and wouldn't use the old routines. I think the same is true > for emulators; an application that used the new threads library > wouldn't be running in emulation would it? A library running under an emulator might. Non-emulated Linux seems to pass %fs and %gs to signal handlers unchanged, so there is a precedent for doing things like you want. Go ahead. The Linux emulator certainly needs to do it the same as Linux. > So, what if we just make the change for %fs. Or is there a way > to tell the kernel "Hey, I don't want %fs to be changed" when > setting up the signal handler? A flag to sigaction sa_flags? > > The other option is for the userland signal handler to fetch > the value for %fs out of the sigcontext^Wucontext and manually > set it. But this gets icky because now the threads library has > to have arch-dependent signal handlers. Setting arch-dependent sigaction flags might be icky too. Add some later if the default behaviour causes problems. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message