Module Name:    src
Committed By:   msaitoh
Date:           Tue Apr 11 09:53:28 UTC 2023

Modified Files:
        src/sys/dev/tprof: tprof_x86_intel.c

Log Message:
Test cpuid_level in tprof_intel_ncounters().

This function is called before tprof_intel_ident().


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/tprof/tprof_x86_intel.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/tprof/tprof_x86_intel.c
diff -u src/sys/dev/tprof/tprof_x86_intel.c:1.6 src/sys/dev/tprof/tprof_x86_intel.c:1.7
--- src/sys/dev/tprof/tprof_x86_intel.c:1.6	Tue Apr 11 02:47:01 2023
+++ src/sys/dev/tprof/tprof_x86_intel.c	Tue Apr 11 09:53:28 2023
@@ -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);

Reply via email to