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

This commit is contained in:
Alexandre Julliard 2010-06-21 11:49:25 +02:00
parent 2a26e954ec
commit 8b54390686
2 changed files with 6 additions and 8 deletions

View File

@ -1387,10 +1387,11 @@ static WORD get_thread_fpu_cw(void)
static void test_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(); 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(); cw = get_thread_fpu_cw();
ok(cw == 0x27f, "Expected FPU control word 0x27f, got %#x.\n", cw); ok(cw == 0x27f, "Expected FPU control word 0x27f, got %#x.\n", cw);

View File

@ -2330,6 +2330,7 @@ void signal_free_thread( TEB *teb )
*/ */
void signal_init_thread( TEB *teb ) void signal_init_thread( TEB *teb )
{ {
const WORD fpu_cw = 0x27f;
stack_t ss; stack_t ss;
#if defined __linux__ #if defined __linux__
@ -2345,15 +2346,11 @@ void signal_init_thread( TEB *teb )
ss.ss_flags = 0; ss.ss_flags = 0;
if (sigaltstack(&ss, NULL) == -1) perror( "sigaltstack" ); if (sigaltstack(&ss, NULL) == -1) perror( "sigaltstack" );
if (teb->Peb->ProcessHeap) /* Not for the inital thread. */
{
const WORD fpu_cw = 0x27f;
#ifdef __GNUC__ #ifdef __GNUC__
__asm__ volatile ("fninit; fldcw %0" : : "m" (fpu_cw)); __asm__ volatile ("fninit; fldcw %0" : : "m" (fpu_cw));
#else #else
FIXME("FPU setup not implemented for this platform.\n"); FIXME("FPU setup not implemented for this platform.\n");
#endif #endif
}
} }
/********************************************************************** /**********************************************************************