summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorDale S. Rahn <rahnds@cvs.openbsd.org>1997-01-09 03:07:17 +0000
committerDale S. Rahn <rahnds@cvs.openbsd.org>1997-01-09 03:07:17 +0000
commitaf626d03b4694e9409c46202c98d73a7f41213ed (patch)
tree9105c44abafb1bc8330d259ac838e6947315233c /sys/arch
parenta86d2628e658be70451e926419ffaf4577913ec9 (diff)
support resident page count.
Attempt at least, pmap doesn't allow for exact tracking.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/powerpc/powerpc/genassym.c5
-rw-r--r--sys/arch/powerpc/powerpc/pmap.c35
2 files changed, 30 insertions, 10 deletions
diff --git a/sys/arch/powerpc/powerpc/genassym.c b/sys/arch/powerpc/powerpc/genassym.c
index dc714df7243..0478d8d00ab 100644
--- a/sys/arch/powerpc/powerpc/genassym.c
+++ b/sys/arch/powerpc/powerpc/genassym.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: genassym.c,v 1.2 1996/12/28 06:22:00 rahnds Exp $ */
+/* $OpenBSD: genassym.c,v 1.3 1997/01/09 03:07:15 rahnds Exp $ */
/* $NetBSD: genassym.c,v 1.1 1996/09/30 16:34:46 ws Exp $ */
/*
@@ -36,6 +36,9 @@
#include <sys/param.h>
#include <sys/time.h>
#include <sys/proc.h>
+ #include <vm/vm.h>
+ #include <vm/vm_kern.h>
+
#include <machine/pcb.h>
#include <machine/pmap.h>
diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c
index 71cfefecbe0..64e47f746b6 100644
--- a/sys/arch/powerpc/powerpc/pmap.c
+++ b/sys/arch/powerpc/powerpc/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.2 1996/12/28 06:22:14 rahnds Exp $ */
+/* $OpenBSD: pmap.c,v 1.3 1997/01/09 03:07:16 rahnds Exp $ */
/* $NetBSD: pmap.c,v 1.1 1996/09/30 16:34:52 ws Exp $ */
/*
@@ -873,7 +873,8 @@ pmap_enter_pv(pteidx, va, pind)
}
static void
-pmap_remove_pv(pteidx, va, pind, pte)
+pmap_remove_pv(pm, pteidx, va, pind, pte)
+ struct pmap *pm;
int pteidx;
vm_offset_t va;
int pind;
@@ -905,8 +906,16 @@ pmap_remove_pv(pteidx, va, pind, pte)
if (npv) {
*pv = *npv;
pmap_free_pv(npv);
- } else
+ } else {
pv->pv_idx = -1;
+ }
+ if (pm != NULL) {
+ /* if called from pmap_page_protect,
+ * we don't know what pmap it was removed from.
+ * BAD DESIGN.
+ */
+ pm->pm_stats.resident_count--;
+ }
} else {
for (; npv = pv->pv_next; pv = npv)
if (pteidx == npv->pv_idx && va == npv->pv_va)
@@ -914,6 +923,9 @@ pmap_remove_pv(pteidx, va, pind, pte)
if (npv) {
pv->pv_next = npv->pv_next;
pmap_free_pv(npv);
+ if (pm != NULL) {
+ pm->pm_stats.resident_count--;
+ }
}
#ifdef DIAGNOSTIC
else
@@ -942,6 +954,8 @@ pmap_enter(pm, va, pa, prot, wired)
* Have to remove any existing mapping first.
*/
pmap_remove(pm, va, va + NBPG - 1);
+
+ pm->pm_stats.resident_count++;
/*
* Compute the HTAB index.
@@ -1015,7 +1029,8 @@ pmap_remove(pm, va, endva)
idx = pteidx(sr = ptesr(pm->pm_sr, va), va);
for (ptp = ptable + idx * 8, i = 8; --i >= 0; ptp++)
if (ptematch(ptp, sr, va, PTE_VALID)) {
- pmap_remove_pv(idx, va, pmap_page_index(ptp->pte_lo), ptp);
+ pmap_remove_pv(pm, idx, va,
+ pmap_page_index(ptp->pte_lo), ptp);
ptp->pte_hi &= ~PTE_VALID;
asm volatile ("sync");
tlbie(va);
@@ -1023,7 +1038,8 @@ pmap_remove(pm, va, endva)
}
for (ptp = ptable + (idx ^ ptab_mask) * 8, i = 8; --i >= 0; ptp++)
if (ptematch(ptp, sr, va, PTE_VALID | PTE_HID)) {
- pmap_remove_pv(idx, va, pmap_page_index(ptp->pte_lo), ptp);
+ pmap_remove_pv(pm, idx, va,
+ pmap_page_index(ptp->pte_lo), ptp);
ptp->pte_hi &= ~PTE_VALID;
asm volatile ("sync");
tlbie(va);
@@ -1032,7 +1048,8 @@ pmap_remove(pm, va, endva)
for (po = potable[idx].lh_first; po; po = npo) {
npo = po->po_list.le_next;
if (ptematch(&po->po_pte, sr, va, 0)) {
- pmap_remove_pv(idx, va, pmap_page_index(po->po_pte.pte_lo),
+ pmap_remove_pv(pm, idx, va,
+ pmap_page_index(po->po_pte.pte_lo),
&po->po_pte);
LIST_REMOVE(po, po_list);
pofree(po, 1);
@@ -1275,7 +1292,7 @@ pmap_page_protect(pa, prot)
for (ptp = ptable + idx * 8, i = 8; --i >= 0; ptp++)
if ((ptp->pte_hi & PTE_VALID)
&& (ptp->pte_lo & PTE_RPGN) == pa) {
- pmap_remove_pv(idx, va, pind, ptp);
+ pmap_remove_pv(NULL, idx, va, pind, ptp);
ptp->pte_hi &= ~PTE_VALID;
asm volatile ("sync");
tlbie(va);
@@ -1284,7 +1301,7 @@ pmap_page_protect(pa, prot)
for (ptp = ptable + (idx ^ ptab_mask) * 8, i = 8; --i >= 0; ptp++)
if ((ptp->pte_hi & PTE_VALID)
&& (ptp->pte_lo & PTE_RPGN) == pa) {
- pmap_remove_pv(idx, va, pind, ptp);
+ pmap_remove_pv(NULL, idx, va, pind, ptp);
ptp->pte_hi &= ~PTE_VALID;
asm volatile ("sync");
tlbie(va);
@@ -1293,7 +1310,7 @@ pmap_page_protect(pa, prot)
for (po = potable[idx].lh_first; po; po = npo) {
npo = po->po_list.le_next;
if ((po->po_pte.pte_lo & PTE_RPGN) == pa) {
- pmap_remove_pv(idx, va, pind, &po->po_pte);
+ pmap_remove_pv(NULL,idx, va, pind, &po->po_pte);
LIST_REMOVE(po, po_list);
pofree(po, 1);
}