diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h index 24ae11b78..15aa50a70 100644 --- a/arch/x86/include/asm/processor.h +++ b/arch/x86/include/asm/processor.h @@ -52,6 +52,7 @@ extern "C" { #define CPU_FEATURE_PSE (1 << 3) #define CPU_FEATURE_MSR (1 << 5) #define CPU_FEATURE_PAE (1 << 6) +#define CPU_FEATURE_MCE (1 << 7) #define CPU_FEATURE_APIC (1 << 9) #define CPU_FEATURE_SEP (1 << 11) #define CPU_FEATURE_PGE (1 << 13) @@ -308,6 +309,10 @@ inline static uint32_t has_msr(void) { return (cpu_info.feature1 & CPU_FEATURE_MSR); } +inline static uint32_t has_mce(void) { + return (cpu_info.feature1 & CPU_FEATURE_MCE); +} + inline static uint32_t has_apic(void) { return (cpu_info.feature1 & CPU_FEATURE_APIC); } diff --git a/arch/x86/kernel/processor.c b/arch/x86/kernel/processor.c index 55f6dbdc1..8da294e21 100644 --- a/arch/x86/kernel/processor.c +++ b/arch/x86/kernel/processor.c @@ -472,6 +472,8 @@ int cpu_detection(void) { cr4 |= CR4_PGE; if (has_fsgsbase()) cr4 |= CR4_FSGSBASE; + if (has_mce()) + cr4 |= CR4_MCE; // enable machine check exceptions //if (has_vmx()) // cr4 |= CR4_VMXE; cr4 &= ~CR4_TSD; // => every privilege level is able to use rdtsc