Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/amd64/initcpu.c
Show First 20 Lines • Show All 227 Lines • ▼ Show 20 Lines | initializecpu(void) | ||||
cr4 = rcr4(); | cr4 = rcr4(); | ||||
if ((cpu_feature & CPUID_XMM) && (cpu_feature & CPUID_FXSR)) { | if ((cpu_feature & CPUID_XMM) && (cpu_feature & CPUID_FXSR)) { | ||||
cr4 |= CR4_FXSR | CR4_XMM; | cr4 |= CR4_FXSR | CR4_XMM; | ||||
cpu_fxsr = hw_instruction_sse = 1; | cpu_fxsr = hw_instruction_sse = 1; | ||||
} | } | ||||
if (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) | if (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) | ||||
cr4 |= CR4_FSGSBASE; | cr4 |= CR4_FSGSBASE; | ||||
if (cpu_stdext_feature2 & CPUID_STDEXT2_PKU) | |||||
cr4 |= CR4_PKE; | |||||
/* | /* | ||||
* Postpone enabling the SMEP on the boot CPU until the page | * Postpone enabling the SMEP on the boot CPU until the page | ||||
* tables are switched from the boot loader identity mapping | * tables are switched from the boot loader identity mapping | ||||
* to the kernel tables. The boot loader enables the U bit in | * to the kernel tables. The boot loader enables the U bit in | ||||
* its tables. | * its tables. | ||||
*/ | */ | ||||
if (!IS_BSP()) { | if (!IS_BSP()) { | ||||
if (cpu_stdext_feature & CPUID_STDEXT_SMEP) | if (cpu_stdext_feature & CPUID_STDEXT_SMEP) | ||||
▲ Show 20 Lines • Show All 55 Lines • Show Last 20 Lines |