Module Name:    src
Committed By:   thorpej
Date:           Sun Mar 16 19:27:30 UTC 2025

Modified Files:
        src/sys/arch/alpha/alpha: fp_complete.c machdep.c
        src/sys/arch/alpha/include: alpha.h

Log Message:
Add an alpha_fp_init() function, and move the initialization of
FP-related event counters there.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/alpha/alpha/fp_complete.c
cvs rdiff -u -r1.381 -r1.382 src/sys/arch/alpha/alpha/machdep.c
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/alpha/include/alpha.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/alpha/alpha/fp_complete.c
diff -u src/sys/arch/alpha/alpha/fp_complete.c:1.31 src/sys/arch/alpha/alpha/fp_complete.c:1.32
--- src/sys/arch/alpha/alpha/fp_complete.c:1.31	Tue Nov 21 22:19:12 2023
+++ src/sys/arch/alpha/alpha/fp_complete.c	Sun Mar 16 19:27:30 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: fp_complete.c,v 1.31 2023/11/21 22:19:12 thorpej Exp $ */
+/* $NetBSD: fp_complete.c,v 1.32 2025/03/16 19:27:30 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2001 Ross Harvey
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.31 2023/11/21 22:19:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.32 2025/03/16 19:27:30 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -121,8 +121,8 @@ __CTASSERT(FP_C_ALLBITS == MDLWP_FP_C);
 
 #define	CRBLIT(sw, hw, m, offs) (((sw) & ~(m)) | ((hw) >> (offs) & (m)))
 
-struct evcnt fpevent_use;
-struct evcnt fpevent_reuse;
+static struct evcnt fpevent_use;
+static struct evcnt fpevent_reuse;
 
 /*
  * Temporary trap shadow instrumentation. The [un]resolved counters
@@ -819,6 +819,18 @@ alpha_fp_complete(u_long a0, u_long a1, 
 }
 
 /*
+ * Initialize FP handling.
+ */
+void
+alpha_fp_init(void)
+{
+	evcnt_attach_dynamic_nozero(&fpevent_use, EVCNT_TYPE_MISC, NULL,
+	    "FP", "proc use");
+	evcnt_attach_dynamic_nozero(&fpevent_reuse, EVCNT_TYPE_MISC, NULL,
+	    "FP", "proc re-use");
+}
+
+/*
  * Load the float-point context for the current lwp.
  */
 void

Index: src/sys/arch/alpha/alpha/machdep.c
diff -u src/sys/arch/alpha/alpha/machdep.c:1.381 src/sys/arch/alpha/alpha/machdep.c:1.382
--- src/sys/arch/alpha/alpha/machdep.c:1.381	Sun Mar 16 17:38:06 2025
+++ src/sys/arch/alpha/alpha/machdep.c	Sun Mar 16 19:27:30 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.381 2025/03/16 17:38:06 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.382 2025/03/16 19:27:30 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2019, 2020 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.381 2025/03/16 17:38:06 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.382 2025/03/16 19:27:30 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -886,7 +886,6 @@ consinit(void)
 void
 cpu_startup(void)
 {
-	extern struct evcnt fpevent_use, fpevent_reuse;
 	vaddr_t minaddr, maxaddr;
 	char pbuf[9];
 #if defined(DEBUG)
@@ -951,12 +950,9 @@ cpu_startup(void)
 	hwrpb_primary_init();
 
 	/*
-	 * Initialize some trap event counters.
+	 * Initialize FP handling.
 	 */
-	evcnt_attach_dynamic_nozero(&fpevent_use, EVCNT_TYPE_MISC, NULL,
-	    "FP", "proc use");
-	evcnt_attach_dynamic_nozero(&fpevent_reuse, EVCNT_TYPE_MISC, NULL,
-	    "FP", "proc re-use");
+	alpha_fp_init();
 }
 
 /*

Index: src/sys/arch/alpha/include/alpha.h
diff -u src/sys/arch/alpha/include/alpha.h:1.47 src/sys/arch/alpha/include/alpha.h:1.48
--- src/sys/arch/alpha/include/alpha.h:1.47	Fri Jul 23 03:50:32 2021
+++ src/sys/arch/alpha/include/alpha.h	Sun Mar 16 19:27:30 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: alpha.h,v 1.47 2021/07/23 03:50:32 thorpej Exp $ */
+/* $NetBSD: alpha.h,v 1.48 2025/03/16 19:27:30 thorpej Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -177,6 +177,7 @@ void alpha_write_fpcr(uint64_t);				/* M
 uint64_t alpha_read_fp_c(struct lwp *);
 void alpha_write_fp_c(struct lwp *, uint64_t);
 
+void alpha_fp_init(void);
 int alpha_fp_complete(u_long, u_long, struct lwp *, uint64_t *);
 int alpha_fp_complete_at(u_long, struct lwp *, uint64_t *);
 

Reply via email to