Messages in this thread | | | Date | Tue, 4 Aug 1998 09:14:54 -0400 (EDT) | From | "Richard B. Johnson" <> | Subject | Re: floating-point abuse in 2.1.113 |
| |
On Tue, 4 Aug 1998, Samuli Valo wrote:
> On Tue, 4 Aug 1998, Mikael Pettersson wrote: > > > Right. Floating-point is banned within the Linux kernel, yet some > > Uh... Just a stupid question... Why floating-point is banned? >
The state of the FPU is undefined within the kernel. You would have to add a 'FINIT' instruction before the actual FP code (the compiler won't do it for you). Further, if you have a FP fault that traps to the kernel's FP fault-handler, you probably generated a double-fault from which you can't recover. Further, if you use FP emulation such as for the '386, every ESCAPE (preamble for the FP code) generates a FP trap to the kernel emulator.
The undefined state comes about because, although FPU state is saved and then restored as part of the context-switch, the FPU is left as it was. It might have been calculating a FYL2XP1 (y * log2(x+1)) instruction which is interuptable, then the kernel code pushes two operands onto the FP unit's stack to perform a multiply. Not good.
Since the only "need" for float would be to perform some sort of scaling, fixed-point integers will always work.
Cheers, Dick Johnson ***** FILE SYSTEM MODIFIED ***** Penguin : Linux version 2.1.113 on an i586 machine (66.15 BogoMips). Warning : It's hard to remain at the trailing edge of technology.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html
| |