Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64 implement pmap_wired_count().



details:   https://anonhg.NetBSD.org/src/rev/3055e9050c8e
branches:  trunk
changeset: 515386:3055e9050c8e
user:      chs <chs%NetBSD.org@localhost>
date:      Sun Sep 23 09:01:13 2001 +0000

description:
implement pmap_wired_count().

diffstat:

 sys/arch/sparc64/include/pmap.h |   5 +++--
 sys/arch/sparc64/sparc64/pmap.c |  35 ++++++++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 3 deletions(-)

diffs (69 lines):

diff -r a60672619ef9 -r 3055e9050c8e sys/arch/sparc64/include/pmap.h
--- a/sys/arch/sparc64/include/pmap.h   Sun Sep 23 08:51:11 2001 +0000
+++ b/sys/arch/sparc64/include/pmap.h   Sun Sep 23 09:01:13 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.h,v 1.19 2001/09/10 21:19:26 chris Exp $  */
+/*     $NetBSD: pmap.h,v 1.20 2001/09/23 09:01:13 chs Exp $    */
 
 /*-
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -157,8 +157,9 @@
 #define        pmap_kernel()   (&kernel_pmap_)
 
 int pmap_count_res __P((pmap_t pmap));
-/* int pmap_change_wiring __P((pmap_t pm, vaddr_t va, boolean_t wired)); */
+int pmap_count_wired __P((pmap_t pmap));
 #define pmap_resident_count(pm)                pmap_count_res((pm))
+#define pmap_wired_count(pm)           pmap_count_wired((pm))
 #define pmap_from_phys_address(x,f)    ((x)>>PGSHIFT)
 #define        pmap_phys_address(x)            ((((paddr_t)(x))<<PGSHIFT)|PMAP_NC)
 #define        pmap_update(pmap)               /* nothing (yet) */
diff -r a60672619ef9 -r 3055e9050c8e sys/arch/sparc64/sparc64/pmap.c
--- a/sys/arch/sparc64/sparc64/pmap.c   Sun Sep 23 08:51:11 2001 +0000
+++ b/sys/arch/sparc64/sparc64/pmap.c   Sun Sep 23 09:01:13 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.111 2001/09/21 03:02:32 eeh Exp $   */
+/*     $NetBSD: pmap.c,v 1.112 2001/09/23 09:01:13 chs Exp $   */
 #undef NO_VCACHE /* Don't forget the locked TLB in dostart */
 #define        HWREF
 /*
@@ -3350,6 +3350,39 @@
 }
 
 /*
+ * count wired pages in pmap -- this can be slow.
+ */
+int
+pmap_count_wired(pm)
+       pmap_t pm;
+{
+       int i, j, k, n, s;
+       paddr_t *pdir, *ptbl;
+       /* Almost the same as pmap_collect() */
+
+       /* Don't want one of these pages reused while we're reading it. */
+       s = splvm();
+       simple_lock(&pm->pm_lock);
+       n = 0;
+       for (i = 0; i < STSZ; i++) {
+               if ((pdir = (paddr_t *)(u_long)ldxa((vaddr_t)&pm->pm_segs[i], ASI_PHYS_CACHED))) {
+                       for (k = 0; k < PDSZ; k++) {
+                               if ((ptbl = (paddr_t *)(u_long)ldxa((vaddr_t)&pdir[k], ASI_PHYS_CACHED))) {
+                                       for (j = 0; j < PTSZ; j++) {
+                                               int64_t data = (int64_t)ldxa((vaddr_t)&ptbl[j], ASI_PHYS_CACHED);
+                                               if (data & TLB_TSB_LOCK)
+                                                       n++;
+                                       }
+                               }
+                       }
+               }
+       }
+       simple_unlock(&pm->pm_lock);
+       splx(s);
+       return n;
+}
+
+/*
  * Allocate a context.  If necessary, steal one from someone else.
  * Changes hardware context number and loads segment map.
  *



Home | Main Index | Thread Index | Old Index