Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/tprof Test cpuid_level in tprof_intel_ncounters().



details:   https://anonhg.NetBSD.org/src/rev/48319c26c015
branches:  trunk
changeset: 374213:48319c26c015
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Apr 11 09:53:28 2023 +0000

description:
Test cpuid_level in tprof_intel_ncounters().

This function is called before tprof_intel_ident().

diffstat:

 sys/dev/tprof/tprof_x86_intel.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (28 lines):

diff -r a10448c02f37 -r 48319c26c015 sys/dev/tprof/tprof_x86_intel.c
--- a/sys/dev/tprof/tprof_x86_intel.c   Tue Apr 11 08:50:07 2023 +0000
+++ b/sys/dev/tprof/tprof_x86_intel.c   Tue Apr 11 09:53:28 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tprof_x86_intel.c,v 1.6 2023/04/11 02:47:01 msaitoh Exp $      */
+/*     $NetBSD: tprof_x86_intel.c,v 1.7 2023/04/11 09:53:28 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tprof_x86_intel.c,v 1.6 2023/04/11 02:47:01 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tprof_x86_intel.c,v 1.7 2023/04/11 09:53:28 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -103,6 +103,9 @@ tprof_intel_ncounters(void)
 {
        uint32_t descs[4];
 
+       if (cpuid_level < 0x0a)
+               return 0;
+
        x86_cpuid(0x0a, descs);
 
        return __SHIFTOUT(descs[0], CPUID_PERF_NGPPC);



Home | Main Index | Thread Index | Old Index