Module Name:    src
Committed By:   rin
Date:           Tue Jun  1 00:13:19 UTC 2021

Modified Files:
        src/sys/arch/arm/vfp: vfp_init.c

Log Message:
PR port-arm/55790

Style fix for clarity, in preparation of main fix.

Replace condition ``curcpu()->ci_pcu_curlwp[PCU_FPU] == curlwp'' with
``curlwp->l_pcu_cpu[PCU_FPU] == curcpu()''. And add KASSERT to check
the two conditions are equivalent, as done for MI pcu code:

https://nxr.netbsd.org/xref/src/sys/kern/subr_pcu.c#323

No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/arm/vfp/vfp_init.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/arch/arm/vfp/vfp_init.c
diff -u src/sys/arch/arm/vfp/vfp_init.c:1.72 src/sys/arch/arm/vfp/vfp_init.c:1.73
--- src/sys/arch/arm/vfp/vfp_init.c:1.72	Fri Oct 30 18:54:37 2020
+++ src/sys/arch/arm/vfp/vfp_init.c	Tue Jun  1 00:13:19 2021
@@ -1,4 +1,4 @@
-/*      $NetBSD: vfp_init.c,v 1.72 2020/10/30 18:54:37 skrll Exp $ */
+/*      $NetBSD: vfp_init.c,v 1.73 2021/06/01 00:13:19 rin Exp $ */
 
 /*
  * Copyright (c) 2008 ARM Ltd
@@ -32,7 +32,7 @@
 #include "opt_cputypes.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfp_init.c,v 1.72 2020/10/30 18:54:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfp_init.c,v 1.73 2021/06/01 00:13:19 rin Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -438,9 +438,11 @@ vfp_handler(u_int address, u_int insn, t
 	 * If we already own the FPU and it's enabled (and no exception), raise
 	 * SIGILL.  If there is an exception, drop through to raise a SIGFPE.
 	 */
-	if (curcpu()->ci_pcu_curlwp[PCU_FPU] == curlwp
-	    && (armreg_fpexc_read() & (VFP_FPEXC_EX|VFP_FPEXC_EN)) == VFP_FPEXC_EN)
+	if (curlwp->l_pcu_cpu[PCU_FPU] == ci
+	    && (armreg_fpexc_read() & (VFP_FPEXC_EX|VFP_FPEXC_EN)) == VFP_FPEXC_EN) {
+		KASSERT(ci->ci_pcu_curlwp[PCU_FPU] == curlwp);
 		return 1;
+	}
 
 	/*
 	 * Make sure we own the FP.

Reply via email to