implement pmap_wired_count().
This commit is contained in:
parent
6f081befa2
commit
59c12af6f5
|
@ -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 @@ extern struct pmap kernel_pmap_;
|
|||
#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) */
|
||||
|
|
|
@ -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
|
||||
/*
|
||||
|
@ -3349,6 +3349,39 @@ pmap_count_res(pm)
|
|||
return n;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.
|
||||
|
|
Loading…
Reference in New Issue