GetSystemInfo() fix

Andreas Mohr a.mohr at mailto.de
Fri Jun 22 17:19:28 CDT 2001


Hi all,

GetSystemInfo() didn't support the Pentium 4 at all,
and it didn't even print an error message in this case. Doh !

I didn't bother to add P4 support for the old Linux 2.0
/proc/cpuinfo case, BTW.
(who wants to run Linux 2.0.x on a P4 anyway ?)

For heaven's sake, people:
the moment you add a switch() statement to your code:
check whether you *really* don't need to add a FIXME()
to the default: line !!!!

Hmpf,

Andreas Mohr
-------------- next part --------------
Determining best CVS host...
Using CVSROOT :pserver:cvs at winehq.tiepmiep.dk:/home/wine
Index: misc/cpu.c
===================================================================
RCS file: /home/wine/wine/misc/cpu.c,v
retrieving revision 1.20
diff -u -r1.20 cpu.c
--- misc/cpu.c	2001/06/13 20:13:20	1.20
+++ misc/cpu.c	2001/06/22 20:14:48
@@ -25,7 +25,7 @@
  *
  * Gets the current system information.
  *
- * On the first call it reads cached values, so it doesn't have to determine
+ * On the first call it creates cached values, so it doesn't have to determine
  * them repeatedly. On Linux, the /proc/cpuinfo special file is used.
  *
  * It creates a registry subhierarchy, looking like:
@@ -36,6 +36,8 @@
  *							
  * It also creates a cached flag array for IsProcessorFeaturePresent().
  *
+ * No NULL ptr check for LPSYSTEM_INFO in Win9x.
+ * 
  * RETURNS
  *	nothing, really
  */
@@ -113,13 +115,20 @@
 				case 4: cachedsi.dwProcessorType = PROCESSOR_INTEL_486;
 					cachedsi.wProcessorLevel= 4;
 					break;
-				case 5: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
+				case 5:
+				case 6: /* PPro/2/3 has same info as P1 */
+					cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
 					cachedsi.wProcessorLevel= 5;
 					break;
-				case 6: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
-					cachedsi.wProcessorLevel= 5;
-					break;
+				case 1: /* two-figure levels */
+					switch (value[1] - '0') {
+					case 5: /* P4; FIXME: data correct ? */
+					  cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
+					  cachedsi.wProcessorLevel= 5;
+					  break;
+					} /* fall through to prev. default */
 				default:
+					FIXME("unknown cpu family '%s', please report ! (-> setting to 386)\n", value);
 					break;
 				}
 			}
@@ -141,17 +150,21 @@
 				case 4: cachedsi.dwProcessorType = PROCESSOR_INTEL_486;
 					cachedsi.wProcessorLevel= 4;
 					break;
-				case 5: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
+				case 5:
+				case 6: /* PPro/2/3 has same info as P1 */
+					cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
 					cachedsi.wProcessorLevel= 5;
 					break;
-				case 6: cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
-					cachedsi.wProcessorLevel= 5;
-					break;
 				default:
+					FIXME("unknown Linux 2.0 cpu family '%s', please report ! (-> setting to 386)\n", value);
 					break;
 				}
 			}
-			/* set the CPU type of the current processor */
+			/* set the CPU type of the current processor
+			 * FIXME: someone reported P4 as being set to
+			 * "              Intel(R) Pentium(R) 4 CPU 1500MHz"
+			 * Do we need to do the same ?
+			 * */
 			sprintf(buf,"CPU %ld",cachedsi.dwProcessorType);
 			if (xhkey)
 				RegSetValueExA(xhkey,"Identifier",0,REG_SZ,buf,strlen(buf));
@@ -222,7 +235,7 @@
 /***********************************************************************
  * 			IsProcessorFeaturePresent	[KERNEL32.@]
  * RETURNS:
- *	TRUE if processorfeature present
+ *	TRUE if processor feature present
  *	FALSE otherwise
  */
 BOOL WINAPI IsProcessorFeaturePresent (


More information about the wine-patches mailing list