Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Feb 2010 04:19:46 +0100 (CET)
From:      Alexander Best <alexbestms@wwu.de>
To:        <freebsd-hackers@FreeBSD.org>
Subject:   [patch] extending {amd64|i386} cpu info
Message-ID:  <permail-2010022703194680e26a0b00002027-a_best01@message-id.uni-muenster.de>

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

[-- Attachment #1 --]
hi there,

i always forget how to decipher model and family from the cpu id. of course
there're 3rd party tools to do that for you, but instead i decided to hack the
kernel. ;)

maybe somebody finds these changes useful.

cheers.
alex

[-- Attachment #2 --]
Index: sys/amd64/amd64/identcpu.c
===================================================================
--- sys/amd64/amd64/identcpu.c	(revision 204383)
+++ sys/amd64/amd64/identcpu.c	(working copy)
@@ -187,7 +187,12 @@
 	if (cpu_vendor_id == CPU_VENDOR_INTEL ||
 	    cpu_vendor_id == CPU_VENDOR_AMD ||
 	    cpu_vendor_id == CPU_VENDOR_CENTAUR) {
-		printf("  Stepping = %u", cpu_id & 0xf);
+		printf("  Stepping = %u"
+		       "  Model = %u"
+		       "  Family = %u",
+		       cpu_id & CPUID_STEPPING,
+		       CPUID_TO_MODEL(cpu_id),
+		       CPUID_TO_FAMILY(cpu_id));
 		if (cpu_high > 0) {
 
 			/*
Index: sys/i386/i386/identcpu.c
===================================================================
--- sys/i386/i386/identcpu.c	(revision 204383)
+++ sys/i386/i386/identcpu.c	(working copy)
@@ -672,7 +672,12 @@
 	    cpu_vendor_id == CPU_VENDOR_NSC ||
 		(cpu_vendor_id == CPU_VENDOR_CYRIX &&
 		 ((cpu_id & 0xf00) > 0x500))) {
-		printf("  Stepping = %u", cpu_id & 0xf);
+		printf("  Stepping = %u"
+		       "  Model = %u"
+		       "  Family = %u",
+		       cpu_id & CPUID_STEPPING,
+		       CPUID_TO_MODEL(cpu_id),
+		       CPUID_TO_FAMILY(cpu_id));
 		if (cpu_vendor_id == CPU_VENDOR_CYRIX)
 			printf("  DIR=0x%04x", cyrix_did);
 		if (cpu_high > 0) {

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?permail-2010022703194680e26a0b00002027-a_best01>