Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 09 Jan 2003 14:21:17 +0100
From:      Dag-Erling Smorgrav <des@ofug.org>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org
Subject:   Re: cvs commit: src/sys/i386/i386 identcpu.c
Message-ID:  <xzpznqafohe.fsf@flood.ping.uio.no>
In-Reply-To: <XFMail.20030108134204.jhb@FreeBSD.org> (John Baldwin's message of "Wed, 08 Jan 2003 13:42:04 -0500 (EST)")
References:  <XFMail.20030108134204.jhb@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=

John Baldwin <jhb@FreeBSD.org> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpznqafohe.fsf>