[Mplayer-cvslog] CVS: main cpudetect.c,1.10,1.11 cpudetect.h,1.5,1.6

Michael Niedermayer michael at mplayer.dev.hu
Tue Nov 27 00:09:06 CET 2001


Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv23027

Modified Files:
	cpudetect.c cpudetect.h 
Log Message:
non x86 fix (otherwise we would need #ifdef ARCH_X86 around every if(gCpuCaps.has...))


Index: cpudetect.c
===================================================================
RCS file: /cvsroot/mplayer/main/cpudetect.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- cpudetect.c	23 Oct 2001 13:02:44 -0000	1.10
+++ cpudetect.c	26 Nov 2001 23:08:48 -0000	1.11
@@ -1,6 +1,8 @@
 #include "config.h"
 #include "cpudetect.h"
 
+CpuCaps gCpuCaps;
+
 #ifdef ARCH_X86
 
 #include <stdio.h>
@@ -22,7 +24,6 @@
 
 /* I believe this code works.  However, it has only been used on a PII and PIII */
 
-CpuCaps gCpuCaps;
 static void check_os_katmai_support( void );
 
 #if 1
@@ -83,7 +84,9 @@
 {
 	unsigned int regs[4];
 	unsigned int regs2[4];
-	
+
+	caps->isX86=1;
+
 	bzero(caps, sizeof(*caps));
 	if (!has_cpuid()) {
 	    printf("CPUID not supported!???\n");
@@ -94,7 +97,7 @@
 	if (regs[0]>=0x00000001)
 	{
 		char *tmpstr;
-		
+
 		do_cpuid(0x00000001, regs2);
 
 		tmpstr=GetCpuFriendlyName(regs, regs2);
@@ -142,7 +145,9 @@
 		caps->hasSSE=0;
 		caps->hasSSE2 = 0;
 #endif
-
+//		caps->has3DNow=1;
+//		caps->hasMMX2 = 0;
+//		caps->hasMMX = 0;
 
 }
 
@@ -166,7 +171,7 @@
 	}
 
 	sprintf(vendor,"%.4s%.4s%.4s",&regs[1],&regs[3],&regs[2]);
-	
+
 	for(i=0; i<MAX_VENDORS; i++){
 		if(!strcmp(cpuvendors[i].string,vendor)){
 			if(cpuname[i][CPUID_FAMILY][CPUID_MODEL]){
@@ -337,4 +342,17 @@
    gCpuCaps.hasSSE=0;
 #endif /* __linux__ */
 }
-#endif /* ARCH_X86 */
+#else /* ARCH_X86 */
+
+void GetCpuCaps( CpuCaps *caps)
+{
+	caps->cpuType=0;
+	caps->hasMMX=0;
+	caps->hasMMX2=0;
+	caps->has3DNow=0;
+	caps->has3DNowExt=0;
+	caps->hasSSE=0;
+	caps->hasSSE2=0;
+	caps->isX86=0;
+}
+#endif /* !ARCH_X86 */

Index: cpudetect.h
===================================================================
RCS file: /cvsroot/mplayer/main/cpudetect.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- cpudetect.h	20 Oct 2001 11:16:47 -0000	1.5
+++ cpudetect.h	26 Nov 2001 23:08:48 -0000	1.6
@@ -1,4 +1,5 @@
-#ifdef ARCH_X86
+#ifndef CPUDETECT_H
+#define CPUDETECT_H
 
 #define CPUTYPE_I386	3
 #define CPUTYPE_I486	4
@@ -13,6 +14,7 @@
 	int has3DNowExt;
 	int hasSSE;
 	int hasSSE2;
+	int isX86;
 } CpuCaps;
 
 extern CpuCaps gCpuCaps;
@@ -22,5 +24,5 @@
 /* returned value is malloc()'ed so free() it after use */
 char *GetCpuFriendlyName(unsigned int regs[], unsigned int regs2[]);
 
-#endif /* ARCH_X86 */
+#endif /* !CPUDETECT_H */
 




More information about the MPlayer-cvslog mailing list