Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/vfp Fix some inverted return values. Don't ret...



details:   https://anonhg.NetBSD.org/src/rev/80d96e9b645c
branches:  trunk
changeset: 336858:80d96e9b645c
user:      matt <matt%NetBSD.org@localhost>
date:      Mon Mar 23 17:42:02 2015 +0000

description:
Fix some inverted return values.  Don't return SIGILL if there is an active
FPU exception.

diffstat:

 sys/arch/arm/vfp/vfp_init.c |  18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diffs (43 lines):

diff -r 424d8bf4ba43 -r 80d96e9b645c sys/arch/arm/vfp/vfp_init.c
--- a/sys/arch/arm/vfp/vfp_init.c       Mon Mar 23 17:28:14 2015 +0000
+++ b/sys/arch/arm/vfp/vfp_init.c       Mon Mar 23 17:42:02 2015 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: vfp_init.c,v 1.46 2015/03/20 01:27:34 matt Exp $ */
+/*      $NetBSD: vfp_init.c,v 1.47 2015/03/23 17:42:02 matt Exp $ */
 
 /*
  * Copyright (c) 2008 ARM Ltd
@@ -397,15 +397,19 @@
        }
 
        /*
-        * 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.
@@ -477,7 +481,7 @@
        /* 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);
 



Home | Main Index | Thread Index | Old Index