Page MenuHomeFreeBSD

D35555.id107290.diff
No OneTemporary

D35555.id107290.diff

Index: sys/compat/linprocfs/linprocfs.c
===================================================================
--- sys/compat/linprocfs/linprocfs.c
+++ sys/compat/linprocfs/linprocfs.c
@@ -140,6 +140,17 @@
*/
static char linux_state[] = "RRSTZDD";
+/*
+ * Save a local copy of the some ext cpu feature:
+ * cpu_stdext_feature2 should be reloaded to reflect cr4 changes.
+ * cpu_stdext_feature3 is zeroed by the kernel in the acpi code.
+ */
+#if defined(__i386__) || defined(__amd64__)
+static u_int lin_cpu_stdext_feature2 = 0;
+static u_int lin_cpu_stdext_feature3 = 0;
+static u_int lin_cpu_stdext_l1_feature = 0;
+#endif
+
/*
* Filler function for proc/meminfo
*/
@@ -2001,6 +2012,24 @@
return (0);
}
+static void
+linprocfs_cache_cpuid()
+{
+#if defined(__i386__) || defined(__amd64__)
+ u_int regs[4];
+
+ if (cpu_high >= 7) {
+ cpuid_count(7, 0, regs);
+ lin_cpu_stdext_feature2 = regs[2];
+ lin_cpu_stdext_feature3 = regs[3];
+ if ((cpu_feature2 & CPUID2_XSAVE) != 0) {
+ cpuid_count(0xd, 0x1, regs);
+ lin_cpu_stdext_l1_feature = regs[0];
+ }
+ }
+#endif
+}
+
/*
* Constructor
*/
@@ -2011,6 +2040,8 @@
struct pfs_node *dir;
struct pfs_node *sys;
+ linprocfs_cache_cpuid();
+
root = pi->pi_root;
/* /proc/... */

File Metadata

Mime Type
text/plain
Expires
Wed, Apr 22, 6:00 AM (14 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31957419
Default Alt Text
D35555.id107290.diff (1 KB)

Event Timeline