diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2002-07-11 15:32:00 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2002-07-11 15:32:00 +0000 |
commit | 6d0fd19a71a83e26d775ca9e8c61b453108474c1 (patch) | |
tree | 1acb6af5c334bd1526c84f27d6a035845ed792b8 /src | |
parent | 670ea9f590b5446ede96db8f2862db65deb68bdd (diff) |
applied Eric Anholt's patch for Athlon SSE
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/x86/common_x86.c | 16 | ||||
-rw-r--r-- | src/mesa/x86/common_x86_asm.S | 15 |
2 files changed, 28 insertions, 3 deletions
diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c index ba3a54ca4b..d00b4a9365 100644 --- a/src/mesa/x86/common_x86.c +++ b/src/mesa/x86/common_x86.c @@ -1,4 +1,4 @@ -/* $Id: common_x86.c,v 1.16 2001/06/06 18:12:35 brianp Exp $ */ +/* $Id: common_x86.c,v 1.16.2.1 2002/07/11 15:32:00 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -38,6 +38,10 @@ #if defined(USE_SSE_ASM) && defined(__linux__) #include <signal.h> #endif +#if defined(USE_SSE_ASM) && defined(__FreeBSD__) +#include <sys/types.h> +#include <sys/sysctl.h> +#endif #include "context.h" #include "common_x86_asm.h" @@ -213,8 +217,16 @@ static void check_os_sse_support( void ) message( "Cannot test OS support for SSE, disabling to be safe.\n" ); _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); #endif /* _POSIX_SOURCE && X86_FXSR_MAGIC */ +#elif defined(__FreeBSD__) + { + int ret, len, enabled; + len = sizeof(enabled); + ret = sysctlbyname("hw.instruction_sse", &enabled, &len, NULL, 0); + if (ret || !enabled) + _mesa_x86_cpu_features &= ~(X86_FEATURE_XMM); + } #else - /* Do nothing on non-Linux platforms for now. + /* Do nothing on other platforms for now. */ message( "Not testing OS support for SSE, leaving enabled.\n" ); #endif /* __linux__ */ diff --git a/src/mesa/x86/common_x86_asm.S b/src/mesa/x86/common_x86_asm.S index 1533da0625..154e7cd000 100644 --- a/src/mesa/x86/common_x86_asm.S +++ b/src/mesa/x86/common_x86_asm.S @@ -1,4 +1,4 @@ -/* $Id: common_x86_asm.S,v 1.7.2.2 2002/06/04 21:29:01 brianp Exp $ */ +/* $Id: common_x86_asm.S,v 1.7.2.3 2002/07/11 15:32:00 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -134,6 +134,15 @@ LLBL(cpuid_amd): * information after we verify that the extended functions are * supported. */ + /* The features we need are almost all in the extended set. The + * exception is SSE enable, which is in the standard set (0x1). + */ + MOV_L ( CONST(0x1), EAX ) + CPUID + TEST_L ( EAX, EAX ) + JZ ( LLBL (cpuid_failed) ) + MOV_L ( EDX, ESI ) + MOV_L ( CONST(0x80000000), EAX ) CPUID TEST_L ( EAX, EAX ) @@ -142,6 +151,10 @@ LLBL(cpuid_amd): MOV_L ( CONST(0x80000001), EAX ) CPUID MOV_L ( EDX, EAX ) + + AND_L ( CONST(0x02000000), ESI ) /* OR in the SSE bit */ + OR_L ( ESI, EAX ) + JMP ( LLBL (cpuid_done) ) LLBL(cpuid_other): |