ntdll: Fix the initial FPU control word on 64-bit.
authorAlexandre Julliard <julliard@winehq.org>
Mon, 21 Jun 2010 09:49:25 +0000 (11:49 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 21 Jun 2010 09:49:25 +0000 (11:49 +0200)
dlls/kernel32/tests/thread.c
dlls/ntdll/signal_x86_64.c

index df87ae008b66b6ab75db94e2742c735c72b1d8f4..1d3931fb4874adb8e30b515189e3173a26393934 100644 (file)
@@ -1387,10 +1387,11 @@ static WORD get_thread_fpu_cw(void)
 
 static void test_thread_fpu_cw(void)
 {
-    WORD initial_cw, cw;
+    WORD initial_cw, cw, expect;
 
     initial_cw = get_fpu_cw();
-    ok(initial_cw == 0x37f, "Expected FPU control word 0x37f, got %#x.\n", initial_cw);
+    expect = sizeof(void *) > sizeof(int) ? 0x27f : 0x37f;
+    ok(initial_cw == expect, "Expected FPU control word expect, got %#x.\n", initial_cw);
 
     cw = get_thread_fpu_cw();
     ok(cw == 0x27f, "Expected FPU control word 0x27f, got %#x.\n", cw);
index 188224dc5d6b3f0dcea7ef96383abf4c484243d3..48f8b6d4a0ac3de99f6b6503cc710ea5ddf11cf8 100644 (file)
@@ -2330,6 +2330,7 @@ void signal_free_thread( TEB *teb )
  */
 void signal_init_thread( TEB *teb )
 {
+    const WORD fpu_cw = 0x27f;
     stack_t ss;
 
 #if defined __linux__
@@ -2345,15 +2346,11 @@ void signal_init_thread( TEB *teb )
     ss.ss_flags = 0;
     if (sigaltstack(&ss, NULL) == -1) perror( "sigaltstack" );
 
-    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
-    }
 }
 
 /**********************************************************************