From owner-freebsd-arch Mon Jan 7 16:59:38 2002 Delivered-To: freebsd-arch@freebsd.org Received: from elvis.mu.org (elvis.mu.org [216.33.66.196]) by hub.freebsd.org (Postfix) with ESMTP id 2373037B41A for ; Mon, 7 Jan 2002 16:59:35 -0800 (PST) Received: by elvis.mu.org (Postfix, from userid 1192) id A38F581E0B; Mon, 7 Jan 2002 18:59:29 -0600 (CST) Date: Mon, 7 Jan 2002 18:59:29 -0600 From: Alfred Perlstein To: Nate Williams Cc: Dan Eischen , Peter Wemm , Archie Cobbs , arch@FreeBSD.ORG Subject: Re: Request for review: getcontext, setcontext, etc Message-ID: <20020107185929.H18706@elvis.mu.org> References: <20020106232937.9F87D38CC@overcee.netplex.com.au> <3C390746.5FE7648C@vigrid.com> <15417.59947.662052.836634@caddis.yogotech.com> <20020107130208.E18706@elvis.mu.org> <15418.663.130281.835301@caddis.yogotech.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <15418.663.130281.835301@caddis.yogotech.com>; from nate@yogotech.com on Mon, Jan 07, 2002 at 01:18:31PM -0700 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 [020107 14:18] wrote: > > > > Well, one trick might be to do this: > > > > 1) Request that the OS turn off the FP enabled bit when running new > > threads. > > In userland threads, there is no way to turn it off on a thread basis, > so it's either on/off for the entire process. You read this wrong. The _pthreads library_ asks the kernel to turn off the bit when scheduling a new thread. > > 2) If you get an FP not present exception you mark that thread as > > using FP. > > At this point, we'd have to turn it on for all threads, since any future > thread that uses the context would also need to save/restore the > thread. (Since, FPU would be turned on for this 'process'.) The FPU may be turned on in the kernel context, however the userland context should be able to switch it back off after saving it itself. > > 3) In the threads scheduler and at context switch time between it (the > > thread) and any other thread not using FP you request the behavior > > of point #1. > > > > So you would only have a syscall when switching between FP and non-FP > > threads. > > > > Is this possible? > > In the future it may be possible, if we keep track of FP-usage on a > thread basis instead of a process basis. This requires kernel threads. No, as I stated above, I don't think this requires kernel threads. -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' Tax deductable donations for FreeBSD: http://www.freebsdfoundation.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message