Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jan 2002 01:00:55 -0800
From:      Peter Wemm <peter@wemm.org>
To:        nate@yogotech.com (Nate Williams)
Cc:        Dan Eischen <eischen@vigrid.com>, Archie Cobbs <archie@dellroad.org>, Alfred Perlstein <bright@mu.org>, arch@FreeBSD.ORG
Subject:   Re: Request for review: getcontext, setcontext, etc 
Message-ID:  <20020110090055.B28BC38CC@overcee.netplex.com.au>
In-Reply-To: <15417.59947.662052.836634@caddis.yogotech.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
Nate Williams wrote:
> > > Also, I noticed that the i386 patch doesn't save FP state (!) which is
> > > one of the primary reasons for get/setcontext().  I'm not sure if this
> > > can be efficiently done since this user-level function will not know if
> > > the current context has touched the FPU yet..
> > 
> > Neither does the kernel, does it?  I thought I saw comments in the
> > kernel (was it alpha?) about it being too bad that we couldn't tell
> > if the FPU was used.  In libc_r, we currently only save and restore the
> > FP state when the context is generated from a signal handler (or perhaps
> > in the case of KSEs, when the thread was preempted).
> 
> Hmm, IIRC, Java's green threads saves the FP context everytime it does a
> thread switch, since it has no way of knowing if the thread was doing FP
> context.  Is there a way to force get/setcontext to always/conditionally
> save the FP context, for applications that either know they need to have
> it saved?

Exactly the problem.  Userland cannot tell if it has touched FP or not
except by touching it.  This is where a system call is more efficient since
to save FP context you are doing trap recovery on top of doing the work.

Cheers,
-Peter
--
Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au
"All of this is for nothing if we don't go to the stars" - JMS/B5


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?20020110090055.B28BC38CC>