Unclutter a bit. Use a PMAP_DPRINTF() macro where possible, getting rid

of loads of #ifdef DEBUG ... stuff.
This commit is contained in:
thorpej 1998-12-19 23:51:47 +00:00
parent 3f4b5577f4
commit 80e50e26a8

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.55 1998/12/19 23:21:51 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.56 1998/12/19 23:51:47 thorpej Exp $ */
/*
* Copyright (c) 1991, 1993
@ -118,8 +118,6 @@
#include <machine/cpu.h>
#ifdef DEBUG
int debugmap = 0;
int pmapdebug = 0x2000;
#define PDB_FOLLOW 0x0001
#define PDB_INIT 0x0002
#define PDB_ENTER 0x0004
@ -136,18 +134,26 @@ int pmapdebug = 0x2000;
#define PDB_WIRING 0x4000
#define PDB_PVDUMP 0x8000
int debugmap = 0;
int pmapdebug = PDB_PARANOIA;
#define PMAP_DPRINTF(l, x) if (pmapdebug & (l)) printf x
#ifdef M68K_MMU_HP
int pmapvacflush = 0;
#define PVF_ENTER 0x01
#define PVF_REMOVE 0x02
#define PVF_PROTECT 0x04
#define PVF_TOTAL 0x80
int pmapvacflush = 0;
#endif
#if defined(M68040)
int dowriteback = 1; /* 68040: enable writeback caching */
int dokwriteback = 1; /* 68040: enable writeback caching of kernel AS */
#endif
#else /* ! DEBUG */
#define PMAP_DPRINTF(l, x) /* nothing */
#endif /* DEBUG */
/*
@ -329,10 +335,8 @@ pmap_init()
int npages;
int bank;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_init()\n");
#endif
PMAP_DPRINTF(PDB_FOLLOW, ("pmap_init()\n"));
/*
* Now that kernel map has been allocated, we can mark as
* unavailable regions which we have mapped in pmap_bootstrap().
@ -380,14 +384,12 @@ bogons:
panic("pmap_init: bogons in the VM system!\n");
#endif /* UVM */
#ifdef DEBUG
if (pmapdebug & PDB_INIT) {
printf("pmap_init: Sysseg %p, Sysmap %p, Sysptmap %p\n",
Sysseg, Sysmap, Sysptmap);
printf(" pstart %lx, pend %lx, vstart %lx, vend %lx\n",
avail_start, avail_end, virtual_avail, virtual_end);
}
#endif
PMAP_DPRINTF(PDB_INIT,
("pmap_init: Sysseg %p, Sysmap %p, Sysptmap %p\n",
Sysseg, Sysmap, Sysptmap));
PMAP_DPRINTF(PDB_INIT,
(" pstart %lx, pend %lx, vstart %lx, vend %lx\n",
avail_start, avail_end, virtual_avail, virtual_end));
/*
* Allocate memory for random pmap data structures. Includes the
@ -416,13 +418,10 @@ bogons:
pmap_attributes = (char *) addr;
#ifdef DEBUG
if (pmapdebug & PDB_INIT)
printf("pmap_init: %lx bytes: page_cnt %x s0 %p(%p) "
"tbl %p atr %p\n",
s, page_cnt, Segtabzero, Segtabzeropa,
pv_table, pmap_attributes);
#endif
PMAP_DPRINTF(PDB_INIT, ("pmap_init: %lx bytes: page_cnt %x s0 %p(%p) "
"tbl %p atr %p\n",
s, page_cnt, Segtabzero, Segtabzeropa,
pv_table, pmap_attributes));
/*
* Now that the pv and attribute tables have been allocated,
@ -489,11 +488,9 @@ bogons:
kpt_pages->kpt_va = addr2;
kpt_pages->kpt_pa = pmap_extract(pmap_kernel(), addr2);
} while (addr != addr2);
#ifdef DEBUG
if (pmapdebug & PDB_INIT)
printf("pmap_init: KPT: %ld pages from %lx to %lx\n",
atop(s), addr, addr + s);
#endif
PMAP_DPRINTF(PDB_INIT, ("pmap_init: KPT: %ld pages from %lx to %lx\n",
atop(s), addr, addr + s));
#if defined(UVM)
/*
@ -551,10 +548,9 @@ bogons:
rv = vm_map_submap(kernel_map, addr, addr2, pt_map);
if (rv != KERN_SUCCESS)
panic("pmap_init: cannot map range to pt_map");
#ifdef DEBUG
if (pmapdebug & PDB_INIT)
printf("pmap_init: pt_map [%lx - %lx)\n", addr, addr2);
#endif
PMAP_DPRINTF(PDB_INIT,
/* ( */ ("pmap_init: pt_map [%lx - %lx)\n", addr, addr2));
#endif /* UVM */
#if defined(M68040)
@ -713,10 +709,8 @@ pmap_map(va, spa, epa, prot)
int prot;
{
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_map(%lx, %lx, %lx, %x)\n", va, spa, epa, prot);
#endif
PMAP_DPRINTF(PDB_FOLLOW,
("pmap_map(%lx, %lx, %lx, %x)\n", va, spa, epa, prot));
while (spa < epa) {
pmap_enter(pmap_kernel(), va, spa, prot, FALSE);
@ -744,10 +738,8 @@ pmap_create(size)
{
pmap_t pmap;
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
printf("pmap_create(%lx)\n", size);
#endif
PMAP_DPRINTF(PDB_FOLLOW|PDB_CREATE,
("pmap_create(%lx)\n", size));
/*
* Software use map does not need a pmap
@ -775,10 +767,8 @@ pmap_pinit(pmap)
struct pmap *pmap;
{
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
printf("pmap_pinit(%p)\n", pmap);
#endif
PMAP_DPRINTF(PDB_FOLLOW|PDB_CREATE,
("pmap_pinit(%p)\n", pmap));
/*
* No need to allocate page table space yet but we do need a
@ -810,10 +800,7 @@ pmap_destroy(pmap)
if (pmap == NULL)
return;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_destroy(%p)\n", pmap);
#endif
PMAP_DPRINTF(PDB_FOLLOW, ("pmap_destroy(%p)\n", pmap));
simple_lock(&pmap->pm_lock);
count = --pmap->pm_count;
@ -834,10 +821,7 @@ pmap_release(pmap)
struct pmap *pmap;
{
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_release(%p)\n", pmap);
#endif
PMAP_DPRINTF(PDB_FOLLOW, ("pmap_release(%p)\n", pmap));
#ifdef notdef /* DIAGNOSTIC */
/* count would be 0 from pmap_destroy... */
@ -875,10 +859,7 @@ pmap_reference(pmap)
if (pmap == NULL)
return;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_reference(%p)\n", pmap);
#endif
PMAP_DPRINTF(PDB_FOLLOW, ("pmap_reference(%p)\n", pmap));
simple_lock(&pmap->pm_lock);
pmap->pm_count++;
@ -894,10 +875,8 @@ pmap_activate(p)
{
pmap_t pmap = p->p_vmspace->vm_map.pmap;
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_SEGTAB))
printf("pmap_activate(%p)\n", p);
#endif
PMAP_DPRINTF(PDB_FOLLOW|PDB_SEGTAB,
("pmap_activate(%p)\n", p));
PMAP_ACTIVATE(pmap, p == curproc);
}
@ -927,10 +906,8 @@ pmap_remove(pmap, sva, eva)
boolean_t firstpage, needcflush;
int flags;
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT))
printf("pmap_remove(%p, %lx, %lx)\n", pmap, sva, eva);
#endif
PMAP_DPRINTF(PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT,
("pmap_remove(%p, %lx, %lx)\n", pmap, sva, eva));
if (pmap == NULL)
return;
@ -1096,10 +1073,9 @@ pmap_protect(pmap, sva, eva, prot)
boolean_t firstpage, needtflush;
int isro;
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_PROTECT))
printf("pmap_protect(%p, %lx, %lx, %x)\n", pmap, sva, eva, prot);
#endif
PMAP_DPRINTF(PDB_FOLLOW|PDB_PROTECT,
("pmap_protect(%p, %lx, %lx, %x)\n",
pmap, sva, eva, prot));
if (pmap == NULL)
return;
@ -1204,11 +1180,10 @@ pmap_enter(pmap, va, pa, prot, wired)
boolean_t cacheable = TRUE;
boolean_t checkpv = TRUE;
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_ENTER))
printf("pmap_enter(%p, %lx, %lx, %x, %x)\n",
pmap, va, pa, prot, wired);
#endif
PMAP_DPRINTF(PDB_FOLLOW|PDB_ENTER,
("pmap_enter(%p, %lx, %lx, %x, %x)\n",
pmap, va, pa, prot, wired));
if (pmap == NULL)
return;
@ -1233,10 +1208,8 @@ pmap_enter(pmap, va, pa, prot, wired)
pa = m68k_trunc_page(pa);
pte = pmap_pte(pmap, va);
opa = pmap_pte_pa(pte);
#ifdef DEBUG
if (pmapdebug & PDB_ENTER)
printf("enter: pte %p, *pte %x\n", pte, *pte);
#endif
PMAP_DPRINTF(PDB_ENTER, ("enter: pte %p, *pte %x\n", pte, *pte));
/*
* Mapping has not changed, must be protection or wiring change.
@ -1249,10 +1222,8 @@ pmap_enter(pmap, va, pa, prot, wired)
* Hence, if a user page is wired, the PT page will be also.
*/
if (pmap_pte_w_chg(pte, wired ? PG_W : 0)) {
#ifdef DEBUG
if (pmapdebug & PDB_ENTER)
printf("enter: wiring change -> %x\n", wired);
#endif
PMAP_DPRINTF(PDB_ENTER,
("enter: wiring change -> %x\n", wired));
if (wired)
pmap->pm_stats.wired_count++;
else
@ -1272,10 +1243,8 @@ pmap_enter(pmap, va, pa, prot, wired)
* handle validating new mapping.
*/
if (opa) {
#ifdef DEBUG
if (pmapdebug & PDB_ENTER)
printf("enter: removing old mapping %lx\n", va);
#endif
PMAP_DPRINTF(PDB_ENTER,
("enter: removing old mapping %lx\n", va));
pmap_remove_mapping(pmap, va, pte, PRM_TFLUSH|PRM_CFLUSH);
}
@ -1304,11 +1273,9 @@ pmap_enter(pmap, va, pa, prot, wired)
pv = pa_to_pvh(pa);
s = splimp();
#ifdef DEBUG
if (pmapdebug & PDB_ENTER)
printf("enter: pv at %p: %lx/%p/%p\n",
pv, pv->pv_va, pv->pv_pmap, pv->pv_next);
#endif
PMAP_DPRINTF(PDB_ENTER,
("enter: pv at %p: %lx/%p/%p\n",
pv, pv->pv_va, pv->pv_pmap, pv->pv_next));
/*
* No entries yet, use header as the first entry
*/
@ -1363,11 +1330,9 @@ pmap_enter(pmap, va, pa, prot, wired)
*/
if (pmap_aliasmask) {
if (pv->pv_flags & PV_CI) {
#ifdef DEBUG
if (pmapdebug & PDB_CACHE)
printf("enter: pa %lx already CI'ed\n",
pa);
#endif
PMAP_DPRINTF(PDB_CACHE,
("enter: pa %lx already CI'ed\n",
pa));
checkpv = cacheable = FALSE;
} else if (npv->pv_next ||
((pmap == pv->pv_pmap ||
@ -1375,11 +1340,9 @@ pmap_enter(pmap, va, pa, prot, wired)
pv->pv_pmap == pmap_kernel()) &&
((pv->pv_va & pmap_aliasmask) !=
(va & pmap_aliasmask)))) {
#ifdef DEBUG
if (pmapdebug & PDB_CACHE)
printf("enter: pa %lx CI'ing all\n",
pa);
#endif
PMAP_DPRINTF(PDB_CACHE,
("enter: pa %lx CI'ing all\n",
pa));
cacheable = FALSE;
pv->pv_flags |= PV_CI;
}
@ -1427,10 +1390,9 @@ validate:
#endif
npte |= PG_CCB;
#endif
#ifdef DEBUG
if (pmapdebug & PDB_ENTER)
printf("enter: new pte value %x\n", npte);
#endif
PMAP_DPRINTF(PDB_ENTER, ("enter: new pte value %x\n", npte));
/*
* Remember if this was a wiring-only change.
* If so, we need not flush the TLB and caches.
@ -1494,10 +1456,9 @@ pmap_change_wiring(pmap, va, wired)
{
pt_entry_t *pte;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_change_wiring(%p, %lx, %x)\n", pmap, va, wired);
#endif
PMAP_DPRINTF(PDB_FOLLOW,
("pmap_change_wiring(%p, %lx, %x)\n", pmap, va, wired));
if (pmap == NULL)
return;
@ -1550,19 +1511,17 @@ pmap_extract(pmap, va)
{
paddr_t pa;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_extract(%p, %lx) -> ", pmap, va);
#endif
PMAP_DPRINTF(PDB_FOLLOW,
("pmap_extract(%p, %lx) -> ", pmap, va));
pa = 0;
if (pmap && pmap_ste_v(pmap, va))
pa = *pmap_pte(pmap, va);
if (pa)
pa = (pa & PG_FRAME) | (va & ~PG_FRAME);
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("%lx\n", pa);
#endif
PMAP_DPRINTF(PDB_FOLLOW, ("%lx\n", pa));
return (pa);
}
@ -1580,11 +1539,10 @@ void pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr)
vsize_t len;
vaddr_t src_addr;
{
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_copy(%p, %p, %lx, %lx, %lx)\n",
dst_pmap, src_pmap, dst_addr, len, src_addr);
#endif
PMAP_DPRINTF(PDB_FOLLOW,
("pmap_copy(%p, %p, %lx, %lx, %lx)\n",
dst_pmap, src_pmap, dst_addr, len, src_addr));
}
/*
@ -1597,11 +1555,10 @@ void pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr)
*/
void pmap_update()
{
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_update()\n");
#endif
TBIA();
PMAP_DPRINTF(PDB_FOLLOW, ("pmap_update()\n"));
TBIA(); /* XXX should not be here. */
}
/*
@ -1624,10 +1581,8 @@ pmap_collect(pmap)
if (pmap != pmap_kernel())
return;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_collect(%p)\n", pmap);
#endif
PMAP_DPRINTF(PDB_FOLLOW, ("pmap_collect(%p)\n", pmap));
s = splimp();
for (bank = 0; bank < vm_nphysseg; bank++)
pmap_collect1(pmap, ptoa(vm_physmem[bank].start),
@ -1765,10 +1720,8 @@ pmap_zero_page(phys)
vaddr_t kva;
extern caddr_t CADDR1;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_zero_page(%lx)\n", phys);
#endif
PMAP_DPRINTF(PDB_FOLLOW, ("pmap_zero_page(%lx)\n", phys));
kva = (vaddr_t) CADDR1;
pmap_enter(pmap_kernel(), kva, phys, VM_PROT_READ|VM_PROT_WRITE, TRUE);
zeropage((caddr_t)kva);
@ -1796,10 +1749,8 @@ pmap_copy_page(src, dst)
vaddr_t skva, dkva;
extern caddr_t CADDR1, CADDR2;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_copy_page(%lx, %lx)\n", src, dst);
#endif
PMAP_DPRINTF(PDB_FOLLOW, ("pmap_copy_page(%lx, %lx)\n", src, dst));
skva = (vaddr_t)CADDR1;
dkva = (vaddr_t)CADDR2;
pmap_enter(pmap_kernel(), skva, src, VM_PROT_READ, TRUE);
@ -1829,11 +1780,11 @@ pmap_pageable(pmap, sva, eva, pageable)
vaddr_t sva, eva;
boolean_t pageable;
{
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_pageable(%p, %lx, %lx, %x)\n",
pmap, sva, eva, pageable);
#endif
PMAP_DPRINTF(PDB_FOLLOW,
("pmap_pageable(%p, %lx, %lx, %x)\n",
pmap, sva, eva, pageable));
/*
* If we are making a PT page pageable then all valid
* mappings must be gone from that page. Hence it should
@ -1893,10 +1844,9 @@ void
pmap_clear_modify(pa)
paddr_t pa;
{
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_clear_modify(%lx)\n", pa);
#endif
PMAP_DPRINTF(PDB_FOLLOW, ("pmap_clear_modify(%lx)\n", pa));
pmap_changebit(pa, 0, ~PG_M);
}
@ -1909,10 +1859,9 @@ pmap_clear_modify(pa)
void pmap_clear_reference(pa)
paddr_t pa;
{
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_clear_reference(%lx)\n", pa);
#endif
PMAP_DPRINTF(PDB_FOLLOW, ("pmap_clear_reference(%lx)\n", pa));
pmap_changebit(pa, 0, ~PG_U);
}
@ -2026,12 +1975,12 @@ pmap_remove_mapping(pmap, va, pte, flags)
int s, bits;
#ifdef DEBUG
pt_entry_t opte;
if (pmapdebug & (PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT))
printf("pmap_remove_mapping(%p, %lx, %p, %x)\n",
pmap, va, pte, flags);
#endif
PMAP_DPRINTF(PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT,
("pmap_remove_mapping(%p, %lx, %p, %x)\n",
pmap, va, pte, flags));
/*
* PTE not provided, compute it from pmap and va.
*/
@ -2071,10 +2020,7 @@ pmap_remove_mapping(pmap, va, pte, flags)
/*
* Invalidate the PTE after saving the reference modify info.
*/
#ifdef DEBUG
if (pmapdebug & PDB_REMOVE)
printf("remove: invalidating pte at %p\n", pte);
#endif
PMAP_DPRINTF(PDB_REMOVE, ("remove: invalidating pte at %p\n", pte));
bits = *pte & (PG_U|PG_M);
*pte = PG_NV;
if ((flags & PRM_TFLUSH) && active_pmap(pmap))
@ -2149,10 +2095,8 @@ pmap_remove_mapping(pmap, va, pte, flags)
*/
if (pmap_aliasmask &&
pv->pv_pmap && pv->pv_next == NULL && (pv->pv_flags & PV_CI)) {
#ifdef DEBUG
if (pmapdebug & PDB_CACHE)
printf("remove: clearing CI for pa %lx\n", pa);
#endif
PMAP_DPRINTF(PDB_CACHE,
("remove: clearing CI for pa %lx\n", pa));
pv->pv_flags &= ~PV_CI;
pmap_changebit(pa, 0, ~PG_CI);
#ifdef DEBUG
@ -2167,11 +2111,9 @@ pmap_remove_mapping(pmap, va, pte, flags)
* mapping from the associated segment table.
*/
if (ste) {
#ifdef DEBUG
if (pmapdebug & (PDB_REMOVE|PDB_PTPAGE))
printf("remove: ste was %x@%p pte was %x@%p\n",
*ste, ste, opte, pmap_pte(pmap, va));
#endif
PMAP_DPRINTF(PDB_REMOVE|PDB_PTPAGE,
("remove: ste was %x@%p pte was %x@%p\n",
*ste, ste, opte, pmap_pte(pmap, va)));
#if defined(M68040)
if (mmutype == MMU_68040) {
st_entry_t *este = &ste[NPTEPG/SG4_LEV3SIZE];
@ -2190,20 +2132,18 @@ pmap_remove_mapping(pmap, va, pte, flags)
* freeing it if it is now empty.
*/
if (ptpmap != pmap_kernel()) {
PMAP_DPRINTF(PDB_REMOVE|PDB_SEGTAB,
("remove: stab %p, refcnt %d\n",
ptpmap->pm_stab, ptpmap->pm_sref - 1));
#ifdef DEBUG
if (pmapdebug & (PDB_REMOVE|PDB_SEGTAB))
printf("remove: stab %p, refcnt %d\n",
ptpmap->pm_stab, ptpmap->pm_sref - 1);
if ((pmapdebug & PDB_PARANOIA) &&
ptpmap->pm_stab != (st_entry_t *)trunc_page(ste))
panic("remove: bogus ste");
#endif
if (--(ptpmap->pm_sref) == 0) {
#ifdef DEBUG
if (pmapdebug&(PDB_REMOVE|PDB_SEGTAB))
printf("remove: free stab %p\n",
ptpmap->pm_stab);
#endif
PMAP_DPRINTF(PDB_REMOVE|PDB_SEGTAB,
("remove: free stab %p\n",
ptpmap->pm_stab));
#if defined(UVM)
uvm_km_free_wakeup(st_map,
(vaddr_t)ptpmap->pm_stab,
@ -2313,10 +2253,9 @@ pmap_changebit(pa, set, mask)
boolean_t firstpage = TRUE;
#endif
#ifdef DEBUG
if (pmapdebug & PDB_BITS)
printf("pmap_changebit(%lx, %x, %x)\n", pa, set, mask);
#endif
PMAP_DPRINTF(PDB_BITS,
("pmap_changebit(%lx, %x, %x)\n", pa, set, mask));
if (PAGE_IS_MANAGED(pa) == 0)
return;
@ -2415,10 +2354,9 @@ pmap_enter_ptpage(pmap, va)
st_entry_t *ste;
int s;
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_ENTER|PDB_PTPAGE))
printf("pmap_enter_ptpage: pmap %p, va %lx\n", pmap, va);
#endif
PMAP_DPRINTF(PDB_FOLLOW|PDB_ENTER|PDB_PTPAGE,
("pmap_enter_ptpage: pmap %p, va %lx\n", pmap, va));
/*
* Allocate a segment table if necessary. Note that it is allocated
* from a private map and not pt_map. This keeps user page tables
@ -2451,11 +2389,10 @@ pmap_enter_ptpage(pmap, va)
*/
if (active_user_pmap(pmap))
PMAP_ACTIVATE(pmap, 1);
#ifdef DEBUG
if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB))
printf("enter: pmap %p stab %p(%p)\n",
pmap, pmap->pm_stab, pmap->pm_stpa);
#endif
PMAP_DPRINTF(PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB,
("enter: pmap %p stab %p(%p)\n",
pmap, pmap->pm_stab, pmap->pm_stpa));
}
ste = pmap_ste(pmap, va);
@ -2476,10 +2413,9 @@ pmap_enter_ptpage(pmap, va)
bzero(addr, SG4_LEV2SIZE*sizeof(st_entry_t));
addr = (caddr_t)&pmap->pm_stpa[ix*SG4_LEV2SIZE];
*ste = (u_int)addr | SG_RW | SG_U | SG_V;
#ifdef DEBUG
if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB))
printf("enter: alloc ste2 %d(%p)\n", ix, addr);
#endif
PMAP_DPRINTF(PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB,
("enter: alloc ste2 %d(%p)\n", ix, addr));
}
ste = pmap_ste2(pmap, va);
/*
@ -2491,11 +2427,9 @@ pmap_enter_ptpage(pmap, va)
* entirety below.
*/
ste = (st_entry_t *)((int)ste & ~(NBPG/SG4_LEV3SIZE-1));
#ifdef DEBUG
if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB))
printf("enter: ste2 %p (%p)\n",
pmap_ste2(pmap, va), ste);
#endif
PMAP_DPRINTF(PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB,
("enter: ste2 %p (%p)\n", pmap_ste2(pmap, va), ste));
}
#endif
va = trunc_page((vaddr_t)pmap_pte(pmap, va));
@ -2514,10 +2448,8 @@ pmap_enter_ptpage(pmap, va)
* No PT pages available.
* Try once to free up unused ones.
*/
#ifdef DEBUG
if (pmapdebug & PDB_COLLECT)
printf("enter: no KPT pages, collecting...\n");
#endif
PMAP_DPRINTF(PDB_COLLECT,
("enter: no KPT pages, collecting...\n"));
pmap_collect(pmap_kernel());
if ((kpt = kpt_free_list) == (struct kpt_page *)0)
panic("pmap_enter_ptpage: can't get KPT page");
@ -2548,10 +2480,8 @@ pmap_enter_ptpage(pmap, va)
* lose the segment table when low on memory.
*/
pmap->pm_sref++;
#ifdef DEBUG
if (pmapdebug & (PDB_ENTER|PDB_PTPAGE))
printf("enter: about to fault UPT pg at %lx\n", va);
#endif
PMAP_DPRINTF(PDB_ENTER|PDB_PTPAGE,
("enter: about to fault UPT pg at %lx\n", va));
#if defined(UVM)
s = uvm_fault(pt_map, va, 0, VM_PROT_READ|VM_PROT_WRITE);
if (s != KERN_SUCCESS) {
@ -2618,10 +2548,9 @@ pmap_enter_ptpage(pmap, va)
#endif
pv->pv_ptste = ste;
pv->pv_ptpmap = pmap;
#ifdef DEBUG
if (pmapdebug & (PDB_ENTER|PDB_PTPAGE))
printf("enter: new PT page at PA %lx, ste at %p\n", ptpa, ste);
#endif
PMAP_DPRINTF(PDB_ENTER|PDB_PTPAGE,
("enter: new PT page at PA %lx, ste at %p\n", ptpa, ste));
/*
* Map the new PT page into the segment table.
@ -2643,11 +2572,9 @@ pmap_enter_ptpage(pmap, va)
#endif
*ste = (ptpa & SG_FRAME) | SG_RW | SG_V;
if (pmap != pmap_kernel()) {
#ifdef DEBUG
if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB))
printf("enter: stab %p refcnt %d\n",
pmap->pm_stab, pmap->pm_sref);
#endif
PMAP_DPRINTF(PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB,
("enter: stab %p refcnt %d\n",
pmap->pm_stab, pmap->pm_sref));
}
#if 0
/*