Subject: Re: Status of math_emulate
To: Pierre Dubuc <pldubuc@yahoo.ca>
From: Martin Husemann <martin@duskware.de>
List: port-i386
Date: 02/25/2007 22:02:06
On Sun, Feb 25, 2007 at 02:56:28PM -0500, Pierre Dubuc wrote:
> No go. A bunch of daemons failed saying stuff about "no floating"
> available or something. On my 486, the MATH_EMULATE is absolutely
> mandatory for running even the basic stuff.
I have a 486 running without MATH_EMULATE. I just updated it's kernel to
current:
..
cpu0 at mainbus0: (uniprocessor)
cpu0: Intel 486DX (486-class)
..
npx0 at isa0 port 0xf0-0xff
npx0: using exception 16
..
then verified it has no MATH_EMULATE:
opt_math_emulate.h:/* option `MATH_EMULATE' not defined */
and then compiled and ran the following test program:
--8<--
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(int argc, char **argv)
{
char *endp;
double v;
if (argc < 2) return 1;
v = strtod(argv[1], &endp);
printf("v = %.5f, sqrt(v) = %.5f\n", v, sqrt(v));
return 0;
}
-->8--
I verified it used the fqsrt instruction:
0x804883e <main+18>: lea 0xfffffffc(%ebp),%eax
0x8048841 <main+21>: push %eax
0x8048842 <main+22>: mov 0xc(%ebp),%eax
0x8048845 <main+25>: pushl 0x4(%eax)
0x8048848 <main+28>: call 0x80484e8 <strtod@plt>
0x804884d <main+33>: fstl 0xfffffff0(%ebp)
0x8048850 <main+36>: fsqrt
and then ran it:
./a.out 25.23
v = 25.23000, sqrt(v) = 5.02295
Works just fine, no crash, as expected.
Is there some BIOS setting to disable the FPU on your machine?
Martin