Source-Changes-HG archive

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

[src/trunk]: src/sys/arch unifdef FPEMUL. All our supported systems have an FPU.



details:   https://anonhg.NetBSD.org/src/rev/d9439c23e008
branches:  trunk
changeset: 778609:d9439c23e008
user:      skrll <skrll%NetBSD.org@localhost>
date:      Fri Apr 06 12:21:58 2012 +0000

description:
unifdef FPEMUL. All our supported systems have an FPU.

diffstat:

 sys/arch/hp700/conf/GENERIC   |    5 +-
 sys/arch/hp700/dev/cpu.c      |   21 ++------
 sys/arch/hp700/hp700/locore.S |    9 +---
 sys/arch/hppa/hppa/fpu.c      |  103 ++++++++++++++---------------------------
 sys/arch/hppa/hppa/trap.S     |   17 ++----
 sys/arch/hppa/hppa/trap.c     |   18 +------
 6 files changed, 53 insertions(+), 120 deletions(-)

diffs (truncated from 388 to 300 lines):

diff -r 5af9e872fed9 -r d9439c23e008 sys/arch/hp700/conf/GENERIC
--- a/sys/arch/hp700/conf/GENERIC       Fri Apr 06 11:42:08 2012 +0000
+++ b/sys/arch/hp700/conf/GENERIC       Fri Apr 06 12:21:58 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.112 2012/03/10 21:51:52 joerg Exp $
+# $NetBSD: GENERIC,v 1.113 2012/04/06 12:21:58 skrll Exp $
 #
 # GENERIC machine description file
 #
@@ -23,7 +23,7 @@
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 options        SYSCTL_INCLUDE_DESCR    # Include sysctl descriptions in kernel
 
-#ident                 "GENERIC-$Revision: 1.112 $"
+#ident                 "GENERIC-$Revision: 1.113 $"
 
 maxusers       32              # estimated number of users
 
@@ -40,7 +40,6 @@
 options        HP8700_CPU              # PCX-W2 (in 32bit mode)
 
 # CPU-related options.
-options        FPEMUL          # floating point emulation XXX DO NOT REMOVE
 options        USELEDS         # blink 'em
 
 # delay between "rebooting ..." message and hardware reset, in milliseconds
diff -r 5af9e872fed9 -r d9439c23e008 sys/arch/hp700/dev/cpu.c
--- a/sys/arch/hp700/dev/cpu.c  Fri Apr 06 11:42:08 2012 +0000
+++ b/sys/arch/hp700/dev/cpu.c  Fri Apr 06 12:21:58 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.22 2012/04/05 21:00:29 skrll Exp $   */
+/*     $NetBSD: cpu.c,v 1.23 2012/04/06 12:21:58 skrll Exp $   */
 
 /*     $OpenBSD: cpu.c,v 1.29 2009/02/08 18:33:28 miod Exp $   */
 
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.22 2012/04/05 21:00:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.23 2012/04/06 12:21:58 skrll Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -146,23 +146,14 @@
                aprint_normal(", %u/%u D/I BTLBs", pdc_btlb.finfo.num_i,
                    pdc_btlb.finfo.num_d);
        }
+       aprint_normal("\n");
 
        /*
         * Describe the floating-point support.
         */
