From owner-freebsd-current@FreeBSD.ORG Tue Feb 7 23:01:53 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5067716A420; Tue, 7 Feb 2006 23:01:53 +0000 (GMT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9FA5D43D46; Tue, 7 Feb 2006 23:01:49 +0000 (GMT) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.3/8.13.3) with ESMTP id k17N1huG056096; Wed, 8 Feb 2006 02:01:43 +0300 (MSK) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.3/8.13.3/Submit) id k17N1gBl056095; Wed, 8 Feb 2006 02:01:42 +0300 (MSK) (envelope-from yar) Date: Wed, 8 Feb 2006 02:01:42 +0300 From: Yar Tikhiy To: Cy Schubert Message-ID: <20060207230142.GD32998@comp.chem.msu.su> References: <20060207182755.GB32998@comp.chem.msu.su> <200602071834.k17IYGcv036104@cwsys.cwsent.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200602071834.k17IYGcv036104@cwsys.cwsent.com> User-Agent: Mutt/1.5.9i Cc: freebsd-current@freebsd.org, netchild@freebsd.org Subject: Re: 7.0-CURRENT Hang X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Feb 2006 23:01:53 -0000 On Tue, Feb 07, 2006 at 10:34:16AM -0800, Cy Schubert wrote: > In message <20060207182755.GB32998@comp.chem.msu.su>, Yar Tikhiy writes: > > On Tue, Feb 07, 2006 at 10:06:32AM -0800, Cy Schubert wrote: > > > In message <20060207173154.GE19674@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 @@ -1235,34 +1235,23 @@ 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) { @@ -1451,28 +1440,16 @@ 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); @@ -1482,11 +1459,9 @@ 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);