Alexandre Julliard : ntdll: Fix the initial FPU control word on 64-bit.
Alexandre Julliard
julliard at winehq.org
Mon Jun 21 11:07:03 CDT 2010
Module: wine
Branch: master
Commit: 8b5439068659cfd0c3f9711bdf5fd06b0507b989
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8b5439068659cfd0c3f9711bdf5fd06b0507b989
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Jun 21 11:49:25 2010 +0200
ntdll: Fix the initial FPU control word on 64-bit.
---
dlls/kernel32/tests/thread.c | 5 +++--
dlls/ntdll/signal_x86_64.c | 9 +++------
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/dlls/kernel32/tests/thread.c b/dlls/kernel32/tests/thread.c
index df87ae0..1d3931f 100644
--- a/dlls/kernel32/tests/thread.c
+++ b/dlls/kernel32/tests/thread.c
@@ -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);
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
index 188224d..48f8b6d 100644
--- a/dlls/ntdll/signal_x86_64.c
+++ b/dlls/ntdll/signal_x86_64.c
@@ -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
- }
}
/**********************************************************************
More information about the wine-cvs
mailing list