-#ifndef        FPEMUL
-       if (!fpu_present)
-               aprint_normal("\n%s: no floating point support",
-                   self->dv_xname);
-       else
-#endif /* !FPEMUL */
-       {
-               aprint_normal("\n%s: %s floating point, rev %d", self->dv_xname,
-                   hppa_mod_info(HPPA_TYPE_FPU, (fpu_version >> 16) & 0x1f),
-                   (fpu_version >> 11) & 0x1f);
-       }
-
-       aprint_normal("\n");
+       aprint_normal("%s: %s floating point, rev %d\n", self->dv_xname,
+           hppa_mod_info(HPPA_TYPE_FPU, (fpu_version >> 16) & 0x1f),
+           (fpu_version >> 11) & 0x1f);
 
        /* sanity against luser amongst config editors */
        if (ca->ca_irq != 31) {
diff -r 5af9e872fed9 -r d9439c23e008 sys/arch/hp700/hp700/locore.S
--- a/sys/arch/hp700/hp700/locore.S     Fri Apr 06 11:42:08 2012 +0000
+++ b/sys/arch/hp700/hp700/locore.S     Fri Apr 06 12:21:58 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.S,v 1.59 2012/04/05 19:42:13 skrll Exp $        */
+/*     $NetBSD: locore.S,v 1.60 2012/04/06 12:21:59 skrll Exp $        */
 /*     $OpenBSD: locore.S,v 1.158 2008/07/28 19:08:46 miod Exp $       */
 
 /*
@@ -1034,13 +1034,6 @@
        ldw     HPPA_FRAME_ARG(0)(%r3), %arg0
 
 noras:
-       /*
-        * As an optimization, hppa_fpu_bootstrap
-        * replaces this branch instruction with a
-        * nop if there is a hardware FPU.
-        */
-ALTENTRY(hppa_fpu_nop1)
-       b,n     switch_return
 
        /*
         * We do have a hardware FPU.  If the LWP
diff -r 5af9e872fed9 -r d9439c23e008 sys/arch/hppa/hppa/fpu.c
--- a/sys/arch/hppa/hppa/fpu.c  Fri Apr 06 11:42:08 2012 +0000
+++ b/sys/arch/hppa/hppa/fpu.c  Fri Apr 06 12:21:58 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fpu.c,v 1.23 2011/01/23 09:44:59 skrll Exp $   */
+/*     $NetBSD: fpu.c,v 1.24 2012/04/06 12:21:59 skrll Exp $   */
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.23 2011/01/23 09:44:59 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.24 2012/04/06 12:21:59 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -82,7 +82,8 @@
 void hppa_fpu_swapout(struct pcb *);
 void hppa_fpu_swap(struct fpreg *, struct fpreg *);
 
-#ifdef FPEMUL
+static int hppa_fpu_ls(struct trapframe *, struct lwp *);
+
 /*
  * Given a trapframe and a general register number, the 
  * FRAME_REG macro returns a pointer to that general
@@ -131,7 +132,6 @@
        _FRAME_POSITION(tf_sp),         /* r30 */
        _FRAME_POSITION(tf_r31),
 };
-#endif /* FPEMUL */
 
 /*
  * Bootstraps the FPU.
@@ -141,69 +141,43 @@
 {
        uint32_t junk[2];
        uint32_t vers[2];
-       extern u_int hppa_fpu_nop0;
-       extern u_int hppa_fpu_nop1;
 
        /* See if we have a present and functioning hardware FPU. */
        fpu_present = (ccr_enable & HPPA_FPUS) == HPPA_FPUS;
 
+       KASSERT(fpu_present);
        /* Initialize the FPU and get its version. */
-       if (fpu_present) {
 
-               /*
-                * To somewhat optimize the emulation
-                * assist trap handling and context
-                * switching (to save them from having
-                * to always load and check fpu_present),
-                * there are two instructions in locore.S
-                * that are replaced with nops when 
-                * there is a hardware FPU.
-                */
-               hppa_fpu_nop0 = OPCODE_NOP;
-               hppa_fpu_nop1 = OPCODE_NOP;
-               fcacheall();
-
-               /*
-                * We track what process has the FPU,
-                * and how many times we have to swap
-                * in and out.
-                */
+       /*
+        * We track what process has the FPU,
+        * and how many times we have to swap
+        * in and out.
+        */
 
-               /*
-                * The PA-RISC 1.1 Architecture manual is 
-                * pretty clear that the copr,0,0 must be 
-                * wrapped in double word stores of fr0, 
-                * otherwise its operation is undefined.
-                */
-               __asm volatile(
-                       "       ldo     %0, %%r22       \n"
-                       "       fstds   %%fr0, 0(%%r22) \n"
-                       "       ldo     %1, %%r22       \n"
-                       "       copr,0,0                \n"
-                       "       fstds   %%fr0, 0(%%r22) \n"
-                       : "=m" (junk), "=m" (vers) : : "r22");
+       /*
+        * The PA-RISC 1.1 Architecture manual is 
+        * pretty clear that the copr,0,0 must be 
+        * wrapped in double word stores of fr0, 
+        * otherwise its operation is undefined.
+        */
+       __asm volatile(
+               "       ldo     %0, %%r22       \n"
+               "       fstds   %%fr0, 0(%%r22) \n"
+               "       ldo     %1, %%r22       \n"
+               "       copr,0,0                \n"
+               "       fstds   %%fr0, 0(%%r22) \n"
+               : "=m" (junk), "=m" (vers) : : "r22");
 
-               /*
-                * Now mark that no process has the FPU,
-                * and disable it, so the first time it
-                * gets used the process' state gets
-                * swapped in.
-                */
-               fpu_csw = 0;
-               curcpu()->ci_fpu_state = 0;
-               mtctl(ccr_enable & (CCR_MASK ^ HPPA_FPUS), CR_CCR);     
-       } 
-#ifdef FPEMUL
-       else
-               /*
-                * XXX This is a hack - to avoid
-                * having to set up the emulator so
-                * it can work for one instruction for
-                * proc0, we dispatch the copr,0,0 opcode 
-                * into the emulator directly.  
-                */
-               decode_0c(OPCODE_COPR_0_0, 0, 0, vers);
-#endif /* FPEMUL */
+       /*
+        * Now mark that no process has the FPU,
+        * and disable it, so the first time it
+        * gets used the process' state gets
+        * swapped in.
+        */
+       fpu_csw = 0;
+       curcpu()->ci_fpu_state = 0;
+       mtctl(ccr_enable & (CCR_MASK ^ HPPA_FPUS), CR_CCR);     
+
        fpu_version = vers[0];
 }
 
