From owner-cvs-all@FreeBSD.ORG Tue Feb 8 05:27:25 2005 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A321916A4CE; Tue, 8 Feb 2005 05:27:25 +0000 (GMT) Received: from mailout2.pacific.net.au (mailout2.pacific.net.au [61.8.0.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0367743D45; Tue, 8 Feb 2005 05:27:25 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86])j185RNHn031414; Tue, 8 Feb 2005 16:27:23 +1100 Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) j185RKVU019701; Tue, 8 Feb 2005 16:27:21 +1100 Date: Tue, 8 Feb 2005 16:27:20 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: John Baldwin In-Reply-To: <200502071015.39224.jhb@FreeBSD.org> Message-ID: <20050208155258.O21504@delplex.bde.org> References: <200502061655.j16GtqDK033151@repoman.freebsd.org> <200502071015.39224.jhb@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org cc: Ian Dowse Subject: Re: cvs commit: src/sys/dev/random probe.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Feb 2005 05:27:25 -0000 On Mon, 7 Feb 2005, John Baldwin wrote: > On Sunday 06 February 2005 11:55 am, Ian Dowse wrote: > > iedowse 2005-02-06 16:55:52 UTC > > > > FreeBSD src repository > > > > Modified files: > > sys/dev/random probe.c > > Log: > > Check that we have at least a 586-class CPU before calling do_cpuid(). > > This fixes booting on a number of 486 processors. > > This is wrong. Some 486's do have cpuid, notable the dx4's (I used to have > one.) The correct test is to see if you can flip a bit in %eflags (can't > remember which one). If that flag stays at zero then you don't have cpuid, > if the bit follows the value written to it then you do have cpuid. Actually, the correct test is to see if the CPUID_CPUID bit is set in the cpu_feature word. locore.s has already done the %eflags test and repeating it in "MD" code would be even uglier than calling do_cpuid(). Since the cpuid instuction doesn't set a self-referential bit, CPUID_CPUID doesn't exist yet and it needs to be put in cpu_feature as a software bit. Since cpu_feature has no space to spare, it needs to be extended. It should be extended for other reasons: to avoid the almost useless cpu classes. Related bugs: cpu_feature actually has negative space to spare. The CPUID_XMM and CPUID_SSE bits in it are aliased. This amplifies the bug that testing the CPU_SSE bit in cpu_feature is an invalid test for SSE instructions being available. enable_sse() only enables CR4_XMM if both CPUID_FXSR and CPUID_XMM are set. Testing just CPUID_SSE is also invalid if CPU_ENABLE_SSE is not configured. CPUID_SSE should be the preferred name, since it is better known and is what printcpuinfo() prints, and the CPUID_SSE bit should be cleared in cpu_feature if the software decides not to support SSE, so that the tangled logic in enable_sse() doesn't need to be repeated. Bruce