git: e64318e76ed9 - main - arm/pmu: remove passing trap frame as argument

From: Warner Losh <imp_at_FreeBSD.org>
Date: Thu, 09 May 2024 23:20:43 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=e64318e76ed90e8ef2666a9c5628e036d2cc8817

commit e64318e76ed90e8ef2666a9c5628e036d2cc8817
Author:     Elliott Mitchell <ehem+freebsd@m5p.com>
AuthorDate: 2024-05-09 23:04:34 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-05-09 23:14:29 +0000

    arm/pmu: remove passing trap frame as argument
    
    While otherwise a handy potential approach, getting the trap frame via
    the argument isn't documented and isn't supposed to be used.  Adjust
    pmu_intr() to instead use curthread->td_intr_frame, which is the proper
    way.
    
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1126
---
 sys/arm/arm/pmu.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/sys/arm/arm/pmu.c b/sys/arm/arm/pmu.c
index 98d8cdcf2df8..050121934447 100644
--- a/sys/arm/arm/pmu.c
+++ b/sys/arm/arm/pmu.c
@@ -46,6 +46,7 @@
 #include <sys/timetc.h>
 #include <sys/pmc.h>
 #include <sys/pmckern.h>
+#include <sys/proc.h>
 
 #include <machine/bus.h>
 #include <machine/cpu.h>
@@ -65,9 +66,6 @@ uint32_t ccnt_hi[MAXCPU];
 static int
 pmu_intr(void *arg)
 {
-#ifdef HWPMC_HOOKS
-	struct trapframe *tf;
-#endif
 	uint32_t r;
 #if defined(__arm__) && (__ARM_ARCH > 6)
 	u_int cpu;
@@ -87,10 +85,8 @@ pmu_intr(void *arg)
 
 #ifdef HWPMC_HOOKS
 	/* Only call into the HWPMC framework if we know there is work. */
-	if (r != 0 && pmc_intr) {
-		tf = arg;
-		(*pmc_intr)(tf);
-	}
+	if (r != 0 && pmc_intr)
+		(*pmc_intr)(curthread->td_intr_frame);
 #endif
 
 	return (FILTER_HANDLED);