@@ -218,12 +192,10 @@
        struct pcb *pcb = lwp_getpcb(l);
        struct cpu_info *ci = curcpu();
 
-       if (!fpu_present)
-               return;
+       KASSERT(fpu_present);
 
        /*
-        * If we have a hardware FPU, and this process'
-        * state is currently in it, swap it out.
+        * If this process' state is currently in hardware, swap it out.
         */
        
        if (ci->ci_fpu_state == 0 ||
@@ -235,12 +207,9 @@
        ci->ci_fpu_state = 0;
 }
 
-#ifdef FPEMUL
-
 /*
  * This emulates a coprocessor load/store instruction.
  */
-static int hppa_fpu_ls(struct trapframe *, struct lwp *);
 static int 
 hppa_fpu_ls(struct trapframe *frame, struct lwp *l)
 {
@@ -448,5 +417,3 @@
                trapsignal(l, &ksi);
        }
 }
-
-#endif /* FPEMUL */
diff -r 5af9e872fed9 -r d9439c23e008 sys/arch/hppa/hppa/trap.S
--- a/sys/arch/hppa/hppa/trap.S Fri Apr 06 11:42:08 2012 +0000
+++ b/sys/arch/hppa/hppa/trap.S Fri Apr 06 12:21:58 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.S,v 1.65 2012/04/05 19:44:29 skrll Exp $  */
+/*     $NetBSD: trap.S,v 1.66 2012/04/06 12:21:59 skrll Exp $  */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -267,7 +267,6 @@
        /* We can now set the frame pointer */
        copy    %t3, %r3
 
-#if defined(DDB) || defined(KGDB) || defined(FPEMUL)
        stw     %r4 , TF_R4 -TRAPFRAME_SIZEOF(%sr1, %t3)
        stw     %r5 , TF_R5 -TRAPFRAME_SIZEOF(%sr1, %t3)
        stw     %r6 , TF_R6 -TRAPFRAME_SIZEOF(%sr1, %t3)
@@ -283,7 +282,7 @@
        stw     %r16, TF_R16-TRAPFRAME_SIZEOF(%sr1, %t3)
        stw     %r17, TF_R17-TRAPFRAME_SIZEOF(%sr1, %t3)
        stw     %r18, TF_R18-TRAPFRAME_SIZEOF(%sr1, %t3)
-#endif /* DDB || KGDB || FPEMUL */
+
        stw     %r0, 0(%sr1, %t3)       /* terminate frame */
        copy    %r0 , %r3
        stw     %r0, HPPA_FRAME_PSP(%sr1, %sp)
@@ -445,11 +444,11 @@
        ldw     TF_R1(%t3), %r1
        ldw     TF_R2(%t3), %r2
        ldw     TF_R3(%t3), %r3
+
        /*
         * See the comment in the trap handling code below about why we need to
         * save and restore all general registers under these cases.
         */
-#if defined(DDB) || defined(KGDB) || defined(FPEMUL)



Home | Main Index | Thread Index | Old Index