[ros-diffs] [hyperion] 36610: modified ke/i386/cpu.c Added CMPXCHG8B enabling/detection code for TransMeta, Centaur and Rise (source: <URL: http://www.geoffchappell.com/notes/windows/kernel/cpu/cx8.htm>). Code dead until each vendor will be officially supported Alex and others: please review

hyperion at svn.reactos.org hyperion at svn.reactos.org
Wed Oct 1 13:54:29 CEST 2008


Author: hyperion
Date: Wed Oct  1 06:54:29 2008
New Revision: 36610

URL: http://svn.reactos.org/svn/reactos?rev=36610&view=rev
Log:
modified   ke/i386/cpu.c
   Added CMPXCHG8B enabling/detection code for TransMeta, Centaur and Rise (source: <URL: http://www.geoffchappell.com/notes/windows/kernel/cpu/cx8.htm>). Code dead until each vendor will be officially supported
   Alex and others: please review

Modified:
    trunk/reactos/ntoskrnl/ke/i386/cpu.c

Modified: trunk/reactos/ntoskrnl/ke/i386/cpu.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/i386/cpu.c?rev=36610&r1=36609&r2=36610&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ke/i386/cpu.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/i386/cpu.c [iso-8859-1] Wed Oct  1 06:54:29 2008
@@ -353,6 +353,46 @@
         CpuFeatures = Reg[3];
     }
 
+#ifdef CPU_TRANSMETA
+	if (Vendor == CPU_TRANSMETA)
+	{
+		/* Enable CMPXCHG8B if the family (>= 5), model and stepping (>= 4.2) support it */
+		if ((Reg[0] & 0x0F00) >= 0x0500 && (Reg[0] & 0x00FF) >= 0x0042)
+		{
+			WRMSR(0x80860004, RDMSR(0x80860004) | 0x0100);
+			FeatureBits |= KF_CMPXCHG8B;
+		}
+	}
+#endif
+
+#ifdef CPU_CENTAUR
+	if (Vendor == CPU_CENTAUR)
+	{
+		/* If CMPXCHG8B is not detected, try to enable it */
+		if (!(CpuFeatures & 0x00000100))
+		{
+			if ((Reg[0] & 0x0F00) == 0x0500)
+			{
+				WRMSR(0x0107, RDMSR(0x0107) | 0x02);
+				FeatureBits |= KF_CMPXCHG8B;
+			}
+			else if ((Reg[0] & 0x0F00) >= 0x0600)
+			{
+				WRMSR(0x1107, (RDMSR(0x1107) | 0x02) & ~((LONGLONG)0x01));
+				FeatureBits |= KF_CMPXCHG8B;
+			}
+		}
+	}
+#endif
+
+#ifdef CPU_RISE
+	if (Vendor == CPU_RISE)
+	{
+		/* Windows Vista assumes CMPXCHG8B is always supported on Rise */
+		FeatureBits |= KF_CMPXCHG8B;
+	}
+#endif
+
     /* Convert all CPUID Feature bits into our format */
     if (CpuFeatures & 0x00000002) FeatureBits |= KF_V86_VIS | KF_CR4;
     if (CpuFeatures & 0x00000008) FeatureBits |= KF_LARGE_PAGE | KF_CR4;



More information about the Ros-diffs mailing list