Date: Wed, 15 Jan 2003 03:17:06 +0100 From: Thomas Moestl <tmoestl@gmx.net> To: John Polstra <jdp@polstra.com> Cc: sparc@freebsd.org Subject: Re: Sparc64 floating point questions Message-ID: <20030115021706.GA5902@crow.dom2ip.de> In-Reply-To: <200301150047.h0F0lNFc037477@vashon.polstra.com> References: <XFMail.20030114144825.jdp@polstra.com> <20030115003013.GA3536@crow.dom2ip.de> <200301150047.h0F0lNFc037477@vashon.polstra.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 2003/01/14 at 16:47:23 -0800, John Polstra wrote: > In article <20030115003013.GA3536@crow.dom2ip.de>, > Thomas Moestl <tmoestl@gmx.net> wrote: > > On Tue, 2003/01/14 at 14:48:25 -0800, John Polstra wrote: > > > I need to find out how to do that. It > > > looks like if I save and restore the FSR and the FPRS and %q0 through > > > %q60, that will do it. Am I missing anything? > > > > Yes, that should do it. > > Good, and thanks. 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 - Thomas -- Thomas Moestl <tmoestl@gmx.net> http://www.tu-bs.de/~y0015675/ <tmm@FreeBSD.org> http://people.FreeBSD.org/~tmm/ PGP fingerprint: 1C97 A604 2BD0 E492 51D0 9C0F 1FE6 4F1D 419C 776C To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-sparc" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030115021706.GA5902>