summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/x86/machine/cpu.c12
-rw-r--r--arch/x86/machine/cpu.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/arch/x86/machine/cpu.c b/arch/x86/machine/cpu.c
index ff7b7221..261e586e 100644
--- a/arch/x86/machine/cpu.c
+++ b/arch/x86/machine/cpu.c
@@ -538,6 +538,18 @@ cpu_check(const struct cpu *cpu)
if (!(cpu->features2 & CPU_FEATURE2_APIC)) {
cpu_panic_on_missing_feature("apic");
}
+
+ /*
+ * The compiler is expected to produce cmpxchg8b instructions to
+ * perform 64-bits atomic operations on a 32-bits processor. Clang
+ * currently has trouble doing that so 64-bits atomic support is
+ * just disabled when building with it.
+ */
+#if !defined(__LP64__) && !defined(__clang__)
+ if (!(cpu->features2 & CPU_FEATURE2_CX8)) {
+ cpu_panic_on_missing_feature("cx8");
+ }
+#endif
}
void
diff --git a/arch/x86/machine/cpu.h b/arch/x86/machine/cpu.h
index 862799e8..3bf1ade3 100644
--- a/arch/x86/machine/cpu.h
+++ b/arch/x86/machine/cpu.h
@@ -69,6 +69,7 @@
#define CPU_FEATURE2_PSE 0x00000008
#define CPU_FEATURE2_PAE 0x00000040
#define CPU_FEATURE2_MSR 0x00000020
+#define CPU_FEATURE2_CX8 0x00000100
#define CPU_FEATURE2_APIC 0x00000200
#define CPU_FEATURE2_PGE 0x00002000