patch-2.0.37 linux/include/asm-i386/bugs.h

Next file: linux/include/asm-i386/ioctls.h
Previous file: linux/include/asm-alpha/ioctls.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.36/linux/include/asm-i386/bugs.h linux/include/asm-i386/bugs.h
@@ -132,6 +132,24 @@
 extern int pentium_f00f_bug;
 extern void trap_init_f00f_bug(void);
 
+/*
+ * Access to machine-specific registers (available on 586 and better only)
+ * Note: the rd* operations modify the parameters directly (without using
+ * pointer indirection), this allows gcc to optimize better
+ * Code from Richard Gooch's 2.2 MTRR drivers.
+ */
+ 
+#define rdmsr(msr,val1,val2) \
+       __asm__ __volatile__("rdmsr" \
+			    : "=a" (val1), "=d" (val2) \
+			    : "c" (msr))
+
+#define wrmsr(msr,val1,val2) \
+     __asm__ __volatile__("wrmsr" \
+			  : /* no outputs */ \
+			  : "c" (msr), "a" (val1), "d" (val2))
+
+
 static void check_pentium_f00f(void)
 {
 	/*
@@ -145,6 +163,26 @@
 	}
 }
 
+static void check_privacy(void)
+{
+	/*
+	 * Pentium III or higher - processors with mtrrs/cpuid
+	 */
+	if(memcmp(x86_vendor_id, "GenuineIntel", 12))
+		return;
+	if(x86_capability & (1<<18))
+	{
+		/*
+		 *	Thanks to Phil Karn for this bit.
+		 */
+		unsigned long lo,hi;
+		rdmsr(0x119,lo,hi);
+		lo |= 0x200000;
+		wrmsr(0x119,lo,hi);
+		printk(KERN_INFO "Pentium-III serial number disabled.\n");
+	}		
+}
+
 /*
  *      B step AMD K6 before B 9730xxxx have hardware bugs that can cause
  *      misexecution of code under Linux. Owners of such processors should
@@ -335,5 +373,6 @@
 	check_fpu();
 	check_hlt();
 	check_pentium_f00f();
+	check_privacy();
 	system_utsname.machine[1] = '0' + x86;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov