summaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
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_ */