Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mvme68k Some minor optimisations to avoid checking ...



details:   https://anonhg.NetBSD.org/src/rev/7df585382a8f
branches:  trunk
changeset: 500918:7df585382a8f
user:      scw <scw%NetBSD.org@localhost>
date:      Wed Dec 20 16:53:50 2000 +0000

description:
Some minor optimisations to avoid checking {cpu,mmu}type when
the kernel was built for only one type of CPU.

diffstat:

 sys/arch/mvme68k/include/param.h       |   4 +++-
 sys/arch/mvme68k/mvme68k/pmap.c        |  21 +++++++++++++++------
 sys/arch/mvme68k/mvme68k/sys_machdep.c |  20 +++++++++++++-------
 3 files changed, 31 insertions(+), 14 deletions(-)

diffs (117 lines):

diff -r 4f5d64ac52f7 -r 7df585382a8f sys/arch/mvme68k/include/param.h
--- a/sys/arch/mvme68k/include/param.h  Wed Dec 20 16:19:09 2000 +0000
+++ b/sys/arch/mvme68k/include/param.h  Wed Dec 20 16:53:50 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: param.h,v 1.23 2000/12/05 18:46:10 scw Exp $   */
+/*     $NetBSD: param.h,v 1.24 2000/12/20 16:53:50 scw Exp $   */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -62,6 +62,8 @@
 #define        SEGSHIFT        22              /* LOG2(NBSEG) */
 #if defined(M68030) && !defined(M68040) && !defined(M68060)
 #define NBSEG          (1 << SEGSHIFT) /* bytes/segment */
+#elif (defined(M68040) || defined(M68060)) && !defined(M68030)
+#define        NBSEG           ((32 * (1 << PGSHIFT)) : (256 * (1 << PGSHIFT)))
 #else
 #define        NBSEG           ((mmutype == MMU_68040) ? \
                                (32 * (1 << PGSHIFT)) : (256 * (1 << PGSHIFT)))
diff -r 4f5d64ac52f7 -r 7df585382a8f sys/arch/mvme68k/mvme68k/pmap.c
--- a/sys/arch/mvme68k/mvme68k/pmap.c   Wed Dec 20 16:19:09 2000 +0000
+++ b/sys/arch/mvme68k/mvme68k/pmap.c   Wed Dec 20 16:53:50 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.49 2000/12/05 16:07:39 scw Exp $        */
+/*     $NetBSD: pmap.c,v 1.50 2000/12/20 16:53:50 scw Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -1810,9 +1810,10 @@
        PMAP_DPRINTF(PDB_FOLLOW, ("pmap_zero_page_uncached(%lx)\n", phys));
 
 #if defined(M68040) || defined(M68060)
-       if (mmutype == MMU_68040) {
-               DCPP(phys);
-       }
+#if defined(M68020) || defined(M68030)
+       if (mmutype == MMU_68040)
+#endif
+               DCPP_40(phys);  /* Works on 060 too */
 #endif
 
        npte = phys | PG_V | PG_CI;
@@ -2623,16 +2624,24 @@
         * release them.  We also avoid the overhead of vm_map_pageable.
         */
 #if defined(M68040) || defined(M68060)
-       if (mmutype == MMU_68040) {
+#if defined(M68020) || defined(M68030)
+       if (mmutype == MMU_68040)
+#endif
+       {
                st_entry_t *este;
 
                for (este = &ste[NPTEPG/SG4_LEV3SIZE]; ste < este; ste++) {
                        *ste = ptpa | SG_U | SG_RW | SG_V;
                        ptpa += SG4_LEV3SIZE * sizeof(st_entry_t);
                }
-       } else
+       }
+#if defined(M68020) || defined(M68030)
+       else
+               *ste = (ptpa & SG_FRAME) | SG_RW | SG_V;
 #endif
+#else
        *ste = (ptpa & SG_FRAME) | SG_RW | SG_V;
+#endif
        if (pmap != pmap_kernel()) {
                PMAP_DPRINTF(PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB,
                    ("enter: stab %p refcnt %d\n",
diff -r 4f5d64ac52f7 -r 7df585382a8f sys/arch/mvme68k/mvme68k/sys_machdep.c
--- a/sys/arch/mvme68k/mvme68k/sys_machdep.c    Wed Dec 20 16:19:09 2000 +0000
+++ b/sys/arch/mvme68k/mvme68k/sys_machdep.c    Wed Dec 20 16:53:50 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_machdep.c,v 1.23 2000/12/13 18:13:08 jdolecek Exp $        */
+/*     $NetBSD: sys_machdep.c,v 1.24 2000/12/20 16:53:50 scw Exp $     */
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -83,7 +83,10 @@
        int error = 0;
 
 #if defined(M68040) || defined(M68060)
-       if (mmutype == MMU_68040) {
+#if defined(M68020) || defined(M68030)
+       if (mmutype == MMU_68040)
+#endif
+       {
                int inc = 0;
                int doall = 0;
                paddr_t pa = 0;
@@ -207,7 +210,10 @@
        int len;
 {
 #if defined(M68040) || defined(M68060)
-       if (mmutype == MMU_68040) {
+#if defined(M68020) || defined(M68030)
+       if (mmutype == MMU_68040)
+#endif
+       {
                register int inc = 0;
                int pa = 0;
                caddr_t end;
@@ -228,11 +234,11 @@
                                pa = kvtop (addr);
                        }
                        if (inc == 16) {
-                               DCFL(pa);
-                               ICPL(pa);
+                               DCFL_40(pa);    /* 040 versions work for 060 */
+                               ICPL_40(pa);
                        } else {
-                               DCFP(pa);
-                               ICPP(pa);
+                               DCFP_40(pa);    /* 040 versions work for 060 */
+                               ICPP_40(pa);
                        }
                        pa += inc;
                        addr += inc;



Home | Main Index | Thread Index | Old Index