From 0607cc61a916022904a68c100c0a7c43b9169793 Mon Sep 17 00:00:00 2001 From: cgf Date: Thu, 3 Mar 2005 00:49:51 +0000 Subject: [PATCH] * autoload.cc (std_dll_init): Save and restore fpu control register around LoadAddress to prevent loaded dlls (like msvcrt.dll) from setting unwanted stuff. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/autoload.cc | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3e8218771d..302fb5ef0f 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,11 @@ 2005-03-02 Christopher Faylor + * autoload.cc (std_dll_init): Save and restore fpu control register + around LoadAddress to prevent loaded dlls (like msvcrt.dll) from + setting unwanted stuff. + +2005-03-02 Christopher Faylor + * cygtls.cc (_cygtls::init_thread): Move exitsock setting later. It 2005-03-02 Christopher Faylor diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc index 805b765c1b..aef122a2fb 100644 --- a/winsup/cygwin/autoload.cc +++ b/winsup/cygwin/autoload.cc @@ -208,8 +208,13 @@ std_dll_init () while (InterlockedIncrement (&dll->here)); else if (!dll->handle) { + unsigned fpu_control = 0; + __asm__ __volatile__ ("fnstcw %0": "=m" (fpu_control)); if ((h = LoadLibrary (dll->name)) != NULL) - dll->handle = h; + { + __asm__ __volatile__ ("fldcw %0": : "m" (fpu_control)); + dll->handle = h; + } else if (!(func->decoration & 1)) api_fatal ("could not load %s, %E", dll->name); else @@ -256,7 +261,6 @@ wsock_init () if (!wsock_started) { - /* Don't use autoload to load WSAStartup to eliminate recursion. */ int (*wsastartup) (int, WSADATA *); wsastartup = (int (*)(int, WSADATA *)) -- 2.11.0