]> Zhao Yanbai Git Server - minix.git/commitdiff
cpufeature() - rename _SSEx and correct logic in cpufeature() in lib
authorBen Gras <ben@minix3.org>
Thu, 29 Apr 2010 19:08:49 +0000 (19:08 +0000)
committerBen Gras <ben@minix3.org>
Thu, 29 Apr 2010 19:08:49 +0000 (19:08 +0000)
include/minix/cpufeature.h
lib/libc/arch/i386/misc/_cpufeature.c

index 0eea544d92caf19c28da1e39f67a0fe116fd8894..395f555f193a00829682d5e6c0a1bc07a36a4cac 100644 (file)
@@ -7,7 +7,7 @@
 #define _CPUF_I386_PGE                 2       /* Page Global Enable */
 #define _CPUF_I386_APIC_ON_CHIP        3       /* APIC is present on the chip */
 #define _CPUF_I386_TSC         4       /* Timestamp counter present */
-#define _CPUF_I386_SSEx                5       /* Support for SSE/SSE2/SSE3/SSSE3/SSE4
+#define _CPUF_I386_SSE1234_12  5       /* Support for SSE/SSE2/SSE3/SSSE3/SSE4
                                         * Extensions and FXSR
                                         */
 #define _CPUF_I386_FXSR                6
index 8de5cc2ba60a335dc7ba79e281daa44a66cd7a43..e74ed102619fba6237771ad00f1da2c5fd11335f 100644 (file)
@@ -35,14 +35,12 @@ int _cpufeature(int cpufeature)
                        return edx & CPUID1_EDX_TSC;
                case _CPUF_I386_FPU:
                        return edx & CPUID1_EDX_FPU;
-               case _CPUF_I386_SSEx:
-                       return (edx & (CPUID1_EDX_FXSR |
-                                       CPUID1_EDX_SSE |
-                                       CPUID1_EDX_SSE2)) &&
-                                       (ecx & (CPUID1_ECX_SSE3 |
-                                       CPUID1_ECX_SSSE3 |
-                                       CPUID1_ECX_SSE4_1 |
-                                       CPUID1_ECX_SSE4_2));
+#define SSE_FULL_EDX (CPUID1_EDX_FXSR | CPUID1_EDX_SSE | CPUID1_EDX_SSE2)
+#define SSE_FULL_ECX (CPUID1_ECX_SSE3 | CPUID1_ECX_SSSE3 | \
+       CPUID1_ECX_SSE4_1 | CPUID1_ECX_SSE4_2)
+               case _CPUF_I386_SSE1234_12:
+                       return  (edx & SSE_FULL_EDX) == SSE_FULL_EDX &&
+                               (ecx & SSE_FULL_ECX) == SSE_FULL_ECX;
                case _CPUF_I386_FXSR:
                        return edx & CPUID1_EDX_FXSR;
                case _CPUF_I386_SSE: