Module Name:    src
Committed By:   riastradh
Date:           Wed Feb 12 06:05:46 UTC 2020

Modified Files:
        src/sys/arch/aarch64/include: cpu.h

Log Message:
Define the MULTIPROCESSOR cpu_number() for modules too.

Modules should work whether the main kernel is multiprocessor or not.
In particular, dtrace should not think cpu_number() is 0 while
cpu_index(curcpu()) and curcpu()->ci_index are nonzero, leading to
rather spectacularly bogus results...


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/aarch64/include/cpu.h

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

Modified files:

Index: src/sys/arch/aarch64/include/cpu.h
diff -u src/sys/arch/aarch64/include/cpu.h:1.19 src/sys/arch/aarch64/include/cpu.h:1.20
--- src/sys/arch/aarch64/include/cpu.h:1.19	Wed Jan 15 08:34:04 2020
+++ src/sys/arch/aarch64/include/cpu.h	Wed Feb 12 06:05:46 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.19 2020/01/15 08:34:04 mrg Exp $ */
+/* $NetBSD: cpu.h,v 1.20 2020/02/12 06:05:46 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -134,7 +134,7 @@ extern uint64_t cpu_mpidr[];		/* MULTIPR
 bool cpu_hatched_p(u_int);		/* MULTIPROCESSOR */
 
 #define CPU_INFO_ITERATOR	cpuid_t
-#ifdef MULTIPROCESSOR
+#if defined(MULTIPROCESSOR) || defined(_MODULE)
 #define cpu_number()		(curcpu()->ci_index)
 #define CPU_IS_PRIMARY(ci)	((ci)->ci_index == 0)
 #define CPU_INFO_FOREACH(cii, ci)					\

Reply via email to