Module Name:    src
Committed By:   snj
Date:           Thu Mar 26 08:53:48 UTC 2015

Modified Files:
        src/sys/arch/arm/vfp [netbsd-7]: vfp_init.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #643):
        sys/arch/arm/vfp/vfp_init.c: revision 1.47
Fix some inverted return values.  Don't return SIGILL if there is an active
FPU exception.


To generate a diff of this commit:
cvs rdiff -u -r1.41.2.1 -r1.41.2.2 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.2.1 src/sys/arch/arm/vfp/vfp_init.c:1.41.2.2
--- src/sys/arch/arm/vfp/vfp_init.c:1.41.2.1	Sat Mar 21 17:51:21 2015
+++ src/sys/arch/arm/vfp/vfp_init.c	Thu Mar 26 08:53:48 2015
@@ -1,4 +1,4 @@
-/*      $NetBSD: vfp_init.c,v 1.41.2.1 2015/03/21 17:51:21 snj Exp $ */
+/*      $NetBSD: vfp_init.c,v 1.41.2.2 2015/03/26 08:53:48 snj Exp $ */
 
 /*
  * Copyright (c) 2008 ARM Ltd
@@ -394,15 +394,19 @@ vfp_handler(u_int address, u_int insn, t
 	}
 
 	/*
-	 * If we are just changing/fetching FPSCR, don't bother loading it.
+	 * If we are just changing/fetching FPSCR, don't bother loading it
+	 * just emulate the instruction.
 	 */
 	if (!vfp_fpscr_handler(address, insn, frame, fault_code))
-		return 1;
+		return 0;
 
-	/* if we already own the FPU and it's enabled, raise SIGILL */
+	/* 
+	 * 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_EN) != 0)
-		return 0;
+	    && (armreg_fpexc_read() & (VFP_FPEXC_EX|VFP_FPEXC_EN)) == VFP_FPEXC_EN)
+		return 1;
 
 	/*
 	 * Make sure we own the FP.
@@ -474,7 +478,7 @@ neon_handler(u_int address, u_int insn, 
 	/* 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;
+		return 1;
 
 	pcu_load(&arm_vfp_ops);
 

Reply via email to