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 If we own the FPU, don't take anymore undef...



details:   https://anonhg.NetBSD.org/src/rev/66db4d5f64d7
branches:  trunk
changeset: 336758:66db4d5f64d7
user:      matt <matt%NetBSD.org@localhost>
date:      Tue Mar 17 17:20:55 2015 +0000

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

diffstat:

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

diffs (39 lines):

diff -r 2c70b9002acb -r 66db4d5f64d7 sys/arch/arm/vfp/vfp_init.c
--- a/sys/arch/arm/vfp/vfp_init.c       Tue Mar 17 12:20:02 2015 +0000
+++ b/sys/arch/arm/vfp/vfp_init.c       Tue Mar 17 17:20:55 2015 +0000
@@ -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 @@
        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 @@
         * 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 @@
        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.  */



Home | Main Index | Thread Index | Old Index