180,165 → 180,12 |
} |
#endif |
|
#if defined( __OS2__ ) |
|
void __chk8087( void ) |
/********************/ |
{ |
char devinfo; |
|
#if defined( __386__ ) |
DosDevConfig( &devinfo, DEVINFO_COPROCESSOR ); |
if( devinfo == 0 ) { |
_RWD_real87 = 0; |
} else { |
_RWD_real87 = __x87id(); |
} |
_RWD_8087 = _RWD_real87; |
#else |
if( _RWD_8087 == 0 ) { |
DosDevConfig( &devinfo, 3, 0 ); |
if( devinfo == 0 ) { |
_RWD_real87 = 0; |
} else { |
_RWD_real87 = __x87id(); |
} |
_RWD_8087 = _RWD_real87; |
} |
if( _RWD_real87 ) { |
__GrabFP87(); |
} |
if( _RWD_8087 ) { |
_RWD_FPE_handler = __default_sigfpe_handler; |
} |
#endif |
_fpreset(); |
} |
|
#elif defined( __QNX__ ) |
|
void __chk8087( void ) |
/********************/ |
{ |
extern char __87; |
extern char __r87; |
|
_RWD_real87 = __r87; |
_RWD_8087 = __87; |
_fpreset(); |
} |
|
#elif defined( __LINUX__ ) |
|
void __chk8087( void ) |
/********************/ |
{ |
// TODO: We really need to call Linux and determine if the machine |
// has a real FPU or not, so we can properly work with an FPU |
// emulator. |
_RWD_real87 = __x87id(); |
_RWD_8087 = _RWD_real87; |
_fpreset(); |
} |
|
#elif defined( __NETWARE__ ) |
|
extern short __87present( void ); |
#pragma aux __87present = \ |
"smsw ax ", \ |
"test ax, 4 ", \ |
"jne no_emu ", \ |
"xor ax, ax ", \ |
"no_emu: ", \ |
"mov ax, 1 " \ |
value [ ax ]; |
|
extern void __chk8087( void ) |
/*****************************/ |
{ |
if( _RWD_8087 == 0 ) { |
if( __87present() ) { |
_RWD_8087 = 3; /* 387 */ |
_RWD_real87 = 3; |
} |
__init_80x87(); |
} |
} |
|
#elif defined( __NT__ ) |
|
void __chk8087( void ) |
/********************/ |
{ |
_RWD_real87 = __x87id(); |
_RWD_8087 = _RWD_real87; |
__init_8087(); |
} |
|
#elif defined( __DOS__ ) |
|
void __chk8087( void ) |
/********************/ |
{ |
if( _RWD_8087 != 0 ) { /* if we already know we have an 80x87 */ |
#if !defined( __386__ ) |
if( __dos87real ) |
__GrabFP87(); |
#endif |
_RWD_FPE_handler = __default_sigfpe_handler; |
return; /* this prevents real87 from being set */ |
} /* when we have an emulator */ |
_RWD_real87 = __x87id(); /* if a coprocessor is present then we */ |
_RWD_8087 = _RWD_real87; /* initialize even when NO87 is defined */ |
#if !defined( __386__ ) |
__dos87real = _RWD_real87; |
#endif |
__init_8087(); /* this handles the fpi87 and NO87 case */ |
if( _RWD_no87 != 0 ) { /* if NO87 environment var is defined */ |
_RWD_8087 = 0; /* then we want to pretend that the */ |
_RWD_real87 = 0; /* coprocessor doesn't exist */ |
} |
if( _RWD_real87 ) { |
__GrabFP87(); |
} |
if( _RWD_8087 ) { |
_RWD_FPE_handler = __default_sigfpe_handler; |
} |
} |
|
#elif defined( __WINDOWS__ ) |
|
void __chk8087( void ) |
/********************/ |
{ |
if( _RWD_8087 != 0 ) /* if we already know we have an 80x87 */ |
return; /* this prevents real87 from being set */ |
/* when we have an emulator */ |
if( GetWinFlags() & WF_80x87 ) { /* if a coprocessor is present then we */ |
#if defined( __386__ ) |
extern void pascal _FloatingPoint( void ); |
_FloatingPoint(); |
#endif |
_RWD_real87 = __x87id(); /* initialize even when NO87 is defined */ |
_RWD_8087 = _RWD_real87; /* this handles the fpi87 and NO87 case */ |
__init_8087(); |
} else { |
#if defined( __386__ ) |
// check to see if emulator is loaded |
union REGS regs; |
regs.w.ax = 0xfa00; |
int86( 0x2f, ®s, ®s ); |
if( regs.w.ax == 0x0666 ) { /* check for emulator present */ |
_RWD_real87 = __x87id(); /* initialize even when NO87 is defined */ |
_RWD_8087 = _RWD_real87; /* this handles the fpi87 and NO87 case */ |
__init_8087(); |
} |
#endif |
} |
if( _RWD_no87 != 0 ) { /* if NO87 environment var is defined */ |
_RWD_8087 = 0; /* then we want to pretend that the */ |
_RWD_real87 = 0; /* coprocessor doesn't exist */ |
} |
} |
|
#endif |