Mail Archives: cygwin/1997/01/06/19:54:11
The FPU for the x86 is not getting initialized properly for IEEE floating point use.
This causes innaccuracy in some FP code I have been investigating. The following
crt0.c provides the necessary work:
#ifdef __PPC__
/* For the PowerPC, we want to make this function have its structured
exception table exception function point to something we control. */
extern void __cygwin_exception_handler();
extern void mainCRTStartup(void) __attribute__((__exception__(__cygwin_exception_handler)));
#endif
#ifdef __i386__
#define FPU_RESERVED 0xF0C0
#define FPU_DEFAULT 0x033f
/* For debugging on *#!$@ windbg. bp for breakpoint. */
int __cygwin_crt0_bp = 0;
#endif
void
mainCRTStartup ()
{
#ifdef __i386__
if (__cygwin_crt0_bp)
asm volatile ("int3");
{
volatile unsigned short cw;
/* Get Control Word */
__asm__ volatile ("fnstcw %0" : "=m" (cw) : );
/* mask in */
cw &= FPU_RESERVED;
cw |= FPU_DEFAULT;
/* set cw */
__asm__ volatile ("fldcw %0" :: "m" (cw));
}
#endif
cygwin_crt0 ();
}
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -