Return to BSD News archive
Newsgroups: comp.os.386bsd.questions Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!osuunx.ucc.okstate.edu!moe.ksu.ksu.edu!crcnis1.unl.edu!wupost!darwin.sura.net!howland.reston.ans.net!agate!headwall.Stanford.EDU!nntp.Stanford.EDU!leland.Stanford.EDU!yergeau From: yergeau@leland.Stanford.EDU (Dan Yergeau) Subject: Re: FPU in FreeBSD? Message-ID: <1993Nov10.190313.3060@leland.Stanford.EDU> Sender: news@leland.Stanford.EDU (Mr News) Organization: DSG, Stanford University, CA 94305, USA References: <2bo8s7$c0r@nic.lth.se> <almCG9C2t.C1q@netcom.com> <CGA75o.G9F@usenet.ucs.indiana.edu> Date: Wed, 10 Nov 93 19:03:13 GMT Lines: 58 In article <CGA75o.G9F@usenet.ucs.indiana.edu>, pitts@bigbang.astro.indiana.edu (Jim Pitts) writes: |> I have a quick question: |> |> FreeBSD-1.0-RELEASE |> |> XFree86-2.0 |> |> Do these packages use the numeric processor by default? If not, is it |> worth the effort to recompile so that it -does- use the FPU? Perhaps part of the confusion comes from the way FP is handled in the DOS world. So let's compare the two environments. DOS Most DOS compilers (real mode) have options to generate emulation code or code that will only run on machines with coprocessors. In '87 mode, they generate only FPU instructions and will hang or crash the machine in a real mode OS such as DOS (and even in an environment that doesn't provide a trap mechanism to get to an emulator such as Windoze). In emulator mode, they generate calls to the appropriate emulator routine and link in an emulation library with each executable. Usually, if the emulator detects a '87, the emulation routine will replace the call instruction (self-modifying code) with the equivalent FP instruction and resume execution. You pay a penalty the first time each "FP" instruction is hit, but after that it is almost the same as if you had generated '87 code if you have the numeric hardware. *BSD Under *BSD, the emulator is built into the OS, not a library attached to each executable. The compiler only generates FP instructions, and there is no attempt at modifying the code at runtime. If '87 hardware is NOT installed, then the CPU is smart enough to trap to the kernel route the missing instruction to the emulator. This trap-based emulation is typically slower than the direct call mechanism in the DOS world, but if you are running floating point intensive software under Unix, you should have the hardware. The problem is that emulator currently in *BSD only emulates a subset of the instructions in the real '87, so some files were compiled in a way such that GCC would not make certain optimizations and generate the missing instructions. This probably makes a negligible performance difference, but allows these programs (notably gcc) to run properly on machines without FP hardware. A better emulator is on its way, so these restrictions will not be needed in future releases. The packages do use the numeric processor. It is probably not worth the effort to recompile them to use the full instruction set of the '387. -- Dan Yergeau You are in a twisty little passage yergeau@gloworm.Stanford.EDU of standards, all conflicting. #include <std.disclaimer>