From owner-cvs-all Thu Jan 9 5:21:24 2003 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 D5DB337B401; Thu, 9 Jan 2003 05:21:21 -0800 (PST) Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0518243F18; Thu, 9 Jan 2003 05:21:21 -0800 (PST) (envelope-from des@ofug.org) Received: by flood.ping.uio.no (Postfix, from userid 2602) id BF8735374; Thu, 9 Jan 2003 14:21:18 +0100 (CET) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: John Baldwin Cc: cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org Subject: Re: cvs commit: src/sys/i386/i386 identcpu.c References: From: Dag-Erling Smorgrav Date: Thu, 09 Jan 2003 14:21:17 +0100 In-Reply-To: (John Baldwin's message of "Wed, 08 Jan 2003 13:42:04 -0500 (EST)") Message-ID: Lines: 16 User-Agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (i386--freebsd) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --=-=-= John Baldwin writes: >> dmesg | grep CPU: > CPU: Intel(R) Pentium(R) 4 CPU 2.40GHz (2399.93-MHz 686-class CPU) Hmm, I never noticed the hyphen (in front of MHz) before, though I see now that it's been there for a long time. It should go away. BTW, tsc_freq is an unsigned int... we'd better do something about that before someone tries to run FreeBSD on a >4.2 GHz ia32. DES -- Dag-Erling Smorgrav - des@ofug.org --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=identcpu.diff Index: identcpu.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/identcpu.c,v retrieving revision 1.113 diff -u -r1.113 identcpu.c --- identcpu.c 8 Jan 2003 19:16:11 -0000 1.113 +++ identcpu.c 9 Jan 2003 13:18:50 -0000 @@ -523,6 +523,19 @@ #endif printf("%s (", cpu_model); +#if defined(I586_CPU) || defined(I686_CPU) + if (tsc_freq > 0) { + if (tsc_freq > 1000000000U) { + printf("%d.%02u GHz ", + (tsc_freq + 4999) / 1000000000U, + ((tsc_freq + 4999) / 10000000U) % 100); + } else { + printf("%d.%02u MHz ", + (tsc_freq + 4999) / 1000000U, + ((tsc_freq + 4999) / 10000U) % 100); + } + } +#endif switch(cpu_class) { case CPUCLASS_286: printf("286"); @@ -540,17 +553,11 @@ #endif #if defined(I586_CPU) case CPUCLASS_586: - printf("%d.%02d-MHz ", - (tsc_freq + 4999) / 1000000, - ((tsc_freq + 4999) / 10000) % 100); printf("586"); break; #endif #if defined(I686_CPU) case CPUCLASS_686: - printf("%d.%02d-MHz ", - (tsc_freq + 4999) / 1000000, - ((tsc_freq + 4999) / 10000) % 100); printf("686"); break; #endif --=-=-=-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message