Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/cpuctl/arch Decode Intel/AMD MONITOR/MWAIT leaf.



details:   https://anonhg.NetBSD.org/src/rev/39c5816e1d81
branches:  trunk
changeset: 446071:39c5816e1d81
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Nov 22 06:15:06 2018 +0000

description:
Decode Intel/AMD MONITOR/MWAIT leaf.

diffstat:

 usr.sbin/cpuctl/arch/i386.c |  27 +++++++++++++++++++++++++--
 1 files changed, 25 insertions(+), 2 deletions(-)

diffs (48 lines):

diff -r c40e33489c8c -r 39c5816e1d81 usr.sbin/cpuctl/arch/i386.c
--- a/usr.sbin/cpuctl/arch/i386.c       Thu Nov 22 06:14:35 2018 +0000
+++ b/usr.sbin/cpuctl/arch/i386.c       Thu Nov 22 06:15:06 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i386.c,v 1.88 2018/11/21 12:19:51 msaitoh Exp $        */
+/*     $NetBSD: i386.c,v 1.89 2018/11/22 06:15:06 msaitoh Exp $        */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.88 2018/11/21 12:19:51 msaitoh Exp $");
+__RCSID("$NetBSD: i386.c,v 1.89 2018/11/22 06:15:06 msaitoh Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -2160,6 +2160,29 @@
 
        identifycpu_cpuids(ci);
 
+       if ((ci->ci_cpuid_level >= 5)
+           && ((cpu_vendor == CPUVENDOR_INTEL)
+               || (cpu_vendor == CPUVENDOR_AMD))) {
+               uint16_t lmin, lmax;
+               x86_cpuid(5, descs);
+               
+               print_bits(cpuname, "MONITOR/MWAIT extensions",
+                   CPUID_MON_FLAGS, descs[2]);
+               lmin = __SHIFTOUT(descs[0], CPUID_MON_MINSIZE);
+               lmax = __SHIFTOUT(descs[1], CPUID_MON_MAXSIZE);
+               aprint_normal("%s: monitor-line size %hu", cpuname, lmin);
+               if (lmin != lmax)
+                       aprint_normal("-%hu", lmax);
+               aprint_normal("\n");
+
+               for (i = 0; i <= 7; i++) {
+                       unsigned int num = CPUID_MON_SUBSTATE(descs[3], i);
+
+                       if (num != 0)
+                               aprint_normal("%s: C%u substates %u\n",
+                                   cpuname, i, num);
+               }
+       }
        if ((ci->ci_cpuid_level >= 6)
            && ((cpu_vendor == CPUVENDOR_INTEL)
                || (cpu_vendor == CPUVENDOR_AMD))) {



Home | Main Index | Thread Index | Old Index