www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/05/06/19:41:53

Sender: nate AT cartsys DOT com
Message-ID: <37322803.A86FE46C@cartsys.com>
Date: Thu, 06 May 1999 16:38:43 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.5 i586)
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
CC: DJ Delorie <dj AT delorie DOT com>, sandmann AT clio DOT rice DOT edu
Subject: Re: _clear87 at exit
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990506185918 DOT 8142A-100000 AT is>
Reply-To: djgpp-workers AT delorie DOT com

Eli Zaretskii wrote:
> 
> On Thu, 6 May 1999, DJ Delorie wrote:
> 
> > I wouldn't call _clear87() unless we know we've detected and used the
> > FPU, else exiting the program may *load* the FPU emulator.
> 
> Right.  This is easy enough to do, I just have to look at the value of
> _8087.
> 
> Hmm... it seems we need to change npxsetup.c to set _8087 when $387 is
> set to Y in the environment.  Right now it is left at zero; however, my
> references indicate that in Borland _8087's value reflects the override
> of the environment.  Comments?
> 
> Nate, is there any reason why _8087 isn't set in the case of 387=Y?

Laziness?

No, there isn't really, and it does seem Borland wants it to.  Here is a
patch which I don't have time to test right now, but is "obviously"
correct.

--- src/libc/emu387/npxsetup.c  Sat Mar 20 16:36:18 1999
+++ src/libc/emu387/npxsetup.c.new      Thu May  6 16:37:28 1999
@@ -72,6 +72,7 @@
   if (cp && (tolower((unsigned char)cp[0]) == 'y'))
   {
     _control87(0x033f, 0xffff);        /* mask all numeric exceptions
*/
+    _8087 = 3;
     return;
   }
   if (cp && (tolower((unsigned char)cp[0]) == 'n'))
@@ -82,8 +83,8 @@
        nested FPU client fault - DJ */
     __dpmi_set_coprocessor_emulation(1);
     have_80387 = _detect_80387();
-    _8087 = (have_80387 ? 3 : 0);
   }
+  _8087 = (have_80387 ? 3 : 0);
 
   if (cp && (tolower((unsigned char)cp[0]) == 'q')) {
     if (!have_80387)

-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019