aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2007-05-02 13:27:20 -0400
committerAndi Kleen <andi@basil.nowhere.org>2007-05-02 13:27:20 -0400
commit72b1b1d0133d7eb4040697f1052bf92123fb051b (patch)
tree864d2e7ad0c0cc4a5196dfbf110b72f22439bc76 /arch/x86_64
parent4637a74cf2ac3a3696d385c8624d84de789d1bbe (diff)
[PATCH] x86-64: Use symbolic CPU features in early CPUID check
Dead to magic numbers! Generated code is the same. Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/kernel/verify_cpu.S23
1 files changed, 16 insertions, 7 deletions
diff --git a/arch/x86_64/kernel/verify_cpu.S b/arch/x86_64/kernel/verify_cpu.S
index 72edabd2ef9a..e035f5948199 100644
--- a/arch/x86_64/kernel/verify_cpu.S
+++ b/arch/x86_64/kernel/verify_cpu.S
@@ -30,18 +30,27 @@
30 * appropriately. Either display a message or halt. 30 * appropriately. Either display a message or halt.
31 */ 31 */
32 32
33verify_cpu: 33#include <asm/cpufeature.h>
34 34
35verify_cpu:
35 pushfl # Save caller passed flags 36 pushfl # Save caller passed flags
36 pushl $0 # Kill any dangerous flags 37 pushl $0 # Kill any dangerous flags
37 popfl 38 popfl
38 39
39 /* minimum CPUID flags for x86-64 */ 40 /* minimum CPUID flags for x86-64 as defined by AMD */
40 /* see http://www.x86-64.org/lists/discuss/msg02971.html */ 41#define M(x) (1<<(x))
41#define SSE_MASK ((1<<25)|(1<<26)) 42#define M2(a,b) M(a)|M(b)
42#define REQUIRED_MASK1 ((1<<0)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<8)|\ 43#define M4(a,b,c,d) M(a)|M(b)|M(c)|M(d)
43 (1<<13)|(1<<15)|(1<<24)) 44
44#define REQUIRED_MASK2 (1<<29) 45#define SSE_MASK \
46 (M2(X86_FEATURE_XMM,X86_FEATURE_XMM2))
47#define REQUIRED_MASK1 \
48 (M4(X86_FEATURE_FPU,X86_FEATURE_PSE,X86_FEATURE_TSC,X86_FEATURE_MSR)|\
49 M4(X86_FEATURE_PAE,X86_FEATURE_CX8,X86_FEATURE_PGE,X86_FEATURE_CMOV)|\
50 M(X86_FEATURE_FXSR))
51#define REQUIRED_MASK2 \
52 (M(X86_FEATURE_LM - 32))
53
45 pushfl # standard way to check for cpuid 54 pushfl # standard way to check for cpuid
46 popl %eax 55 popl %eax
47 movl %eax,%ebx 56 movl %eax,%ebx