Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/vax implement pmap_wired_count().
details: https://anonhg.NetBSD.org/src/rev/c1dc2b6fa9a5
branches: trunk
changeset: 515407:c1dc2b6fa9a5
user: chs <chs%NetBSD.org@localhost>
date: Mon Sep 24 01:48:15 2001 +0000
description:
implement pmap_wired_count().
diffstat:
sys/arch/vax/include/pmap.h | 3 +-
sys/arch/vax/vax/pmap.c | 49 +++++++++++++++++++++++++++++++++-----------
2 files changed, 38 insertions(+), 14 deletions(-)
diffs (151 lines):
diff -r 8ffab385c2ee -r c1dc2b6fa9a5 sys/arch/vax/include/pmap.h
--- a/sys/arch/vax/include/pmap.h Mon Sep 24 01:29:06 2001 +0000
+++ b/sys/arch/vax/include/pmap.h Mon Sep 24 01:48:15 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.48 2001/09/10 21:19:29 chris Exp $ */
+/* $NetBSD: pmap.h,v 1.49 2001/09/24 01:48:15 chs Exp $ */
/*
* Copyright (c) 1987 Carnegie-Mellon University
@@ -157,6 +157,7 @@
#define pmap_collect(pmap) /* No need so far */
#define pmap_remove(pmap, start, slut) pmap_protect(pmap, start, slut, 0)
#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
+#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
#define pmap_deactivate(p) /* Dont do anything */
#define pmap_reference(pmap) (pmap)->ref_count++
diff -r 8ffab385c2ee -r c1dc2b6fa9a5 sys/arch/vax/vax/pmap.c
--- a/sys/arch/vax/vax/pmap.c Mon Sep 24 01:29:06 2001 +0000
+++ b/sys/arch/vax/vax/pmap.c Mon Sep 24 01:48:15 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.106 2001/09/10 21:19:30 chris Exp $ */
+/* $NetBSD: pmap.c,v 1.107 2001/09/24 01:48:16 chs Exp $ */
/*
* Copyright (c) 1994, 1998, 1999 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -596,6 +596,9 @@
pv->pv_pte = 0;
simple_lock(&pv->pv_pmap->pm_lock);
pv->pv_pmap->pm_stats.resident_count--;
+ if (g[0] & PG_W) {
+ pv->pv_pmap->pm_stats.wired_count--;
+ }
simple_unlock(&pv->pv_pmap->pm_lock);
pv->pv_pmap = 0;
PVTABLE_UNLOCK;
@@ -613,6 +616,9 @@
g[0]|g[1]|g[2]|g[3]|g[4]|g[5]|g[6]|g[7];
simple_lock(&pf->pv_pmap->pm_lock);
pf->pv_pmap->pm_stats.resident_count--;
+ if (g[0] & PG_W) {
+ pf->pv_pmap->pm_stats.wired_count--;
+ }
simple_unlock(&pf->pv_pmap->pm_lock);
free_pventry(pf);
PVTABLE_UNLOCK;
@@ -808,9 +814,10 @@
oldpte = patch[i] & ~(PG_V|PG_M);
pv = pv_table + (p >> PGSHIFT);
- /* wiring change? */
+ /* just a wiring change? */
if (newpte == (oldpte | PG_W)) {
- patch[i] |= PG_W; /* Just wiring change */
+ patch[i] |= PG_W;
+ pmap->pm_stats.wired_count++;
RECURSEEND;
return 0;
}
@@ -822,14 +829,20 @@
}
/* Changing mapping? */
- oldpte &= PG_FRAME;
- if ((newpte & PG_FRAME) == oldpte) {
+
+ if ((newpte & PG_FRAME) == (oldpte & PG_FRAME)) {
/* prot change. resident_count will be increased later */
pmap->pm_stats.resident_count--;
+ if (oldpte & PG_W) {
+ pmap->pm_stats.wired_count--;
+ }
} else {
+
/*
* Mapped before? Remove it then.
*/
+
+ oldpte &= PG_FRAME;
if (oldpte) {
RECURSEEND;
rensa(oldpte >> LTOHPS, (struct pte *)&patch[i]);
@@ -840,7 +853,7 @@
s = splvm();
PVTABLE_LOCK;
if (pv->pv_pte == 0) {
- pv->pv_pte = (struct pte *) & patch[i];
+ pv->pv_pte = (struct pte *)&patch[i];
pv->pv_pmap = pmap;
} else {
tmp = get_pventry();
@@ -853,6 +866,9 @@
splx(s);
}
pmap->pm_stats.resident_count++;
+ if (flags & PMAP_WIRED) {
+ pmap->pm_stats.wired_count++;
+ }
PVTABLE_LOCK;
if (flags & VM_PROT_READ) {
@@ -1332,13 +1348,16 @@
s = splvm();
g = (int *)pv->pv_pte;
if (g) {
+ simple_lock(&pv->pv_pmap->pm_lock);
+ pv->pv_pmap->pm_stats.resident_count--;
+ if (g[0] & PG_W) {
+ pv->pv_pmap->pm_stats.wired_count--;
+ }
+ simple_unlock(&pv->pv_pmap->pm_lock);
if ((pv->pv_attr & (PG_V|PG_M)) != (PG_V|PG_M))
pv->pv_attr |=
g[0]|g[1]|g[2]|g[3]|g[4]|g[5]|g[6]|g[7];
bzero(g, sizeof(struct pte) * LTOHPN);
- simple_lock(&pv->pv_pmap->pm_lock);
- pv->pv_pmap->pm_stats.resident_count--;
- simple_unlock(&pv->pv_pmap->pm_lock);
pmap_decpteref(pv->pv_pmap, pv->pv_pte);
pv->pv_pte = 0;
}
@@ -1347,13 +1366,16 @@
pv->pv_next = 0;
while (pl) {
g = (int *)pl->pv_pte;
+ simple_lock(&pl->pv_pmap->pm_lock);
+ pl->pv_pmap->pm_stats.resident_count--;
+ if (g[0] & PG_W) {
+ pl->pv_pmap->pm_stats.wired_count--;
+ }
+ simple_unlock(&pl->pv_pmap->pm_lock);
if ((pv->pv_attr & (PG_V|PG_M)) != (PG_V|PG_M))
pv->pv_attr |=
g[0]|g[1]|g[2]|g[3]|g[4]|g[5]|g[6]|g[7];
bzero(g, sizeof(struct pte) * LTOHPN);
- simple_lock(&pl->pv_pmap->pm_lock);
- pl->pv_pmap->pm_stats.resident_count--;
- simple_unlock(&pl->pv_pmap->pm_lock);
pmap_decpteref(pl->pv_pmap, pl->pv_pte);
opv = pl;
pl = pl->pv_next;
@@ -1433,7 +1455,8 @@
else
pte = (int *)&pmap->pm_p1br[PG_PFNUM(v)];
}
- pte[0] &= ~PG_W; /* Informational, only first page */
+ pte[0] &= ~PG_W;
+ pmap->pm_stats.wired_count--;
}
/*
Home |
Main Index |
Thread Index |
Old Index