Port-sparc archive

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

topdown-vm for sparc



hi folks,

the attached patch enables __USE_TOPDOWN_VM for sparc.
I've tested it on a sun4m (supersparc) and sun4c (ss2).
does anyone see any problem with this?

-Chuck
Index: src/sys/arch/sparc/include/pmap.h
===================================================================
RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/include/pmap.h,v
retrieving revision 1.90
diff -u -p -r1.90 pmap.h
--- src/sys/arch/sparc/include/pmap.h   14 Feb 2011 10:22:19 -0000      1.90
+++ src/sys/arch/sparc/include/pmap.h   8 Dec 2012 21:55:00 -0000
@@ -240,7 +240,7 @@ int pmap_dumpmmu(int (*)(dev_t, daddr_t,
 #define        pmap_resident_count(pm) ((pm)->pm_stats.resident_count)
 #define        pmap_wired_count(pm)    ((pm)->pm_stats.wired_count)
 
-#define PMAP_PREFER(fo, ap, sz, td)    pmap_prefer((fo), (ap))
+#define PMAP_PREFER(fo, ap, sz, td)    pmap_prefer((fo), (ap), (sz), (td))
 
 #define PMAP_EXCLUDE_DECLS     /* tells MI pmap.h *not* to include decls */
 
@@ -249,7 +249,7 @@ int pmap_dumpmmu(int (*)(dev_t, daddr_t,
 void           pmap_activate(struct lwp *);
 void           pmap_deactivate(struct lwp *);
 void           pmap_bootstrap(int nmmu, int nctx, int nregion);
-void           pmap_prefer(vaddr_t, vaddr_t *);
+void           pmap_prefer(vaddr_t, vaddr_t *, size_t, int);
 int            pmap_pa_exists(paddr_t);
 void           pmap_unwire(pmap_t, vaddr_t);
 void           pmap_copy(pmap_t, pmap_t, vaddr_t, vsize_t, vaddr_t);
Index: src/sys/arch/sparc/include/vmparam.h
===================================================================
RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/include/vmparam.h,v
retrieving revision 1.42
diff -u -p -r1.42 vmparam.h
--- src/sys/arch/sparc/include/vmparam.h        14 Nov 2010 13:33:23 -0000      
1.42
+++ src/sys/arch/sparc/include/vmparam.h        4 Dec 2012 14:21:55 -0000
@@ -43,6 +43,8 @@
 #ifndef _SPARC_VMPARAM_H_
 #define _SPARC_VMPARAM_H_
 
+#define __USE_TOPDOWN_VM
+
 /*
  * Machine dependent constants for SPARC
  */
Index: src/sys/arch/sparc/sparc/pmap.c
===================================================================
RCS file: /home/chs/netbsd/cvs/src/sys/arch/sparc/sparc/pmap.c,v
retrieving revision 1.349
diff -u -p -r1.349 pmap.c
--- src/sys/arch/sparc/sparc/pmap.c     4 Nov 2012 00:32:47 -0000       1.349
+++ src/sys/arch/sparc/sparc/pmap.c     8 Dec 2012 22:08:49 -0000
@@ -7408,21 +7408,32 @@ kvm_iocache(char *va, int npages)
  * (This will just seg-align mappings.)
  */
 void
-pmap_prefer(vaddr_t foff, vaddr_t *vap)
+pmap_prefer(vaddr_t foff, vaddr_t *vap, size_t size, int td)
 {
        vaddr_t va = *vap;
-       long d, m;
-
-       if (VA_INHOLE(va))
-               va = MMU_HOLE_END;
+       long m;
 
        m = CACHE_ALIAS_DIST;
        if (m == 0)             /* m=0 => no cache aliasing */
                return;
 
-       d = foff - va;
-       d &= (m - 1);
-       *vap = va + d;
+       if (VA_INHOLE(va)) {
+               if (td)
+                       va = MMU_HOLE_START - size;
+               else
+                       va = MMU_HOLE_END;
+       }
+
+       va = (va & ~(m - 1)) | (foff & (m - 1));
+
+       if (td) {
+               if (va > *vap)
+                       va -= m;
+       } else {
+               if (va < *vap)
+                       va += m;
+       }
+       *vap = va;
 }
 
 void


Home | Main Index | Thread Index | Old Index