From owner-freebsd-arch Thu Jan 10 1: 0:58 2002 Delivered-To: freebsd-arch@freebsd.org Received: from rwcrmhc53.attbi.com (rwcrmhc53.attbi.com [204.127.198.39]) by hub.freebsd.org (Postfix) with ESMTP id 2DB7B37B420 for ; Thu, 10 Jan 2002 01:00:56 -0800 (PST) Received: from peter3.wemm.org ([12.232.27.13]) by rwcrmhc53.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020110090056.CKVA24940.rwcrmhc53.attbi.com@peter3.wemm.org> for ; Thu, 10 Jan 2002 09:00:56 +0000 Received: from overcee.netplex.com.au (overcee.wemm.org [10.0.0.3]) by peter3.wemm.org (8.11.0/8.11.0) with ESMTP id g0A90ts60491 for ; Thu, 10 Jan 2002 01:00:55 -0800 (PST) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by overcee.netplex.com.au (Postfix) with ESMTP id B28BC38CC; Thu, 10 Jan 2002 01:00:55 -0800 (PST) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: nate@yogotech.com (Nate Williams) Cc: Dan Eischen , Archie Cobbs , Alfred Perlstein , arch@FreeBSD.ORG Subject: Re: Request for review: getcontext, setcontext, etc In-Reply-To: <15417.59947.662052.836634@caddis.yogotech.com> Date: Thu, 10 Jan 2002 01:00:55 -0800 From: Peter Wemm Message-Id: <20020110090055.B28BC38CC@overcee.netplex.com.au> Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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