delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/03/02/08:33:52

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Dave Korn" <dave DOT korn AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
Subject: RE: loading of wsock32 disturbs FPU
Date: Wed, 2 Mar 2005 13:33:42 -0000
MIME-Version: 1.0
In-Reply-To: <200503021306.32969.r.schulz@dkfz.de>
Message-ID: <SERRANO8ARf3sllNY300000004a@SERRANO.CAM.ARTIMI.COM>
X-OriginalArrivalTime: 02 Mar 2005 13:33:42.0274 (UTC) FILETIME=[73434E20:01C51F2C]

----Original Message----
>From: Ralf B. Schulz
>Sent: 02 March 2005 12:07

> This is a follow-up on thread "1.5.12: FPU affected by gethostname call".
> It shows that calling some functions of the windows API will affect the
> floating point unit so that all calculation are performed with double
> precision only, instead of long double precision.
> 
> After careful examination, the problem is as follows: after loading of
> some DLLs (in particular wsock32.dll) it seems that some flags of the
> floating point unit that determine the accuracy of floating point
> calculations are changed.

> So I conclude:
> a) when loading the DLL, i.e. with the first call of any function in
> wsock32, the FPU goes into 64 bit mode

  Confirmed.  In fact, it's ws2_32.dll; wsock32 forwards pretty much
everything it does to ws2 these days.  You can replace the gethostname call
with just LoadLibrary ("ws2_32.dll"); and it still fails.

  Hey everyone, you know that standard advice about never linking
MSVCRT-based stuff together with cygwin-based stuff?  

dk AT mace /win/c/WINDOWS/system32> cygcheck ws2_32.dll
Found: .\ws2_32.dll
ws2_32.dll
  .\msvcrt.dll
    .\KERNEL32.dll
      .\ntdll.dll
  .\WS2HELP.dll
    .\ADVAPI32.dll
      .\RPCRT4.dll

  Houston, we have a problem!  Replacing the gethostname() call with
LoadLibrary ("msvcrt.dll"); also reproduces the problem.

> b) the assembler instruction "finit" rsets it to 80-bit mode
> c) after that, any other calls to the DLL, which now resides in memory,
> is not disturbing the FPU, that means whatever it is that happens to the
> FPU, it happens in the DLL startup code or in the DLL loader.

  This must be down to a difference between Cygwin's newlib-based CRTinit
code and something linked into wsock32 that is MSVCrt-init based.  It's got
to be in the DllMain rather than the loader or we'd see it with other
libraries.

  Hm.  We probably need to put a finit instruction into the autoload code
somewhere.  wsock_init () looks like just the place......  now if I just
persuade the CVS code to build without a SIG11 (grmbl grmbl....)



    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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