summaryrefslogtreecommitdiffstats
path: root/sys/x86
diff options
context:
space:
mode:
authorLuiz Souza <luiz@netgate.com>2018-02-23 19:42:43 -0300
committerLuiz Souza <luiz@netgate.com>2018-02-23 19:42:43 -0300
commit29512c967a8c82fe0de1e68058be2c424396dd86 (patch)
tree0d71f0c1f580139b0cd774314b1ffb6863b9a157 /sys/x86
parent3f57606fecd6abc41fc7048c7419ffa6193c94e2 (diff)
downloadFreeBSD-src-29512c967a8c82fe0de1e68058be2c424396dd86.zip
FreeBSD-src-29512c967a8c82fe0de1e68058be2c424396dd86.tar.gz
Revert "Revert "MFC r327597:""
This reverts commit 38b302a111c25b2ca850c0ce8761761b2c48164a.
Diffstat (limited to 'sys/x86')
-rw-r--r--sys/x86/include/x86_var.h3
-rw-r--r--sys/x86/x86/identcpu.c46
2 files changed, 28 insertions, 21 deletions
diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h
index 7705a1c..ffdf2f0 100644
--- a/sys/x86/include/x86_var.h
+++ b/sys/x86/include/x86_var.h
@@ -116,7 +116,8 @@ void cpu_setregs(void);
void dump_add_page(vm_paddr_t);
void dump_drop_page(vm_paddr_t);
void finishidentcpu(void);
-void identify_cpu(void);
+void identify_cpu1(void);
+void identify_cpu2(void);
void identify_hypervisor(void);
void initializecpu(void);
void initializecpucache(void);
diff --git a/sys/x86/x86/identcpu.c b/sys/x86/x86/identcpu.c
index c0cc2a6..ab7214c 100644
--- a/sys/x86/x86/identcpu.c
+++ b/sys/x86/x86/identcpu.c
@@ -1370,9 +1370,8 @@ fix_cpuid(void)
return (false);
}
-#ifdef __amd64__
void
-identify_cpu(void)
+identify_cpu1(void)
{
u_int regs[4];
@@ -1389,7 +1388,29 @@ identify_cpu(void)
cpu_feature = regs[3];
cpu_feature2 = regs[2];
}
-#endif
+
+void
+identify_cpu2(void)
+{
+ u_int regs[4], cpu_stdext_disable;
+
+ if (cpu_high >= 7) {
+ cpuid_count(7, 0, regs);
+ cpu_stdext_feature = regs[1];
+
+ /*
+ * Some hypervisors failed to filter out unsupported
+ * extended features. Allow to disable the
+ * extensions, activation of which requires setting a
+ * bit in CR4, and which VM monitors do not support.
+ */
+ cpu_stdext_disable = 0;
+ TUNABLE_INT_FETCH("hw.cpu_stdext_disable", &cpu_stdext_disable);
+ cpu_stdext_feature &= ~cpu_stdext_disable;
+
+ cpu_stdext_feature2 = regs[2];
+ }
+}
/*
* Final stage of CPU identification.
@@ -1397,7 +1418,7 @@ identify_cpu(void)
void
finishidentcpu(void)
{
- u_int regs[4], cpu_stdext_disable;
+ u_int regs[4];
#ifdef __i386__
u_char ccr3;
#endif
@@ -1416,22 +1437,7 @@ finishidentcpu(void)
cpu_mon_max_size = regs[1] & CPUID5_MON_MAX_SIZE;
}
- if (cpu_high >= 7) {
- cpuid_count(7, 0, regs);
- cpu_stdext_feature = regs[1];
-
- /*
- * Some hypervisors failed to filter out unsupported
- * extended features. Allow to disable the
- * extensions, activation of which requires setting a
- * bit in CR4, and which VM monitors do not support.
- */
- cpu_stdext_disable = 0;
- TUNABLE_INT_FETCH("hw.cpu_stdext_disable", &cpu_stdext_disable);
- cpu_stdext_feature &= ~cpu_stdext_disable;
-
- cpu_stdext_feature2 = regs[2];
- }
+ identify_cpu2();
#ifdef __i386__
if (cpu_high > 0 &&
OpenPOWER on IntegriCloud