From owner-freebsd-sparc Thu Jan 16 18:16: 8 2003 Delivered-To: freebsd-sparc@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A12C237B401 for ; Thu, 16 Jan 2003 18:16:07 -0800 (PST) Received: from wall.polstra.com (wall-gw.polstra.com [206.213.73.130]) by mx1.FreeBSD.org (Postfix) with ESMTP id 67EDF43F1E for ; Thu, 16 Jan 2003 18:16:06 -0800 (PST) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.12.3/8.12.3) with ESMTP id h0H2G0u5014162 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Thu, 16 Jan 2003 18:16:01 -0800 (PST) (envelope-from jdp@vashon.polstra.com) Received: (from jdp@localhost) by vashon.polstra.com (8.12.5/8.12.5/Submit) id h0H2G0PZ040597; Thu, 16 Jan 2003 18:16:00 -0800 (PST) (envelope-from jdp) Date: Thu, 16 Jan 2003 18:16:00 -0800 (PST) Message-Id: <200301170216.h0H2G0PZ040597@vashon.polstra.com> To: sparc@freebsd.org From: John Polstra Cc: tmoestl@gmx.net Subject: Re: Sparc64 floating point questions In-Reply-To: <20030115021706.GA5902@crow.dom2ip.de> References: <20030115003013.GA3536@crow.dom2ip.de> <200301150047.h0F0lNFc037477@vashon.polstra.com> <20030115021706.GA5902@crow.dom2ip.de> Organization: Polstra & Co., Seattle, WA Sender: owner-freebsd-sparc@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org In article <20030115021706.GA5902@crow.dom2ip.de>, Thomas Moestl wrote: > > Oh, I should have mentioned that %fprs is a bit special; the kernel > uses the FEF bit to test whether floating point support is enabled for > the process, and will only save the state across context switches in > that case. It will also lazily restore the context, i.e. it will > disable the FEF bit and reload the registers only when the process > uses floating point operations for the next time (which triggers an > exception in that case). > That means that %fprs must be restored first, otherwise this might > clear FEF and cause stale values to be reloaded later. > In fact, you do not need to save it at all; the only other bits in > that register are the DU (upper fp register file half dirty) and DL > (lower half dirty) bits, which are automatically maintained. > For performance, it would probably be best to always just set the FEF > bit before reloading the other registers (this is not required > though), like: > > wr %g0, FPRS_FEF, %fprs I'm a little bit confused about this. Won't the instruction above clear the DU and DL bits? And isn't that a bad thing to do? It seems like the state maintained in those bits is per-process rather than per-thread. John -- John Polstra John D. Polstra & Co., Inc. Seattle, Washington USA "Disappointment is a good sign of basic intelligence." -- Chögyam Trungpa To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-sparc" in the body of the message