cpufeature() - rename _SSEx and correct logic in cpufeature() in lib

This commit is contained in:
Ben Gras 2010-04-29 19:08:49 +00:00
parent 3bf54e9b2b
commit 99a13341bd
2 changed files with 7 additions and 9 deletions

View File

@ -7,7 +7,7 @@
#define _CPUF_I386_PGE 2 /* Page Global Enable */ #define _CPUF_I386_PGE 2 /* Page Global Enable */
#define _CPUF_I386_APIC_ON_CHIP 3 /* APIC is present on the chip */ #define _CPUF_I386_APIC_ON_CHIP 3 /* APIC is present on the chip */
#define _CPUF_I386_TSC 4 /* Timestamp counter present */ #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 * Extensions and FXSR
*/ */
#define _CPUF_I386_FXSR 6 #define _CPUF_I386_FXSR 6

View File

@ -35,14 +35,12 @@ int _cpufeature(int cpufeature)
return edx & CPUID1_EDX_TSC; return edx & CPUID1_EDX_TSC;
case _CPUF_I386_FPU: case _CPUF_I386_FPU:
return edx & CPUID1_EDX_FPU; return edx & CPUID1_EDX_FPU;
case _CPUF_I386_SSEx: #define SSE_FULL_EDX (CPUID1_EDX_FXSR | CPUID1_EDX_SSE | CPUID1_EDX_SSE2)
return (edx & (CPUID1_EDX_FXSR | #define SSE_FULL_ECX (CPUID1_ECX_SSE3 | CPUID1_ECX_SSSE3 | \
CPUID1_EDX_SSE | CPUID1_ECX_SSE4_1 | CPUID1_ECX_SSE4_2)
CPUID1_EDX_SSE2)) && case _CPUF_I386_SSE1234_12:
(ecx & (CPUID1_ECX_SSE3 | return (edx & SSE_FULL_EDX) == SSE_FULL_EDX &&
CPUID1_ECX_SSSE3 | (ecx & SSE_FULL_ECX) == SSE_FULL_ECX;
CPUID1_ECX_SSE4_1 |
CPUID1_ECX_SSE4_2));
case _CPUF_I386_FXSR: case _CPUF_I386_FXSR:
return edx & CPUID1_EDX_FXSR; return edx & CPUID1_EDX_FXSR;
case _CPUF_I386_SSE: case _CPUF_I386_SSE: