Source-Changes-HG archive

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

[src/netbsd-7]: src/sys/arch/x86/x86 Pull up following revision(s) (requested...



details:   https://anonhg.NetBSD.org/src/rev/c42f28b1da86
branches:  netbsd-7
changeset: 800334:c42f28b1da86
user:      snj <snj%NetBSD.org@localhost>
date:      Mon Sep 11 05:50:12 2017 +0000

description:
Pull up following revision(s) (requested by msaitoh in ticket #1505):
        sys/arch/x86/x86/procfs_machdep.c: 1.15-1.16
- Print 0x00000007:0 ecx leaf bits.
- Don't print fdiv_bug on amd64.
- Print APIC ID, Initial APIC ID and clflush size.
--
Check buffer length correctly to not to print a garbage character.
Fixes PR#52352 reported by Yasushi Oshima.

diffstat:

 sys/arch/x86/x86/procfs_machdep.c |  74 +++++++++++++++++++++++++++++++++++---
 1 files changed, 67 insertions(+), 7 deletions(-)

diffs (134 lines):

diff -r 872bd728dfdf -r c42f28b1da86 sys/arch/x86/x86/procfs_machdep.c
--- a/sys/arch/x86/x86/procfs_machdep.c Mon Sep 11 05:46:43 2017 +0000
+++ b/sys/arch/x86/x86/procfs_machdep.c Mon Sep 11 05:50:12 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: procfs_machdep.c,v 1.6.4.2 2016/12/08 08:06:38 snj Exp $ */
+/*     $NetBSD: procfs_machdep.c,v 1.6.4.3 2017/09/11 05:50:12 snj Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.6.4.2 2016/12/08 08:06:38 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.6.4.3 2017/09/11 05:50:12 snj Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -131,7 +131,7 @@
        "clwb", NULL, "avx512pf", "avx512er",
        "avx512cd", "sha_ni", "avx512bw", "avx512vl"},
 
-       { /* (10) 0000000d eax */
+       { /* (10) 0x0000000d eax */
        "xsaveopt", "xsavec", "xgetbv1", "xsaves", NULL, NULL, NULL, NULL,
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -148,6 +148,38 @@
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+
+       { /* (13) 0x80000008 ebx */
+       "clzero", "irperf", NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+
+       { /* (14) 0x00000006 eax */
+       "dtherm", "ida", "arat", NULL, "pln", NULL, "pts", "hwp",
+       "hwp_notify", "hwp_act_window", "hwp_epp","hwp_pkg_req",
+       NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+
+       { /* (15) 0x8000000a edx */
+       "npt", "lbrv", "svm_lock", "nrip_save",
+       "tsc_scale", "vmcb_clean", "flushbyasid", "decodeassists",
+       NULL, NULL, "pausefilter", NULL, "pfthreshold", "avic", NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+
+       { /* (16) 0x00000007:0 ecx */
+       NULL, "avx512vbmi", NULL, "pku", "ospke", NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, "avx512_vpopcntdq", NULL,
+       "la57", NULL, NULL, NULL, NULL, NULL, "rdpid", NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
+
+       { /* (17) 0x80000007 ebx */
+       "overflow_recov", "succor", "smca", NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+       NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
 };
 
 static int     procfs_getonecpu(int, struct cpu_info *, char *, size_t *);
@@ -171,7 +203,7 @@
        for (CPU_INFO_FOREACH(cii, ci)) {
                procfs_getonecpu(i++, ci, bf, &used);
                total += used + 1;
-               if (used + 1 < size) {
+               if (used + 1 <= size) {
                        bf += used;
                        *bf++ = '\n';
                        size -= used + 1;
@@ -246,9 +278,18 @@
            left);
        diff = last - *left;
 
-       /* (10) 0000000d eax */
+       /* (10) 0x0000000d eax */
        /* (11) 0x0000000f(ecx=0) edx */
        /* (12) 0x0000000f(ecx=1) edx */
+       /* (13) 0x80000008 ebx */
+       /* (14) 0x00000006 eax */
+       /* (15) 0x8000000a edx */
+
+       procfs_getonefeatreg(ci->ci_feat_val[6], x86_features[16], p + diff,
+           left);
+       diff = last - *left;
+
+       /* (17) 0x80000007 ebx */
 
        return 0; /* XXX */
 }
@@ -318,17 +359,36 @@
                left = 0;
 
        l = snprintf(p, left,
+           "apicid\t\t: %d\n"
+           "initial apicid\t: %d\n",
+           ci->ci_acpiid,
+           ci->ci_initapicid
+       );
+       size += l;
+       if (l < left) {
+               left -= l;
+               p += l;
+       } else
+               left = 0;
+
+       l = snprintf(p, left,
+#ifdef __i386__
            "fdiv_bug\t: %s\n"
+#endif
            "fpu\t\t: %s\n"
            "fpu_exception\t: yes\n"
            "cpuid level\t: %d\n"
            "wp\t\t: %s\n"
-           "flags\t\t: %s\n",
+           "flags\t\t: %s\n"
+           "clflush size\t: %d\n",
+#ifdef __i386__
            i386_fpu_fdivbug ? "yes" : "no",    /* an old pentium */
+#endif
            i386_fpu_present ? "yes" : "no",    /* not a 486SX */
            cpuid_level,
            (rcr0() & CR0_WP) ? "yes" : "no",
-           featurebuf
+           featurebuf,
+           ci->ci_cflush_lsize
        );
        size += l;
 



Home | Main Index | Thread Index | Old Index