amd64: Reload CPU ext features after resume or cr4 changes
Reviewed by: kib Differential revision: https://reviews.freebsd.org/D35555 MFC after: 2 weeks
This commit is contained in:
parent
8da00a514e
commit
050f5a8405
@ -292,6 +292,9 @@ initializecpu(void)
|
||||
cr4 |= CR4_SMAP;
|
||||
}
|
||||
load_cr4(cr4);
|
||||
/* Reload cpu ext features to reflect cr4 changes */
|
||||
if (IS_BSP())
|
||||
identify_cpu_ext_features();
|
||||
if (IS_BSP() && (amd_feature & AMDID_NX) != 0) {
|
||||
msr = rdmsr(MSR_EFER) | EFER_NXE;
|
||||
wrmsr(MSR_EFER, msr);
|
||||
|
@ -128,6 +128,7 @@ void restore_wp(bool old_wp);
|
||||
void finishidentcpu(void);
|
||||
void identify_cpu1(void);
|
||||
void identify_cpu2(void);
|
||||
void identify_cpu_ext_features(void);
|
||||
void identify_cpu_fixup_bsp(void);
|
||||
void identify_hypervisor(void);
|
||||
void initializecpu(void);
|
||||
|
@ -1608,6 +1608,18 @@ identify_cpu2(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
identify_cpu_ext_features(void)
|
||||
{
|
||||
u_int regs[4];
|
||||
|
||||
if (cpu_high >= 7) {
|
||||
cpuid_count(7, 0, regs);
|
||||
cpu_stdext_feature2 = regs[2];
|
||||
cpu_stdext_feature3 = regs[3];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
identify_cpu_fixup_bsp(void)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user