Thu Apr 16 09:28:52 2020 UTC ()
Fix cur{lwp,cpu} and other bits for MODULES


(skrll)
diff -r1.30 -r1.31 src/sys/arch/hppa/hppa/hppa_machdep.c
diff -r1.9 -r1.10 src/sys/arch/hppa/include/cpu.h

cvs diff -r1.30 -r1.31 src/sys/arch/hppa/hppa/hppa_machdep.c (expand / switch to context diff)
--- src/sys/arch/hppa/hppa/hppa_machdep.c 2019/11/23 19:40:35 1.30
+++ src/sys/arch/hppa/hppa/hppa_machdep.c 2020/04/16 09:28:52 1.31
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_machdep.c,v 1.30 2019/11/23 19:40:35 ad Exp $	*/
+/*	$NetBSD: hppa_machdep.c,v 1.31 2020/04/16 09:28:52 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hppa_machdep.c,v 1.30 2019/11/23 19:40:35 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hppa_machdep.c,v 1.31 2020/04/16 09:28:52 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -303,3 +303,18 @@
 		setsoftast(l);
 	}
 }
+
+#ifdef MODULAR
+struct lwp *
+hppa_curlwp(void)
+{
+	return curlwp;
+}
+
+struct cpu_info *
+hppa_curcpu(void)
+{
+	return curcpu();
+}
+#endif
+

cvs diff -r1.9 -r1.10 src/sys/arch/hppa/include/cpu.h (expand / switch to context diff)
--- src/sys/arch/hppa/include/cpu.h 2019/12/05 08:00:05 1.9
+++ src/sys/arch/hppa/include/cpu.h 2020/04/16 09:28:52 1.10
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.9 2019/12/05 08:00:05 skrll Exp $	*/
+/*	$NetBSD: cpu.h,v 1.10 2020/04/16 09:28:52 skrll Exp $	*/
 
 /*	$OpenBSD: cpu.h,v 1.55 2008/07/23 17:39:35 kettenis Exp $	*/
 
@@ -316,12 +316,20 @@
 
 void	cpu_proc_fork(struct proc *, struct proc *);
 
-#ifdef MULTIPROCESSOR
+struct lwp *hppa_curlwp(void);
+struct cpu_info *hppa_curcpu(void);
 
+#if defined(_MODULE)
+#define	curcpu()			hppa_curcpu()
+#define	curlwp				hppa_curlwp()
+#endif
+
+#if defined(MULTIPROCESSOR) || defined(_MODULE)
 /* Number of CPUs in the system */
 extern int hppa_ncpu;
 
 #define	HPPA_MAXCPUS	4
+
 #define	cpu_number()			(curcpu()->ci_cpuid)
 
 #define	CPU_IS_PRIMARY(ci)		((ci)->ci_cpuid == 0)
@@ -330,8 +338,9 @@
 
 void	cpu_boot_secondary_processors(void);
 
+#if !defined(_MODULE)
 static __inline struct cpu_info *
-hppa_curcpu(void)
+_hppa_curcpu(void)
 {
 	struct cpu_info *ci;
 
@@ -340,7 +349,8 @@
 	return ci;
 }
 
-#define	curcpu()			hppa_curcpu()
+#define	curcpu()			_hppa_curcpu()
+#endif
 
 #else /*  MULTIPROCESSOR */
 
@@ -349,7 +359,7 @@
 #define	cpu_number()			0
 
 static __inline struct lwp *
-hppa_curlwp(void)
+_hppa_curlwp(void)
 {
 	struct lwp *l;
 
@@ -358,7 +368,7 @@
 	return l;
 }
 
-#define	curlwp				hppa_curlwp()
+#define	curlwp				_hppa_curlwp()
 
 #endif /* MULTIPROCESSOR */