[patch] extending {amd64|i386} cpu info

Alexander Best alexbestms at wwu.de
Sat Feb 27 03:19:54 UTC 2010


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
-------------- next part --------------
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) {


More information about the freebsd-hackers mailing list