This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: loading of wsock32 disturbs FPU


----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@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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]