Module Name:    src
Committed By:   matt
Date:           Tue Mar 17 17:20:55 UTC 2015

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

Log Message:
If we own the FPU, don't take anymore undefined faults.  Instead generate
SIGILLs since we obviously don't understand the instruction.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 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.42 src/sys/arch/arm/vfp/vfp_init.c:1.43
--- src/sys/arch/arm/vfp/vfp_init.c:1.42	Mon Feb  9 07:55:52 2015
+++ src/sys/arch/arm/vfp/vfp_init.c	Tue Mar 17 17:20:55 2015
@@ -1,4 +1,4 @@
-/*      $NetBSD: vfp_init.c,v 1.42 2015/02/09 07:55:52 slp Exp $ */
+/*      $NetBSD: vfp_init.c,v 1.43 2015/03/17 17:20:55 matt Exp $ */
 
 /*
  * Copyright (c) 2008 ARM Ltd
@@ -376,7 +376,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
 }
 
@@ -399,7 +400,7 @@ 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 0;
+		return 1;
 
 	/*
 	 * Make sure we own the FP.
@@ -468,6 +469,10 @@ 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, raise SIGILL */
+	if (curcpu()->ci_pcu_curlwp[PCU_FPU] == curlwp)
+		return 0;
+
 	pcu_load(&arm_vfp_ops);
 
 	/* Need to restart the faulted instruction.  */

Reply via email to