* fenv.cc (_feinitialise); Don't use SSE instructions on systems not

supporting them.
	* wincap.h (wincaps::supports_sse): New element.
	* wincap.cc: Implement above element throughout.
This commit is contained in:
Corinna Vinschen 2011-03-20 15:34:29 +00:00
parent b8bdc60019
commit 33150e7f40
4 changed files with 25 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2011-03-20 Corinna Vinschen <corinna@vinschen.de>
* fenv.cc (_feinitialise); Don't use SSE instructions on systems not
supporting them.
* wincap.h (wincaps::supports_sse): New element.
* wincap.cc: Implement above element throughout.
2011-03-18 Corinna Vinschen <corinna@vinschen.de> 2011-03-18 Corinna Vinschen <corinna@vinschen.de>
* cygwin.sc: Raise default cygheap size to 2 Megs. * cygwin.sc: Raise default cygheap size to 2 Megs.

View File

@ -1,6 +1,6 @@
/* fenv.cc /* fenv.cc
Copyright 2010 Red Hat, Inc. Copyright 2010, 2011 Red Hat, Inc.
This file is part of Cygwin. This file is part of Cygwin.
@ -8,9 +8,11 @@ This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */ details. */
#include <string.h> #include "winsup.h"
#include "fenv.h" #include "fenv.h"
#include "errno.h" #include "errno.h"
#include "wincap.h"
#include <string.h>
/* Mask and shift amount for rounding bits. */ /* Mask and shift amount for rounding bits. */
#define FE_CW_ROUND_MASK (0x0c00) #define FE_CW_ROUND_MASK (0x0c00)
@ -419,8 +421,9 @@ _feinitialise (void)
/* Check for presence of SSE: invoke CPUID #1, check EDX bit 25. */ /* Check for presence of SSE: invoke CPUID #1, check EDX bit 25. */
eax = 1; eax = 1;
__asm__ volatile ("cpuid" : "=d" (edx), "+a" (eax) :: "%ecx", "%ebx"); __asm__ volatile ("cpuid" : "=d" (edx), "+a" (eax) :: "%ecx", "%ebx");
/* If this flag isn't set, we'll avoid trying to execute any SSE. */ /* If this flag isn't set, or if the OS doesn't support SSE (NT4, at least
if (edx & (1 << 25)) up to SP4) we'll avoid trying to execute any SSE. */
if ((edx & (1 << 25)) != 0 && wincap.supports_sse ())
use_sse = true; use_sse = true;
/* Reset FPU: extended prec, all exceptions cleared and masked off. */ /* Reset FPU: extended prec, all exceptions cleared and masked off. */

View File

