Subject: Re: Floating point in the kernel
To: Andrei Petrov <and@genesyslab.com>
From: Eduardo E. Horvath <eeh@one-o.com>
List: tech-kern
Date: 09/18/1998 14:27:09
On Fri, 18 Sep 1998, Andrei Petrov wrote:

> I would expect that kernel saves/restores user's FPU state so it should be
> safe just use FP in kernel mode assuming that you are the only part of kernel
> who does that. Don't know what to do with interrupts from FP in kernel mode.

No.

First of all it is not safe to do so.  Unless you know how floating pont
registers are managed you can cause all sorts of problems.  If the
registers are disabled then using them will cause a trap.  This may cause
the dirty contents to be stored away properly, or it may cause a panic.
Let's say you managed to get the registers saved off and enabled properly.
If you switch back to user mode with the registers enabled then you have a
silent user code data corruption.  If you disable the fp regs you need to
make sure that when user code attempts to access them again that the dirty
registers you created are not mistakenly written to some process' fp
register save area.  And then what happens if your code is pre-empted and
called back again?  Or someone else comes up with your brilliant idea and
wants to use fp code later?

=========================================================================
Eduardo Horvath				eeh@one-o.com
	"I need to find a pithy new quote." -- me