Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Jan 2002 08:29:44 -0500
From:      Dan Eischen <eischen@vigrid.com>
To:        k Macy <kip_macy@yahoo.com>
Cc:        Peter Wemm <peter@wemm.org>, Julian Elischer <julian@vicor-nb.com>, deischen@FreeBSD.ORG, arch@FreeBSD.ORG
Subject:   Re: KSE question
Message-ID:  <3C515DC8.536C556@vigrid.com>
References:  <20020125082827.88543.qmail@web14005.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
k Macy wrote:
> 
> > > > In libc_r, we just use _setjmp and _longjmp. For KSE pthreads
> > > > I wanted to use getcontext and setcontext, and was the reason
> > > > I added them to -current.  I have to turn them into system
> > > > calls to satisfy Peter Wemm, but I plan on moving the assembler
> > > > files in libc to libpthread.
> 
> I apologize in advance if this is a stupid question,
> but would it be possible to make it a compile time
> option, or a pthread_set* function to have getcontext
> and setcontext be user-level functions for programs
> that don't use floating point?

In non-threaded programs, getcontext, setcontext, and
swapcontext always save and restore the signal mask, so
they would result in system call anyways.  The rationale
is that if you have to make a system call to set the mask,
you might as well make the whole function a system call
(and get/set the FPU state as well to avoid a subsequent
trap when trying to do it in userland).  See the long
thread in -arch about this.

In the threads library, we will probably have to overload
these functions anyways since they get and set the signal
mask (which have to be thread signal masks, not the process
signal mask).  They shouldn't result in system calls,
though they may cause a trap to the kernel when trying to
restore FPU state (but this should be limited to once per
timeslice).

-- 
Dan Eischen

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C515DC8.536C556>