1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

enable support of machine check handling

This commit is contained in:
Stefan Lankes 2017-08-03 00:07:20 +02:00
parent a992690237
commit 9fe61a30db
2 changed files with 7 additions and 0 deletions

View file

@ -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);
}

View file

@ -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