Subject: Re: Floating point in the kernel
To: Brian C. Grayson <firstname.lastname@example.org>
From: Chris G. Demetriou <email@example.com>
Date: 09/18/1998 16:08:40
"Brian C. Grayson" <firstname.lastname@example.org> writes:
> I don't know what I'm talking about :), but since the use of FP
> is going to be rare, would something based on the following
> work (after suitable extension to cover all the potential
> problems I'm missing, like avoiding corrupting the user's FP
> a) upon entry into any device routines that use FP, you first
> increment global_using_fpregs.
> b) upon exit from any device routines that use FP, you
> decrement global_using_fpregs (and panic if it is already
> c) in the main interrupt handler, if global_using_fpregs > 0,
> save the FP registers, otherwise you don't have to.
> Or is a scheme like this what you meant by ``very careful about
> saves and restores''? :)
That's part of an example -- not complete, I don't think -- of being
It's not just "global interrupt handler" for one. It's also the
syscall handler, etc. Also, even considering that, you have to be
very, very careful unless you want to save at every interrupt/syscall.
Just compiling code with FPU instructions enabled on some
architectures will cause the compiler to emit FP instructions, _even
if you aren't doing FP calculations_! (e.g. to move regions of
Chris Demetriou - email@example.com - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.
Plug: Get your official NetBSD-1.3.2 CDROM set today! http://www.netbsd.com/