On Fri, 30 Jul 1999, Greg Haerr wrote:
> I see. Does anyone have any code for auto-detection of an
> 8087/8287/8387?
>From allegro/src/cpu.c:
/* is_fpu:
* Returns TRUE is the CPU has floating point hardware.
*/
static int is_fpu()
{
int result;
asm (
" fninit ; "
" movl $0x5a5a, %%eax ; "
" fnstsw %%eax ; "
" cmpl $0, %%eax ; "
" jne 0f ; "
" movl $1, %%eax ; "
" jmp 1f ; "
" 0: "
" movl $0, %%eax ; "
" 1:"
: "=a" (result)
:
: "%eax", "memory"
);
return result;
}
--------------- Linux- the choice of a GNU generation. --------------
: Alex Holden (M1CJD)- Caver, Programmer, Land Rover nut, Radio Ham :
-------------------- http://www.linuxhacker.org/ --------------------