Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 Use CPUID_TO_*() macros. This change fix a ...



details:   https://anonhg.NetBSD.org/src/rev/468e19a6cbb5
branches:  trunk
changeset: 342887:468e19a6cbb5
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Jan 13 08:05:58 2016 +0000

description:
Use CPUID_TO_*() macros. This change fix a bug that /proc/cpuinfo's CPU model
was incorrect on many newer CPUs and CPU family was incorrect on some AMD
machines.

diffstat:

 sys/arch/x86/x86/procfs_machdep.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r 3f36812fe8db -r 468e19a6cbb5 sys/arch/x86/x86/procfs_machdep.c
--- a/sys/arch/x86/x86/procfs_machdep.c Wed Jan 13 07:28:56 2016 +0000
+++ b/sys/arch/x86/x86/procfs_machdep.c Wed Jan 13 08:05:58 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: procfs_machdep.c,v 1.8 2016/01/13 07:28:56 msaitoh Exp $ */
+/*     $NetBSD: procfs_machdep.c,v 1.9 2016/01/13 08:05:58 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.8 2016/01/13 07:28:56 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.9 2016/01/13 08:05:58 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -267,8 +267,8 @@
            "stepping\t: ",
            xcpu,
            (char *)ci->ci_vendor,
-           cpuid_level >= 0 ? ((ci->ci_signature >> 8) & 15) : cpu_class + 3,
-           cpuid_level >= 0 ? ((ci->ci_signature >> 4) & 15) : 0,
+           CPUID_TO_FAMILY(ci->ci_signature),
+           CPUID_TO_MODEL(ci->ci_signature),
            cpu_brand_string
        );
        size += l;
@@ -279,7 +279,8 @@
                left = 0;
 
        if (cpuid_level >= 0)
-               l = snprintf(p, left, "%d\n", ci->ci_signature & 15);
+               l = snprintf(p, left, "%d\n",
+                   CPUID_TO_STEPPING(ci->ci_signature));
        else
                l = snprintf(p, left, "unknown\n");
 



Home | Main Index | Thread Index | Old Index