Alexandre Julliard : ntdll: Fix the initial FPU control word on 32-bit too.

Alexandre Julliard julliard at winehq.org
Tue Jun 22 10:49:32 CDT 2010


Module: wine
Branch: master
Commit: 0db65fd36ee8399e08635eec8a038919e3b029bc
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0db65fd36ee8399e08635eec8a038919e3b029bc

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jun 22 11:19:02 2010 +0200

ntdll: Fix the initial FPU control word on 32-bit too.

---

 dlls/kernel32/tests/thread.c |    7 ++++---
 dlls/ntdll/signal_i386.c     |    9 +++------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c
index 1d3931f..3da29a2 100644
--- a/dlls/kernel32/tests/thread.c
+++ b/dlls/kernel32/tests/thread.c
@@ -1329,6 +1329,8 @@ static void test_ThreadErrorMode(void)
     pSetThreadErrorMode(oldmode, NULL);
 }
 
+void _fpreset(void) {} /* override the mingw fpu init code */
+
 static inline void set_fpu_cw(WORD cw)
 {
 #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
@@ -1387,11 +1389,10 @@ static WORD get_thread_fpu_cw(void)
 
 static void test_thread_fpu_cw(void)
 {
-    WORD initial_cw, cw, expect;
+    WORD initial_cw, cw;
 
     initial_cw = get_fpu_cw();
-    expect = sizeof(void *) > sizeof(int) ? 0x27f : 0x37f;
-    ok(initial_cw == expect, "Expected FPU control word expect, got %#x.\n", initial_cw);
+    ok(initial_cw == 0x27f, "Expected FPU control word 0x27f, got %#x.\n", initial_cw);
 
     cw = get_thread_fpu_cw();
     ok(cw == 0x27f, "Expected FPU control word 0x27f, got %#x.\n", cw);
diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c
index b003436..c08693e 100644
--- a/dlls/ntdll/signal_i386.c
+++ b/dlls/ntdll/signal_i386.c
@@ -2155,6 +2155,7 @@ void signal_free_thread( TEB *teb )
  */
 void signal_init_thread( TEB *teb )
 {
+    const WORD fpu_cw = 0x27f;
     struct ntdll_thread_data *thread_data = (struct ntdll_thread_data *)teb->SpareBytes1;
     LDT_ENTRY fs_entry;
     stack_t ss;
@@ -2178,15 +2179,11 @@ void signal_init_thread( TEB *teb )
     wine_ldt_init_fs( thread_data->fs, &fs_entry );
     thread_data->gs = wine_get_gs();
 
-    if (teb->Peb->ProcessHeap) /* Not for the inital thread. */
-    {
-        const WORD fpu_cw = 0x27f;
 #ifdef __GNUC__
-        __asm__ volatile ("fninit; fldcw %0" : : "m" (fpu_cw));
+    __asm__ volatile ("fninit; fldcw %0" : : "m" (fpu_cw));
 #else
-        FIXME("FPU setup not implemented for this platform.\n");
+    FIXME("FPU setup not implemented for this platform.\n");
 #endif
-    }
 }
 
 /**********************************************************************




More information about the wine-cvs mailing list