Date: Fri, 9 Mar 2007 11:21:21 +0100 (CET) From: Oliver Fromme <olli@lurza.secnetix.de> To: freebsd-hackers@FreeBSD.ORG, maslanbsd@gmail.com Subject: Re: Floating-point in kernel space Message-ID: <200703091021.l29ALLVw067285@lurza.secnetix.de> In-Reply-To: <319cceca0703090116p7e768630qd055be57bbe4953@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Maslan <maslanbsd@gmail.com> wrote: > I think i've seen somewhere but i don't remember that floating point > arithmetic is not allowed in kernel space, if that's right, can anyone > please tell why ??? Because the overhead of swapping the contents of the FPU registers on every context switch within the kernel. So far there has been no compelling reason for having FP support in kernel code that would justify to pay that price. > and why not not emulate the floating point in kernel space ??? First, FPU emulation is rather slow, and second, someone would have to write the code. In the past, the FreeBSD kernel had two FPU emulation libraries (for emulation of FPU instructions in userland). One was BSD-licensed, but incomplete and not 100% compatible, and the second was GPL, so it couldn't be enabled by default. As far as I know, both of them were removed because hardware without an FPU was considered obsolete, and nobody was willing to improve and maintain the code. Let me ask you, why would you want to have floating point support in the kernel? Most of such typical uses can easily be replaced by simple fixed-point arithmetic with integer instructions. There are several examples of such code, e.g. in ALTQ, DUMMYNET and in the NTP support code. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "I have stopped reading Stephen King novels. Now I just read C code instead." -- Richard A. O'Keefe
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200703091021.l29ALLVw067285>