From owner-freebsd-hackers@FreeBSD.ORG Fri Mar 9 10:21:28 2007 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.ORG Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E48AF16A402 for ; Fri, 9 Mar 2007 10:21:28 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8]) by mx1.freebsd.org (Postfix) with ESMTP id 4ECE213C49D for ; Fri, 9 Mar 2007 10:21:28 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (ipknwl@localhost [127.0.0.1]) by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id l29ALM8L067286; Fri, 9 Mar 2007 11:21:27 +0100 (CET) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.13.4/8.13.1/Submit) id l29ALLVw067285; Fri, 9 Mar 2007 11:21:21 +0100 (CET) (envelope-from olli) Date: Fri, 9 Mar 2007 11:21:21 +0100 (CET) Message-Id: <200703091021.l29ALLVw067285@lurza.secnetix.de> From: Oliver Fromme To: freebsd-hackers@FreeBSD.ORG, maslanbsd@gmail.com In-Reply-To: <319cceca0703090116p7e768630qd055be57bbe4953@mail.gmail.com> X-Newsgroups: list.freebsd-hackers User-Agent: tin/1.8.2-20060425 ("Shillay") (UNIX) (FreeBSD/4.11-STABLE (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Fri, 09 Mar 2007 11:21:27 +0100 (CET) Cc: Subject: Re: Floating-point in kernel space X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-hackers@FreeBSD.ORG, maslanbsd@gmail.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Mar 2007 10:21:29 -0000 Maslan 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