Module Name: src Committed By: snj Date: Sat Mar 21 17:51:21 UTC 2015
Modified Files: src/sys/arch/arm/vfp [netbsd-7]: vfp_init.c Log Message: Pull up following revision(s) (requested by martin in ticket #621): sys/arch/arm/vfp/vfp_init.c: revisions 1.43-1.46 If we own the FPU, don't take anymore undefined faults. Instead generate SIGILLs since we obviously don't understand the instruction. -- Don't try to catch undefined VFP instructions if we own the the FPU. Let them raise SIGILL. -- Not only check to see if we own the VFP but that the VFP is enabled. -- Remove extra ) To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.41.2.1 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.41 src/sys/arch/arm/vfp/vfp_init.c:1.41.2.1 --- src/sys/arch/arm/vfp/vfp_init.c:1.41 Fri Jul 18 22:54:53 2014 +++ src/sys/arch/arm/vfp/vfp_init.c Sat Mar 21 17:51:21 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: vfp_init.c,v 1.41 2014/07/18 22:54:53 matt Exp $ */ +/* $NetBSD: vfp_init.c,v 1.41.2.1 2015/03/21 17:51:21 snj Exp $ */ /* * Copyright (c) 2008 ARM Ltd @@ -373,7 +373,8 @@ vfp_attach(struct cpu_info *ci) install_coproc_handler(VFP_COPROC, vfp_handler); install_coproc_handler(VFP_COPROC2, vfp_handler); #ifdef CPU_CORTEX - install_coproc_handler(CORE_UNKNOWN_HANDLER, neon_handler); + if (cpu_neon_present) + install_coproc_handler(CORE_UNKNOWN_HANDLER, neon_handler); #endif } @@ -396,6 +397,11 @@ vfp_handler(u_int address, u_int insn, t * If we are just changing/fetching FPSCR, don't bother loading it. */ if (!vfp_fpscr_handler(address, insn, frame, fault_code)) + return 1; + + /* if we already own the FPU and it's enabled, raise SIGILL */ + if (curcpu()->ci_pcu_curlwp[PCU_FPU] == curlwp + && (armreg_fpexc_read() & VFP_FPEXC_EN) != 0) return 0; /* @@ -465,6 +471,11 @@ neon_handler(u_int address, u_int insn, if (fault_code != FAULT_USER) panic("NEON fault in non-user mode"); + /* if we already own the FPU and it's enabled, raise SIGILL */ + if (curcpu()->ci_pcu_curlwp[PCU_FPU] == curlwp + && (armreg_fpexc_read() & VFP_FPEXC_EN) != 0) + return 0; + pcu_load(&arm_vfp_ops); /* Need to restart the faulted instruction. */