Re: 7.0-CURRENT Hang

From: Yar Tikhiy <yar_at_comp.chem.msu.su>
Date: Wed, 8 Feb 2006 02:01:42 +0300
On Tue, Feb 07, 2006 at 10:34:16AM -0800, Cy Schubert wrote:
> In message <20060207182755.GB32998_at_comp.chem.msu.su>, Yar Tikhiy writes:
> > On Tue, Feb 07, 2006 at 10:06:32AM -0800, Cy Schubert wrote:
> > > In message <20060207173154.GE19674_at_comp.chem.msu.su>, Yar Tikhiy writes:
> > > > On Mon, Feb 06, 2006 at 08:29:35PM -0800, Cy Schubert wrote:
> 
> cwtest# /usr/local/bin/cpuid
>  eax in    eax      ebx      ecx      edx
> 00000000 00000001 756e6547 6c65746e 49656e69
                 ^^
> 00000001 0000052c 00000000 00000000 000001bf

Thanks for getting these data!  They tell that your CPU doesn't
support CPUID functions above 0x01, which is completely OK for
a Pentium.

Would you mind giving a try to the attached patch?  It should fix
the CPUID 0x02 issue while reducing code duplication.

-- 
Yar

Index: identcpu.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/i386/identcpu.c,v
retrieving revision 1.157
diff -u -p -r1.157 identcpu.c
--- identcpu.c	2 Feb 2006 12:44:09 -0000	1.157
+++ identcpu.c	7 Feb 2006 22:42:13 -0000
_at__at_ -1235,34 +1235,23 _at__at_ print_INTEL_info(void)
 	u_int rounds, regnum;
 	u_int nwaycode, nway;
 
-	do_cpuid(0x2, regs);
-
-	rounds = (regs[0] & 0xff) - 1;
-
-	for (regnum = 0; regnum <= 3; ++regnum) {
-		if ((regs[regnum] & (1<<31)) == 0) {
-			if (regnum != 0)
-				print_INTEL_TLB(regs[regnum] & 0xff);
-			print_INTEL_TLB((regs[regnum] >> 8) & 0xff);
-			print_INTEL_TLB((regs[regnum] >> 16) & 0xff);
-			print_INTEL_TLB((regs[regnum] >> 24) & 0xff);
-		}
-	}
-
-	while (rounds > 0) {
-		do_cpuid(0x2, regs);
-
-		for (regnum = 0; regnum <= 3; ++regnum) {
-			if ((regs[regnum] & (1<<31)) == 0) {
+	if (cpu_high >= 2) {
+		rounds = 0;
+		do {
+			do_cpuid(0x2, regs);
+			if (rounds == 0 && (rounds = (regs[0] & 0xff)) == 0)
+				break;	/* we have a buggy CPU */
+
+			for (regnum = 0; regnum <= 3; ++regnum) {
+				if (regs[regnum] & (1<<31))
+					continue;
 				if (regnum != 0)
 					print_INTEL_TLB(regs[regnum] & 0xff);
 				print_INTEL_TLB((regs[regnum] >> 8) & 0xff);
 				print_INTEL_TLB((regs[regnum] >> 16) & 0xff);
 				print_INTEL_TLB((regs[regnum] >> 24) & 0xff);
 			}
-		}
-
-		--rounds;
+		} while (--rounds > 0);
 	}
 
 	if (cpu_exthigh >= 0x80000006) {
_at__at_ -1451,28 +1440,16 _at__at_ setPQL2_INTEL(int *const size, int *cons
 	u_int regs[4];
 	u_int nwaycode;
 
-	do_cpuid(0x2, regs);
-	rounds = (regs[0] & 0xff) - 1;
-
-	for (regnum = 0; regnum <= 3; ++regnum) {
-		if ((regs[regnum] & (1<<31)) == 0) {
-			if (regnum != 0)
-				get_INTEL_TLB(regs[regnum] & 0xff,
-				    size, ways);
-			get_INTEL_TLB((regs[regnum] >> 8) & 0xff,
-			    size, ways);
-			get_INTEL_TLB((regs[regnum] >> 16) & 0xff,
-			    size, ways);
-			get_INTEL_TLB((regs[regnum] >> 24) & 0xff,
-			    size, ways);
-		}
-	}
-
-	while (rounds > 0) {
-		do_cpuid(0x2, regs);
-
-		for (regnum = 0; regnum <= 3; ++regnum) {
-			if ((regs[regnum] & (1<<31)) == 0) {
+	if (cpu_high >= 2) {
+		rounds = 0;
+		do {
+			do_cpuid(0x2, regs);
+			if (rounds == 0 && (rounds = (regs[0] & 0xff)) == 0)
+				break;	/* we have a buggy CPU */
+
+			for (regnum = 0; regnum <= 3; ++regnum) {
+				if (regs[regnum] & (1<<31))
+					continue;
 				if (regnum != 0)
 					get_INTEL_TLB(regs[regnum] & 0xff,
 					    size, ways);
_at__at_ -1482,11 +1459,9 _at__at_ setPQL2_INTEL(int *const size, int *cons
 				    size, ways);
 				get_INTEL_TLB((regs[regnum] >> 24) & 0xff,
 				    size, ways);
-                        }
-                }
-
-                --rounds;
-        }
+			}
+		} while (--rounds > 0);
+	}
 
 	if (cpu_exthigh >= 0x80000006) {
 		do_cpuid(0x80000006, regs);
Received on Tue Feb 07 2006 - 22:01:53 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:52 UTC