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

be sure that AM, NE and MP is enabled

This commit is contained in:
Stefan Lankes 2015-09-02 22:36:46 +02:00
parent 2d3a67cb89
commit 73ee21674b

View file

@ -210,7 +210,7 @@ int cpu_detection(void) {
uint64_t xcr0;
uint32_t a=0, b=0, c=0, d=0, level = 0;
uint32_t family, model, stepping;
size_t cr4;
size_t cr0, cr4;
uint8_t first_time = 0;
if (!cpu_info.feature1) {
@ -255,6 +255,13 @@ int cpu_detection(void) {
kprintf("Syscall instruction: %s\n", (cpu_info.feature3 & CPU_FEATURE_SYSCALL) ? "available" : "unavailable");
}
// be sure that AM, NE and MP is enabled
cr0 = read_cr0();
cr0 |= CR0_AM;
cr0 |= CR0_NE;
cr0 |= CR0_MP;
write_cr0(cr0);
cr4 = read_cr4();
if (has_fxsr())
cr4 |= CR4_OSFXSR; // set the OSFXSR bit