Date: Sun, 26 Sep 1999 15:08:38 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Ralph Reid cc: djgpp AT delorie DOT com Subject: Re: 387 emulation problem In-Reply-To: <7skr62$7ff@fingers.shocking.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 26 Sep 1999, Ralph Reid wrote: > The 387 emulation library seems to have a problem. I compiled the > little program below with gcc2.95 and DJGPP, using the following > command lines in an MSDOS 6.22 OS on a 486SX25: > > gcc -s -O2 -Wall -c sqrt.c > gcc -s -O2 -Wall -o sqrt.exe sqrt.o -lemu > > No errors or warnings appear during compilation or linking. Running > the resulting program (SQRT.EXE) produces no output at all, and I was > able to terminate the program with CTRL-C. This is a known bug: any floating-point program that uses the emulator on Windows and issues WAIT or FWAIT instructions (most of the non-trivial FP programs use these instructions) will be trapped in an endless loop, because the emulation of WAIT/FWAIT doesn't increment the EIP. On plain DOS, these problems don't happen, because WAIT/FWAIT don't trigger the no-fpu exception except on Windows. The following source-level patch fixes this bug. You will need to download the DJGPP sources (v2/djlsr202.zip) and rebuild the emulator (emu387.dxe) and/or the emulation library (libemu.a), after patching the sources with the Patch utility (v2gnu/pat25b.zip). The bug is already solved in the DJGPP development tree, and v2.03 will be free from it. *** src/libemu/src/emu387.c~0 Thu Jun 10 10:41:56 1999 --- src/libemu/src/emu387.cc Wed Sep 1 21:04:58 1999 *************** int _emu_entry(jmp_buf _exception_state) *** 3507,3513 **** eip++; if (*eip == 0x9b) // fwait { ! // _exception_state->__eip++; return 0; } jmpval = setjmp(jumpbuf); --- 3507,3514 ---- eip++; if (*eip == 0x9b) // fwait { ! eip++; ! _exception_state->__eip = (unsigned long) eip; return 0; } jmpval = setjmp(jumpbuf);