Index: sys/arch/arm/vfp/vfp_init.c =================================================================== RCS file: /home/netbsd/src/sys/arch/arm/vfp/vfp_init.c,v retrieving revision 1.72 diff -p -u -r1.72 vfp_init.c --- sys/arch/arm/vfp/vfp_init.c 30 Oct 2020 18:54:37 -0000 1.72 +++ sys/arch/arm/vfp/vfp_init.c 6 Nov 2020 21:59:29 -0000 @@ -423,6 +423,7 @@ static int vfp_handler(u_int address, u_int insn, trapframe_t *frame, int fault_code) { struct cpu_info * const ci = curcpu(); + uint32_t fpexc; /* This shouldn't ever happen. */ if (fault_code != FAULT_USER && @@ -438,20 +439,30 @@ 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) - return 1; + if (curlwp->l_pcu_cpu[PCU_FPU] == ci) { + KASSERT(ci->ci_pcu_curlwp[PCU_FPU] == curlwp); + + fpexc = armreg_fpexc_read(); + if (fpexc & VFP_FPEXC_EN) { + if ((fpexc & VFP_FPEXC_EX) == 0) { + return 1; /* SIGILL */ + } else { + goto fpe; /* SIGFPE; skip pcu_load(9) */ + } + } + } /* * Make sure we own the FP. */ pcu_load(&arm_vfp_ops); - uint32_t fpexc = armreg_fpexc_read(); + fpexc = armreg_fpexc_read(); if (fpexc & VFP_FPEXC_EX) { ksiginfo_t ksi; KASSERT(fpexc & VFP_FPEXC_EN); +fpe: curcpu()->ci_vfp_evs[2].ev_count++; /*