summaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2006-12-20 21:13:45 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-18 00:26:58 +0200
commitde7c29da28f0fc0115b3bbe7389ecc890a8e5104 (patch)
tree3959a3e2484da8b595a568aa26f811b2efac5e3d /i386
parent34547bab03d46e5f748dbcc600fa6eb5be5033be (diff)
2006-12-19 Samuel Thibault <samuel.thibault@ens-lyon.org>
Add support for x86 features. * i386/i386/locore.h (cpu_features): New variable declaration. (CPU_FEATURE_FPU, CPU_FEATURE_VME, CPU_FEATURE_DE, CPU_FEATURE_PSE, CPU_FEATURE_TSC, CPU_FEATURE_MSR, CPU_FEATURE_PAE, CPU_FEATURE_MCE, CPU_FEATURE_CX8, CPU_FEATURE_APIC, CPU_FEATURE_SEP, CPU_FEATURE_MTRR, CPU_FEATURE_PGE, CPU_FEATURE_MCA, CPU_FEATURE_CMOV, CPU_FEATURE_PAT, CPU_FEATURE_PSE_36, CPU_FEATURE_PSN, CPU_FEATURE_CFLSH, CPU_FEATURE_DS, CPU_FEATURE_ACPI, CPU_FEATURE_MMX, CPU_FEATURE_FXSR, CPU_FEATURE_SSE, CPU_FEATURE_SSE2, CPU_FEATURE_SS, CPU_FEATURE_HTT, CPU_FEATURE_TM, CPU_FEATURE_PBE, CPU_HAS_FEATURE): New macros * i386/i386/locore.S (cpu_features): New variable. (discover_x86_cpu_type): Record CPUID feature word 0.
Diffstat (limited to 'i386')
-rw-r--r--i386/i386/locore.S6
-rw-r--r--i386/i386/locore.h34
2 files changed, 40 insertions, 0 deletions
diff --git a/i386/i386/locore.S b/i386/i386/locore.S
index db8fb18..300c8c3 100644
--- a/i386/i386/locore.S
+++ b/i386/i386/locore.S
@@ -1136,6 +1136,11 @@ syscall_addr:
jmp _take_trap /* treat as a trap */
+ .data
+DATA(cpu_features)
+ .long 0
+ .text
+
/* Discover what kind of cpu we have; return the family number
(3, 4, 5, 6, for 386, 486, 586, 686 respectively). */
ENTRY(discover_x86_cpu_type)
@@ -1172,6 +1177,7 @@ ENTRY(discover_x86_cpu_type)
use it to find out what we are. */
0: movl $1,%eax /* Fetch CPU type info ... */
cpuid /* ... into eax */
+ movl %edx,cpu_features /* Keep a copy */
shrl $8,%eax /* Slide family bits down */
andl $15,%eax /* And select them */
diff --git a/i386/i386/locore.h b/i386/i386/locore.h
index ca3467d..24aef2e 100644
--- a/i386/i386/locore.h
+++ b/i386/i386/locore.h
@@ -34,5 +34,39 @@ extern int copyoutmsg (vm_offset_t kernelbuf, vm_offset_t userbuf, size_t cn);
extern int call_continuation (continuation_t continuation);
+extern unsigned int cpu_features[1];
+
+#define CPU_FEATURE_FPU 0
+#define CPU_FEATURE_VME 1
+#define CPU_FEATURE_DE 2
+#define CPU_FEATURE_PSE 3
+#define CPU_FEATURE_TSC 4
+#define CPU_FEATURE_MSR 5
+#define CPU_FEATURE_PAE 6
+#define CPU_FEATURE_MCE 7
+#define CPU_FEATURE_CX8 8
+#define CPU_FEATURE_APIC 9
+#define CPU_FEATURE_SEP 11
+#define CPU_FEATURE_MTRR 12
+#define CPU_FEATURE_PGE 13
+#define CPU_FEATURE_MCA 14
+#define CPU_FEATURE_CMOV 15
+#define CPU_FEATURE_PAT 16
+#define CPU_FEATURE_PSE_36 17
+#define CPU_FEATURE_PSN 18
+#define CPU_FEATURE_CFLSH 19
+#define CPU_FEATURE_DS 21
+#define CPU_FEATURE_ACPI 22
+#define CPU_FEATURE_MMX 23
+#define CPU_FEATURE_FXSR 24
+#define CPU_FEATURE_SSE 25
+#define CPU_FEATURE_SSE2 26
+#define CPU_FEATURE_SS 27
+#define CPU_FEATURE_HTT 28
+#define CPU_FEATURE_TM 29
+#define CPU_FEATURE_PBE 31
+
+#define CPU_HAS_FEATURE(feature) (cpu_feature[(feature) / 32] & (1 << ((feature) % 32)))
+
#endif /* _MACHINE__LOCORE_H_ */