@ -63,6 +63,7 @@ wincaps wincap_nt4sp4 __attribute__((section (".cygwin_dll_common"), shared)) =
has_restricted_raw_disk_access:false, has_restricted_raw_disk_access:false,
use_dont_resolve_hack:false, use_dont_resolve_hack:false,
use_get_sec_info_on_dirs:false, use_get_sec_info_on_dirs:false,
supports_sse:false,
}; };
wincaps wincap_2000 __attribute__((section (".cygwin_dll_common"), shared)) = { wincaps wincap_2000 __attribute__((section (".cygwin_dll_common"), shared)) = {
@ -105,6 +106,7 @@ wincaps wincap_2000 __attribute__((section (".cygwin_dll_common"), shared)) = {
has_restricted_raw_disk_access:false, has_restricted_raw_disk_access:false,
use_dont_resolve_hack:false, use_dont_resolve_hack:false,
use_get_sec_info_on_dirs:false, use_get_sec_info_on_dirs:false,
supports_sse:true,
}; };
wincaps wincap_2000sp4 __attribute__((section (".cygwin_dll_common"), shared)) = { wincaps wincap_2000sp4 __attribute__((section (".cygwin_dll_common"), shared)) = {
@ -147,6 +149,7 @@ wincaps wincap_2000sp4 __attribute__((section (".cygwin_dll_common"), shared)) =
has_restricted_raw_disk_access:false, has_restricted_raw_disk_access:false,
use_dont_resolve_hack:false, use_dont_resolve_hack:false,
use_get_sec_info_on_dirs:false, use_get_sec_info_on_dirs:false,
supports_sse:true,
}; };
wincaps wincap_xp __attribute__((section (".cygwin_dll_common"), shared)) = { wincaps wincap_xp __attribute__((section (".cygwin_dll_common"), shared)) = {
@ -189,6 +192,7 @@ wincaps wincap_xp __attribute__((section (".cygwin_dll_common"), shared)) = {
has_restricted_raw_disk_access:false, has_restricted_raw_disk_access:false,
use_dont_resolve_hack:true, use_dont_resolve_hack:true,
use_get_sec_info_on_dirs:true, use_get_sec_info_on_dirs:true,
supports_sse:true,
}; };
wincaps wincap_xpsp1 __attribute__((section (".cygwin_dll_common"), shared)) = { wincaps wincap_xpsp1 __attribute__((section (".cygwin_dll_common"), shared)) = {
@ -231,6 +235,7 @@ wincaps wincap_xpsp1 __attribute__((section (".cygwin_dll_common"), shared)) = {
has_restricted_raw_disk_access:false, has_restricted_raw_disk_access:false,
use_dont_resolve_hack:true, use_dont_resolve_hack:true,
use_get_sec_info_on_dirs:true, use_get_sec_info_on_dirs:true,
supports_sse:true,
}; };
wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = { wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = {
@ -273,6 +278,7 @@ wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = {
has_restricted_raw_disk_access:false, has_restricted_raw_disk_access:false,
use_dont_resolve_hack:true, use_dont_resolve_hack:true,
use_get_sec_info_on_dirs:true, use_get_sec_info_on_dirs:true,
supports_sse:true,
}; };
wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = { wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = {
@ -315,6 +321,7 @@ wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = {
has_restricted_raw_disk_access:false, has_restricted_raw_disk_access:false,
use_dont_resolve_hack:false, use_dont_resolve_hack:false,
use_get_sec_info_on_dirs:true, use_get_sec_info_on_dirs:true,
supports_sse:true,
}; };
wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = { wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
@ -357,6 +364,7 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
has_restricted_raw_disk_access:true, has_restricted_raw_disk_access:true,
use_dont_resolve_hack:false, use_dont_resolve_hack:false,
use_get_sec_info_on_dirs:false, use_get_sec_info_on_dirs:false,
supports_sse:true,
}; };
wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = { wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
@ -399,6 +407,7 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
has_restricted_raw_disk_access:true, has_restricted_raw_disk_access:true,
use_dont_resolve_hack:false, use_dont_resolve_hack:false,
use_get_sec_info_on_dirs:false, use_get_sec_info_on_dirs:false,
supports_sse:true,
}; };
wincapc wincap __attribute__((section (".cygwin_dll_common"), shared)); wincapc wincap __attribute__((section (".cygwin_dll_common"), shared));

View File

@ -53,6 +53,7 @@ struct wincaps
unsigned has_restricted_raw_disk_access : 1; unsigned has_restricted_raw_disk_access : 1;
unsigned use_dont_resolve_hack : 1; unsigned use_dont_resolve_hack : 1;
unsigned use_get_sec_info_on_dirs : 1; unsigned use_get_sec_info_on_dirs : 1;
unsigned supports_sse : 1;
}; };
class wincapc class wincapc
@ -111,6 +112,7 @@ public:
bool IMPLEMENT (has_restricted_raw_disk_access) bool IMPLEMENT (has_restricted_raw_disk_access)
bool IMPLEMENT (use_dont_resolve_hack) bool IMPLEMENT (use_dont_resolve_hack)
bool IMPLEMENT (use_get_sec_info_on_dirs) bool IMPLEMENT (use_get_sec_info_on_dirs)
bool IMPLEMENT (supports_sse)
#undef IMPLEMENT #undef IMPLEMENT
}; };