pmap_change_wiring() -> pmap_unwire().

This commit is contained in:
thorpej 1999-06-17 19:23:20 +00:00
parent f5a527bb4e
commit 0288ffb53a
23 changed files with 270 additions and 257 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.103 1999/06/17 18:21:24 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.104 1999/06/17 19:23:22 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -155,7 +155,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.103 1999/06/17 18:21:24 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.104 1999/06/17 19:23:22 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -2013,24 +2013,23 @@ pmap_kremove(va, size)
#endif /* PMAP_NEW */
/*
* pmap_change_wiring: [ INTERFACE ]
* pmap_unwire: [ INTERFACE ]
*
* Change the wiring attribute for a map/virtual-address pair.
* Clear the wired attribute for a map/virtual-address pair.
*
* The mapping must already exist in the pmap.
*/
void
pmap_change_wiring(pmap, va, wired)
pmap_unwire(pmap, va)
pmap_t pmap;
vaddr_t va;
boolean_t wired;
{
pt_entry_t *pte;
int ps;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_change_wiring(%p, %lx, %x)\n", pmap, va, wired);
printf("pmap_unwire(%p, %lx)\n", pmap, va);
#endif
if (pmap == NULL)
return;
@ -2038,38 +2037,26 @@ pmap_change_wiring(pmap, va, wired)
PMAP_LOCK(pmap, ps);
pte = pmap_l3pte(pmap, va, NULL);
#ifdef DEBUG
/*
* Page table page is not allocated.
* Should this ever happen? Ignore it for now,
* we don't want to force allocation of unnecessary PTE pages.
*/
if (pmap_pte_v(pmap_l2pte(pmap, va, NULL)) == 0) {
if (pmapdebug & PDB_PARANOIA)
printf("pmap_change_wiring: invalid STE for %lx\n", va);
return;
}
/*
* Page not valid. Should this ever happen?
* Just continue and change wiring anyway.
*/
if (!pmap_pte_v(pte)) {
if (pmapdebug & PDB_PARANOIA)
printf("pmap_change_wiring: invalid PTE for %lx\n", va);
}
#ifdef DIAGNOSTIC
if (pte == NULL || pmap_pte_v(pte) == 0)
panic("pmap_unwire");
#endif
/*
* If wiring actually changed (always?) set the wire bit and
* If wiring actually changed (always?) clear the wire bit and
* update the wire count. Note that wiring is not a hardware
* characteristic so there is no need to invalidate the TLB.
*/
if (pmap_pte_w_chg(pte, wired ? PG_WIRED : 0)) {
pmap_pte_set_w(pte, wired);
if (wired)
pmap->pm_stats.wired_count++;
else
pmap->pm_stats.wired_count--;
if (pmap_pte_w_chg(pte, 0)) {
pmap_pte_set_w(pte, FALSE);
pmap->pm_stats.wired_count--;
}
#ifdef DIAGNOSTIC
else {
printf("pmap_unwire: wiring for pmap %p va 0x%lx "
"didn't change!\n", pmap, va);
}
#endif
PMAP_UNLOCK(pmap, ps);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.66 1999/06/17 18:21:27 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.67 1999/06/17 19:23:22 thorpej Exp $ */
/*
* Copyright (c) 1991 Regents of the University of California.
@ -1593,23 +1593,22 @@ validate:
}
/*
* Routine: pmap_change_wiring
* Function: Change the wiring attribute for a map/virtual-address
* Routine: pmap_unwire
* Function: Clear the wired attribute for a map/virtual-address
* pair.
* In/out conditions:
* The mapping must already exist in the pmap.
*/
void
pmap_change_wiring(pmap, va, wired)
pmap_unwire(pmap, va)
register pmap_t pmap;
vm_offset_t va;
boolean_t wired;
{
register u_int *pte;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_change_wiring(%p, %lx, %x)\n", pmap, va, wired);
printf("pmap_unwire(%p, %lx)\n", pmap, va);
#endif
if (pmap == NULL)
return;
@ -1623,7 +1622,7 @@ pmap_change_wiring(pmap, va, wired)
*/
if (!pmap_ste_v(pmap, va)) {
if (pmapdebug & PDB_PARANOIA)
printf("pmap_change_wiring: invalid STE for %lx\n", va);
printf("pmap_unwire: invalid STE for %lx\n", va);
return;
}
/*
@ -1632,20 +1631,23 @@ pmap_change_wiring(pmap, va, wired)
*/
if (!pmap_pte_v(pte)) {
if (pmapdebug & PDB_PARANOIA)
printf("pmap_change_wiring: invalid PTE for %lx\n", va);
printf("pmap_unwire: invalid PTE for %lx\n", va);
}
#endif
if ((wired && !pmap_pte_w(pte)) || (!wired && pmap_pte_w(pte))) {
if (wired)
pmap->pm_stats.wired_count++;
else
pmap->pm_stats.wired_count--;
}
/*
* Wiring is not a hardware characteristic so there is no need
* to invalidate TLB.
*/
pmap_pte_set_w(pte, wired);
if (pmap_pte_w(pte)) {
pmap->pm_stats.wired_count--;
pmap_pte_set_w(pte, FALSE);
}
#ifdef DIAGNOSTIC
else {
printf("pmap_unwire: wiring for pmap %p va 0x%lx "
"didn't change!\n", pmap, va);
}
#endif
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.61 1999/06/17 18:21:28 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.62 1999/06/17 19:23:22 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -2225,18 +2225,17 @@ pmap_page_protect(phys, prot)
/*
* Routine: pmap_change_wiring
* Function: Change the wiring attribute for a map/virtual-address
* Routine: pmap_unwire
* Function: Clear the wired attribute for a map/virtual-address
* pair.
* In/out conditions:
* The mapping must already exist in the pmap.
*/
void
pmap_change_wiring(pmap, va, wired)
pmap_unwire(pmap, va)
pmap_t pmap;
vm_offset_t va;
boolean_t wired;
{
pt_entry_t *pte;
vm_offset_t pa;
@ -2261,7 +2260,7 @@ pmap_change_wiring(pmap, va, wired)
return;
pv = &vm_physmem[bank].pmseg.pvent[off];
/* Update the wired bit in the pv entry for this page. */
(void) pmap_modify_pv(pmap, va, pv, PT_W, wired ? PT_W : 0);
(void) pmap_modify_pv(pmap, va, pv, PT_W, 0);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.47 1999/06/17 18:21:28 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.48 1999/06/17 19:23:23 thorpej Exp $ */
/*
* Copyright (c) 1991 Regents of the University of California.
@ -1315,23 +1315,22 @@ validate:
}
/*
* Routine: pmap_change_wiring
* Function: Change the wiring attribute for a map/virtual-address
* Routine: pmap_unwire
* Function: Clear the wired attribute for a map/virtual-address
* pair.
* In/out conditions:
* The mapping must already exist in the pmap.
*/
void
pmap_change_wiring(pmap, va, wired)
pmap_unwire(pmap, va)
register pmap_t pmap;
vaddr_t va;
boolean_t wired;
{
register u_int *pte;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_change_wiring(%p, %lx, %x)\n", pmap, va, wired);
printf("pmap_unwire(%p, %lx)\n", pmap, va);
#endif
if (pmap == NULL)
return;
@ -1345,7 +1344,7 @@ pmap_change_wiring(pmap, va, wired)
*/
if (!pmap_ste_v(pmap, va)) {
if (pmapdebug & PDB_PARANOIA)
printf("pmap_change_wiring: invalid STE for %lx\n", va);
printf("pmap_unwire: invalid STE for %lx\n", va);
return;
}
/*
@ -1354,20 +1353,23 @@ pmap_change_wiring(pmap, va, wired)
*/
if (!pmap_pte_v(pte)) {
if (pmapdebug & PDB_PARANOIA)
printf("pmap_change_wiring: invalid PTE for %lx\n", va);
printf("pmap_unwire: invalid PTE for %lx\n", va);
}
#endif
if ((wired && !pmap_pte_w(pte)) || (!wired && pmap_pte_w(pte))) {
if (wired)
pmap->pm_stats.wired_count++;
else
pmap->pm_stats.wired_count--;
}
/*
* Wiring is not a hardware characteristic so there is no need
* to invalidate TLB.
*/
pmap_pte_set_w(pte, wired);
if (pmap_ptw_w(pte)) {
pmap->pm_stats.wired_count--;
pmap_pte_set_w(pte, FALSE);
}
#ifdef DIAGNOSTIC
else {
printf("pmap_unwire: wiring for pmap %p va 0x%lx "
"didn't change!\n", pmap, va);
}
#endif
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.6 1998/08/24 01:40:28 sakamoto Exp $ */
/* $NetBSD: pmap.h,v 1.7 1999/06/17 19:23:20 thorpej Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -66,7 +66,7 @@ extern struct pmap kernel_pmap_;
#define pmap_clear_reference(pa) (ptemodify((pa), PTE_REF, 0))
#define pmap_is_modified(pa) (ptebits((pa), PTE_CHG))
#define pmap_is_referenced(pa) (ptebits((pa), PTE_REF))
#define pmap_change_wiring(pm, va, wired)
#define pmap_unwire(pm, va)
#define pmap_phys_address(x) (x)

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.76 1999/06/17 18:21:29 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.77 1999/06/17 19:23:23 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -1435,22 +1435,21 @@ validate:
}
/*
* pmap_change_wiring: [ INTERFACE ]
* pmap_unwire: [ INTERFACE ]
*
* Change the wiring attribute for a map/virtual-address pair.
* Clear the wired attribute for a map/virtual-address pair.
*
* The mapping must already exist in the pmap.
*/
void
pmap_change_wiring(pmap, va, wired)
pmap_unwire(pmap, va)
pmap_t pmap;
vaddr_t va;
boolean_t wired;
{
pt_entry_t *pte;
PMAP_DPRINTF(PDB_FOLLOW,
("pmap_change_wiring(%p, %lx, %x)\n", pmap, va, wired));
("pmap_unwire(%p, %lx)\n", pmap, va));
if (pmap == NULL)
return;
@ -1464,7 +1463,7 @@ pmap_change_wiring(pmap, va, wired)
*/
if (!pmap_ste_v(pmap, va)) {
if (pmapdebug & PDB_PARANOIA)
printf("pmap_change_wiring: invalid STE for %lx\n", va);
printf("pmap_unwire: invalid STE for %lx\n", va);
return;
}
/*
@ -1473,21 +1472,24 @@ pmap_change_wiring(pmap, va, wired)
*/
if (!pmap_pte_v(pte)) {
if (pmapdebug & PDB_PARANOIA)
printf("pmap_change_wiring: invalid PTE for %lx\n", va);
printf("pmap_unwire: invalid PTE for %lx\n", va);
}
#endif
/*
* If wiring actually changed (always?) set the wire bit and
* If wiring actually changed (always?) clear the wire bit and
* update the wire count. Note that wiring is not a hardware
* characteristic so there is no need to invalidate the TLB.
*/
if (pmap_pte_w_chg(pte, wired ? PG_W : 0)) {
pmap_pte_set_w(pte, wired);
if (wired)
pmap->pm_stats.wired_count++;
else
pmap->pm_stats.wired_count--;
if (pmap_pte_w_chg(pte, 0)) {
pmap_pte_set_w(pte, FALSE);
pmap->pm_stats.wired_count--;
}
#ifdef DIAGNOSTIC
else {
printf("pmap_unwire: wiring for pmap %p va 0x%lx "
"didn't change!\n", pmap, va);
}
#endif
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.71 1999/06/17 18:21:30 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.72 1999/06/17 19:23:24 thorpej Exp $ */
/*
*
@ -2934,17 +2934,15 @@ vm_prot_t prot;
*/
/*
* pmap_change_wiring: changing the wiring bit in the PTE
* pmap_unwire: clear the wired bit in the PTE
*
* => mapping should already be in map
* => XXX: so, this is really pmap_remove_wiring (pmap_enter sets wiring)
*/
void pmap_change_wiring(pmap, va, wired)
void pmap_unwire(pmap, va)
struct pmap *pmap;
vaddr_t va;
boolean_t wired;
{
@ -2955,18 +2953,26 @@ boolean_t wired;
ptes = pmap_map_ptes(pmap); /* locks pmap */
if (!pmap_valid_entry(ptes[i386_btop(va)]))
panic("pmap_change_wiring: invalid (unmapped) va");
if (!wired && (ptes[i386_btop(va)] & PG_W) != 0) {
panic("pmap_unwire: invalid (unmapped) va");
if ((ptes[i386_btop(va)] & PG_W) != 0) {
ptes[i386_btop(va)] &= ~PG_W;
pmap->pm_stats.wired_count--;
} else if (wired && (ptes[i386_btop(va)] & PG_W) == 0) {
ptes[i386_btop(va)] |= PG_W;
pmap->pm_stats.wired_count++;
}
#ifdef DIAGNOSITC
else {
printf("pmap_unwire: wiring for pmap %p va 0x%lx didn't change!\n",
pmap, va);
}
#endif
pmap_unmap_ptes(pmap); /* unlocks map */
}
#ifdef DIAGNOSTIC
else {
panic("pmap_unwire: invalid PDE");
}
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.59 1999/06/17 18:21:31 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.60 1999/06/17 19:23:25 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -1307,22 +1307,21 @@ validate:
}
/*
* pmap_change_wiring: [ INTERFACE ]
* pmap_unwire: [ INTERFACE ]
*
* Change the wiring attribute for a map/virtual-address pair.
* Clear the wired attribute for a map/virtual-address pair.
*
* The mapping must already exist in the pmap.
*/
void
pmap_change_wiring(pmap, va, wired)
pmap_unwire(pmap, va)
pmap_t pmap;
vaddr_t va;
boolean_t wired;
{
pt_entry_t *pte;
PMAP_DPRINTF(PDB_FOLLOW,
("pmap_change_wiring(%p, %lx, %x)\n", pmap, va, wired));
("pmap_unwire(%p, %lx)\n", pmap, va));
if (pmap == NULL)
return;
@ -1336,7 +1335,7 @@ pmap_change_wiring(pmap, va, wired)
*/
if (!pmap_ste_v(pmap, va)) {
if (pmapdebug & PDB_PARANOIA)
printf("pmap_change_wiring: invalid STE for %lx\n", va);
printf("pmap_unwire: invalid STE for %lx\n", va);
return;
}
/*
@ -1345,21 +1344,24 @@ pmap_change_wiring(pmap, va, wired)
*/
if (!pmap_pte_v(pte)) {
if (pmapdebug & PDB_PARANOIA)
printf("pmap_change_wiring: invalid PTE for %lx\n", va);
printf("pmap_unwire: invalid PTE for %lx\n", va);
}
#endif
/*
* If wiring actually changed (always?) set the wire bit and
* If wiring actually changed (always?) clear the wire bit and
* update the wire count. Note that wiring is not a hardware
* characteristic so there is no need to invalidate the TLB.
*/
if (pmap_pte_w_chg(pte, wired ? PG_W : 0)) {
pmap_pte_set_w(pte, wired);
if (wired)
pmap->pm_stats.wired_count++;
else
pmap->pm_stats.wired_count--;
if (pmap_pte_w_chg(pte, 0)) {
pmap_pte_set_w(pte, FALSE);
pmap->pm_stats.wired_count--;
}
#ifdef DIAGNOSTIC
else {
printf("pmap_unwire: wiring for pmap %p va 0x%lx "
"didn't change!\n", pmap, va);
}
#endif
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.67 1999/06/17 18:21:31 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.68 1999/06/17 19:23:25 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -78,7 +78,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.67 1999/06/17 18:21:31 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.68 1999/06/17 19:23:25 thorpej Exp $");
/*
* Manages physical address maps.
@ -1332,30 +1332,26 @@ pmap_enter(pmap, va, pa, prot, wired, access_type)
}
/*
* Routine: pmap_change_wiring
* Function: Change the wiring attribute for a map/virtual-address
* Routine: pmap_unwire
* Function: Clear the wired attribute for a map/virtual-address
* pair.
* In/out conditions:
* The mapping must already exist in the pmap.
*/
void
pmap_change_wiring(pmap, va, wired)
pmap_unwire(pmap, va)
pmap_t pmap;
vaddr_t va;
boolean_t wired;
{
pt_entry_t *pte;
u_int p;
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_WIRING))
printf("pmap_change_wiring(%p, %lx, %x)\n", pmap, va, wired);
printf("pmap_unwire(%p, %lx)\n", pmap, va);
#endif
if (pmap == NULL)
return;
p = wired ? mips_pg_wired_bit() : 0;
/*
* Don't need to flush the TLB since PG_WIRED is only in software.
*/
@ -1363,22 +1359,35 @@ pmap_change_wiring(pmap, va, wired)
/* change entries in kernel pmap */
#ifdef PARANOIADIAG
if (va < VM_MIN_KERNEL_ADDRESS || va >= virtual_end)
panic("pmap_change_wiring");
panic("pmap_unwire");
#endif
pte = kvtopte(va);
} else {
if (!(pte = pmap_segmap(pmap, va)))
return;
pte = pmap_segmap(pmap, va);
#ifdef DIAGNOSTIC
if (pte == NULL)
panic("pmap_unwire: pmap %p va 0x%lx invalid STE",
pmap, va);
#endif
pte += (va >> PGSHIFT) & (NPTEPG - 1);
}
if (!mips_pg_wired(pte->pt_entry) && p)
pmap->pm_stats.wired_count++;
else if (mips_pg_wired(pte->pt_entry) && !p)
pmap->pm_stats.wired_count--;
#ifdef DIAGNOSTIC
if (mips_pg_v(pte->pt_entry) == 0)
panic("pmap_unwire: pmap %p va 0x%lx invalid PTE",
pmap, va);
#endif
if (mips_pg_v(pte->pt_entry))
pte->pt_entry = (pte->pt_entry & ~mips_pg_wired_bit()) | p;
if (mips_pg_wired(pte->pt_entry)) {
pte->pt_entry &= ~mips_pg_wired_bit();
pmap->pm_stats.wired_count--;
}
#ifdef DIAGNOSTIC
else {
printf("pmap_unwire: wiring for pmap %p va 0x%lx "
"didn't change!\n", pmap, va);
}
#endif
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.35 1999/06/17 18:21:32 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.36 1999/06/17 19:23:25 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -1289,22 +1289,21 @@ validate:
}
/*
* pmap_change_wiring: [ INTERFACE ]
* pmap_unwire: [ INTERFACE ]
*
* Change the wiring attribute for a map/virtual-address pair.
* Clear the wired attribute for a map/virtual-address pair.
*
* The mapping must already exist in the pmap.
*/
void
pmap_change_wiring(pmap, va, wired)
pmap_unwire(pmap, va)
pmap_t pmap;
vaddr_t va;
boolean_t wired;
{
pt_entry_t *pte;
PMAP_DPRINTF(PDB_FOLLOW,
("pmap_change_wiring(%p, %lx, %x)\n", pmap, va, wired));
("pmap_unwire(%p, %lx)\n", pmap, va));
if (pmap == NULL)
return;
@ -1318,7 +1317,7 @@ pmap_change_wiring(pmap, va, wired)
*/
if (!pmap_ste_v(pmap, va)) {
if (pmapdebug & PDB_PARANOIA)
printf("pmap_change_wiring: invalid STE for %lx\n", va);
printf("pmap_unwire: invalid STE for %lx\n", va);
return;
}
/*
@ -1327,21 +1326,24 @@ pmap_change_wiring(pmap, va, wired)
*/
if (!pmap_pte_v(pte)) {
if (pmapdebug & PDB_PARANOIA)
printf("pmap_change_wiring: invalid PTE for %lx\n", va);
printf("pmap_unwire: invalid PTE for %lx\n", va);
}
#endif
/*
* If wiring actually changed (always?) set the wire bit and
* If wiring actually changed (always?) clear the wire bit and
* update the wire count. Note that wiring is not a hardware
* characteristic so there is no need to invalidate the TLB.
*/
if (pmap_pte_w_chg(pte, wired ? PG_W : 0)) {
pmap_pte_set_w(pte, wired);
if (wired)
pmap->pm_stats.wired_count++;
else
pmap->pm_stats.wired_count--;
if (pmap_pte_w_chg(pte, 0)) {
pmap_pte_set_w(pte, FALSE);
pmap->pm_stats.wired_count--;
}
#ifdef DIAGNOSTIC
else {
printf("pmap_unwire: wiring for pmap %p va 0x%lx "
"didn't change!\n", pmap, va);
}
#endif
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.16 1999/06/17 18:21:33 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.17 1999/06/17 19:23:26 thorpej Exp $ */
/*
* This file was taken from mvme68k/mvme68k/pmap.c
@ -1535,23 +1535,22 @@ validate:
}
/*
* Routine: pmap_change_wiring
* Function: Change the wiring attribute for a map/virtual-address
* Routine: pmap_unwire
* Function: Clear the wired attribute for a map/virtual-address
* pair.
* In/out conditions:
* The mapping must already exist in the pmap.
*/
void
pmap_change_wiring(pmap, va, wired)
pmap_unwire(pmap, va)
pmap_t pmap;
vaddr_t va;
boolean_t wired;
{
pt_entry_t *pte;
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
printf("pmap_change_wiring(%p, %lx, %x)\n", pmap, va, wired);
printf("pmap_unwire(%p, %lx)\n", pmap, va);
#endif
if (pmap == NULL)
return;
@ -1565,7 +1564,7 @@ pmap_change_wiring(pmap, va, wired)
*/
if (!pmap_ste_v(pmap, va)) {
if (pmapdebug & PDB_PARANOIA)
printf("pmap_change_wiring: invalid STE for %lx\n", va);
printf("pmap_unwire: invalid STE for %lx\n", va);
return;
}
/*
@ -1574,21 +1573,24 @@ pmap_change_wiring(pmap, va, wired)
*/
if (!pmap_pte_v(pte)) {
if (pmapdebug & PDB_PARANOIA)
printf("pmap_change_wiring: invalid PTE for %lx\n", va);
printf("pmap_unwire: invalid PTE for %lx\n", va);
}
#endif
/*
* If wiring actually changed (always?) set the wire bit and
* If wiring actually changed (always?) clear the wire bit and
* update the wire count. Note that wiring is not a hardware
* characteristic so there is no need to invalidate the TLB.
*/
if (pmap_pte_w_chg(pte, wired ? PG_W : 0)) {
pmap_pte_set_w(pte, wired);
if (wired)
pmap->pm_stats.wired_count++;
else
pmap->pm_stats.wired_count--;
if (pmap_pte_w_chg(pte, 0)) {
pmap_pte_set_w(pte, FALSE);
pmap->pm_stats.wired_count--;
}
#ifdef DIAGNOSTIC
else {
printf("pmap_unwire: wiring for pmap %p va 0x%lx "
"didn't change!\n", pmap, va);
}
#endif
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.36 1999/06/17 18:21:33 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.37 1999/06/17 19:23:26 thorpej Exp $ */
/*
*
@ -2659,17 +2659,15 @@ vm_prot_t prot;
*/
/*
* pmap_change_wiring: changing the wiring bit in the PTE
* pmap_unwire: clear the wired bit in the PTE
*
* => mapping should already be in map
* => XXX: so, this is really pmap_remove_wiring (pmap_enter sets wiring)
*/
void pmap_change_wiring(pmap, va, wired)
void pmap_unwire(pmap, va)
struct pmap *pmap;
vaddr_t va;
boolean_t wired;
{
@ -2680,18 +2678,26 @@ boolean_t wired;
ptes = pmap_map_ptes(pmap); /* locks pmap */
if (!pmap_valid_entry(ptes[ns532_btop(va)]))
panic("pmap_change_wiring: invalid (unmapped) va");
if (!wired && (ptes[ns532_btop(va)] & PG_W) != 0) {
panic("pmap_unwire: invalid (unmapped) va");
if ((ptes[ns532_btop(va)] & PG_W) != 0) {
ptes[ns532_btop(va)] &= ~PG_W;
pmap->pm_stats.wired_count--;
} else if (wired && (ptes[ns532_btop(va)] & PG_W) == 0) {
ptes[ns532_btop(va)] |= PG_W;
pmap->pm_stats.wired_count++;
}
#ifdef DIAGNOSTIC
else {
printf("pmap_unwire: wiring for pmap %p va 0x%lx didn't change!\n",
pmap, va);
}
#endif
pmap_unmap_ptes(pmap); /* unlocks map */
}
#ifdef DIAGNOSTIC
else {
panic("pmap_unwire: invalid PDE");
}
#endif
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.9 1999/06/17 18:21:34 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.10 1999/06/17 19:23:26 thorpej Exp $ */
/*
* Copyright (c) 1992, 1993
@ -1101,31 +1101,27 @@ pmap_enter(pmap, va, pa, prot, wired, access_type)
}
/*
* Routine: pmap_change_wiring
* Function: Change the wiring attribute for a map/virtual-address
* Routine: pmap_unwire
* Function: Clear the wired attribute for a map/virtual-address
* pair.
* In/out conditions:
* The mapping must already exist in the pmap.
*/
void
pmap_change_wiring(pmap, va, wired)
pmap_unwire(pmap, va)
register pmap_t pmap;
vm_offset_t va;
boolean_t wired;
{
register pt_entry_t *pte;
u_int p;
register int i;
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_WIRING))
printf("pmap_change_wiring(%x, %x, %x)\n", pmap, va, wired);
printf("pmap_unwire(%x, %x)\n", pmap, va);
#endif
if (pmap == NULL)
return;
p = wired ? PG_WIRED : 0;
/*
* Don't need to flush the TLB since PG_WIRED is only in software.
*/
@ -1133,25 +1129,38 @@ pmap_change_wiring(pmap, va, wired)
/* change entries in kernel pmap */
#ifdef DIAGNOSTIC
if (va < VM_MIN_KERNEL_ADDRESS || va >= virtual_end)
panic("pmap_change_wiring");
panic("pmap_unwire");
#endif
pte = kvtopte(va);
} else {
if (!(pte = pmap_segmap(pmap, va)))
return;
pte = pmap_segmap(pmap, va);
#ifdef DIAGNOSTIC
if (pte == NULL)
panic("pmap_unwire: pmap %p va 0x%lx invalid STE",
pmap, va);
#endif
pte += (va >> PGSHIFT) & (NPTEPG - 1);
}
#ifdef DIAGNOSTIC
if ((pte->pt_entry & PG_V) == 0)
panic("pmap_unwire: pmap %p va 0x%lx invalid PTE",
pmap, va);
#endif
i = picapagesperpage;
if (!(pte->pt_entry & PG_WIRED) && p)
pmap->pm_stats.wired_count += i;
else if ((pte->pt_entry & PG_WIRED) && !p)
if (pte->pt_entry & PG_WIRED) {
pmap->pm_stats.wired_count -= i;
do {
if (pte->pt_entry & PG_V)
pte->pt_entry = (pte->pt_entry & ~PG_WIRED) | p;
pte++;
} while (--i != 0);
do {
pte->pt_entry &= ~PG_WIRED;
} while (--i != 0);
}
#ifdef DIAGNOSTIC
else {
printf("pmap_unwire: wiring for pmap %p va 0x%lx "
"didn't change!\n", pmap, va);
}
#endif
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.12 1999/04/16 21:45:19 thorpej Exp $ */
/* $NetBSD: pmap.h,v 1.13 1999/06/17 19:23:21 thorpej Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -67,7 +67,7 @@ extern struct pmap kernel_pmap_;
#define pmap_clear_reference(pa) (ptemodify((pa), PTE_REF, 0))
#define pmap_is_modified(pa) (ptebits((pa), PTE_CHG))
#define pmap_is_referenced(pa) (ptebits((pa), PTE_REF))
#define pmap_change_wiring(pm, va, wired)
#define pmap_unwire(pm, va)
#define pmap_phys_address(x) (x)

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.37 1999/06/17 18:21:22 thorpej Exp $ */
/* $NetBSD: pmap.h,v 1.38 1999/06/17 19:23:21 thorpej Exp $ */
/*
* Copyright (c) 1996
@ -245,7 +245,7 @@ int pmap_count_ptes __P((struct pmap *));
void pmap_prefer __P((vaddr_t, vaddr_t *));
int pmap_pa_exists __P((paddr_t));
void *pmap_bootstrap_alloc __P((int));
void pmap_change_wiring __P((pmap_t, vaddr_t, boolean_t));
void pmap_unwire __P((pmap_t, vaddr_t));
void pmap_collect __P((pmap_t));
void pmap_copy __P((pmap_t, pmap_t, vaddr_t, vsize_t, vaddr_t));
pmap_t pmap_create __P((vsize_t));

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.146 1999/06/17 18:21:34 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.147 1999/06/17 19:23:27 thorpej Exp $ */
/*
* Copyright (c) 1996
@ -5956,14 +5956,13 @@ printf("%s[%d]: pmap_enu: changing existing va 0x%x: pte 0x%x=>0x%x\n",
#endif /* SUN4M */
/*
* Change the wiring attribute for a map/virtual-address pair.
* Clear the wiring attribute for a map/virtual-address pair.
*/
/* ARGSUSED */
void
pmap_change_wiring(pm, va, wired)
pmap_unwire(pm, va)
struct pmap *pm;
vaddr_t va;
int wired;
{
pmap_stats.ps_useless_changewire++;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.39 1999/06/17 18:21:35 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.40 1999/06/17 19:23:27 thorpej Exp $ */
/* #define NO_VCACHE */ /* Don't forget the locked TLB in dostart */
#define HWREF 1
/* #define BOOT_DEBUG */
@ -2749,24 +2749,23 @@ pmap_is_referenced(pa)
/*
* Routine: pmap_change_wiring
* Function: Change the wiring attribute for a map/virtual-address
* Routine: pmap_unwire
* Function: Clear the wired attribute for a map/virtual-address
* pair.
* In/out conditions:
* The mapping must already exist in the pmap.
*/
void
pmap_change_wiring(pmap, va, wired)
pmap_unwire(pmap, va)
register pmap_t pmap;
vaddr_t va;
boolean_t wired;
{
int64_t data;
int s;
#ifdef DEBUG
if (pmapdebug & (PDB_MMU_STEAL)) /* XXXX Need another flag for this */
printf("pmap_change_wiring(%p, %lx, %x)\n", pmap, va, wired);
printf("pmap_unwire(%p, %lx)\n", pmap, va);
#endif
if (pmap == NULL) {
pv_check();
@ -2777,20 +2776,17 @@ pmap_change_wiring(pmap, va, wired)
* Is this part of the permanent 4MB mapping?
*/
if( pmap == pmap_kernel() && va >= ksegv && va < ksegv+4*MEG ) {
prom_printf("pmap_change_wiring: va=%08x in locked TLB\r\n", va);
prom_printf("pmap_unwire: va=%08x in locked TLB\r\n", va);
OF_enter();
return;
}
s = splimp();
data = pseg_get(pmap, va&PV_VAMASK);
if (wired)
data |= TLB_TSB_LOCK;
else
data &= ~TLB_TSB_LOCK;
data &= ~TLB_TSB_LOCK;
if (pseg_set(pmap, va&PV_VAMASK, data, 0)) {
printf("pmap_change_wiring: gotten pseg empty!\n");
printf("pmap_unwire: gotten pseg empty!\n");
Debugger();
/* panic? */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.112 1999/06/17 18:21:36 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.113 1999/06/17 19:23:28 thorpej Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -2329,7 +2329,7 @@ pmap_enter_user(pmap, pgva, new_pte, wired)
#ifdef PMAP_DEBUG
/*
* Some user pages are wired here, and a later
* call to pmap_change_wiring() will unwire them.
* call to pmap_unwire() will unwire them.
* XXX - Need a separate list for wired user pmegs
* so they can not be stolen from the active list.
* XXX - Note: vm_fault.c assumes pmap_extract will
@ -2788,17 +2788,16 @@ pmap_deactivate(p)
}
/*
* Routine: pmap_change_wiring
* Function: Change the wiring attribute for a map/virtual-address
* Routine: pmap_unwire
* Function: Clear the wired attribute for a map/virtual-address
* pair.
* In/out conditions:
* The mapping must already exist in the pmap.
*/
void
pmap_change_wiring(pmap, va, wired)
pmap_unwire(pmap, va)
pmap_t pmap;
vm_offset_t va;
boolean_t wired;
{
int s, sme;
int wiremask, ptenum;
@ -2808,8 +2807,8 @@ pmap_change_wiring(pmap, va, wired)
return;
#ifdef PMAP_DEBUG
if (pmap_debug & PMD_WIRING)
printf("pmap_change_wiring(pmap=%p, va=0x%lx, wire=%d)\n",
pmap, va, wired);
printf("pmap_unwire(pmap=%p, va=0x%lx)\n",
pmap, va);
#endif
/*
* We are asked to unwire pages that were wired when
@ -2833,12 +2832,9 @@ pmap_change_wiring(pmap, va, wired)
sme = get_segmap(va);
if (sme == SEGINV)
panic("pmap_change_wiring: invalid va=0x%lx", va);
panic("pmap_unwire: invalid va=0x%lx", va);
pmegp = pmeg_p(sme);
if (wired)
pmegp->pmeg_wired |= wiremask;
else
pmegp->pmeg_wired &= ~wiremask;
pmegp->pmeg_wired &= ~wiremask;
splx(s);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.46 1999/06/17 18:21:37 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.47 1999/06/17 19:23:28 thorpej Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -1922,7 +1922,7 @@ pmap_enter(pmap, va, pa, prot, wired, access_type)
* and, possibly, associated parent tables if this is a
* change wiring operation. Currently it does not.
*
* This may be ok if pmap_change_wiring() is the only
* This may be ok if pmap_unwire() is the only
* interface used to UNWIRE a page.
*/
@ -2341,20 +2341,17 @@ pmap_protect_kernel(startva, endva, prot)
}
}
/* pmap_change_wiring INTERFACE
/* pmap_unwire INTERFACE
**
* Changes the wiring of the specified page.
* Clear the wired attribute of the specified page.
*
* This function is called from vm_fault.c to unwire
* a mapping. It really should be called 'pmap_unwire'
* because it is never asked to do anything but remove
* wirings.
* a mapping.
*/
void
pmap_change_wiring(pmap, va, wire)
pmap_unwire(pmap, va)
pmap_t pmap;
vm_offset_t va;
boolean_t wire;
{
int a_idx, b_idx, c_idx;
a_tmgr_t *a_tbl;
@ -2366,11 +2363,6 @@ pmap_change_wiring(pmap, va, wire)
if (pmap == pmap_kernel())
return;
#ifdef PMAP_DEBUG
if (wire == TRUE)
panic("pmap_change_wiring: wire requested.");
#endif
/*
* Walk through the tables. If the walk terminates without
* a valid PTE then the address wasn't wired in the first place.

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.34 1999/06/17 18:21:22 thorpej Exp $ */
/* $NetBSD: pmap.h,v 1.35 1999/06/17 19:23:21 thorpej Exp $ */
/*
* Copyright (c) 1987 Carnegie-Mellon University
@ -110,7 +110,7 @@ extern struct pmap kernel_pmap_store;
/* Routines that are best to define as macros */
#define pmap_phys_address(phys) ((u_int)(phys) << PGSHIFT)
#define pmap_change_wiring(pmap, v, w) /* no need */
#define pmap_unwire(pmap, v) /* no need */
#define pmap_copy(a,b,c,d,e) /* Dont do anything */
#define pmap_update() mtpr(0,PR_TBIA) /* Update buffes */
#define pmap_collect(pmap) /* No need so far */

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.39 1999/06/17 18:21:38 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.40 1999/06/17 19:23:29 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -1644,22 +1644,21 @@ pmap_kremove(sva, size)
#endif /* PMAP_NEW */
/*
* pmap_change_wiring: [ INTERFACE ]
* pmap_unwire: [ INTERFACE ]
*
* Change the wiring attribute for a map/virtual-address pair.
* Clear the wired attribute for a map/virtual-address pair.
*
* The mapping must already exist in the pmap.
*/
void
pmap_change_wiring(pmap, va, wired)
pmap_unwire(pmap, va)
pmap_t pmap;
vaddr_t va;
boolean_t wired;
{
pt_entry_t *pte;
PMAP_DPRINTF(PDB_FOLLOW,
("pmap_change_wiring(%p, %lx, %x)\n", pmap, va, wired));
("pmap_unwire(%p, %lx)\n", pmap, va));
if (pmap == NULL)
return;
@ -1673,7 +1672,7 @@ pmap_change_wiring(pmap, va, wired)
*/
if (!pmap_ste_v(pmap, va)) {
if (pmapdebug & PDB_PARANOIA)
printf("pmap_change_wiring: invalid STE for %lx\n", va);
printf("pmap_unwire: invalid STE for %lx\n", va);
return;
}
/*
@ -1682,7 +1681,7 @@ pmap_change_wiring(pmap, va, wired)
*/
if (!pmap_pte_v(pte)) {
if (pmapdebug & PDB_PARANOIA)
printf("pmap_change_wiring: invalid PTE for %lx\n", va);
printf("pmap_unwire: invalid PTE for %lx\n", va);
}
#endif
/*
@ -1690,13 +1689,16 @@ pmap_change_wiring(pmap, va, wired)
* update the wire count. Note that wiring is not a hardware
* characteristic so there is no need to invalidate the TLB.
*/
if (pmap_pte_w_chg(pte, wired ? PG_W : 0)) {
pmap_pte_set_w(pte, wired);
if (wired)
pmap->pm_stats.wired_count++;
else
pmap->pm_stats.wired_count--;
if (pmap_pte_w_chg(pte, 0)) {
pmap_pte_set_w(pte, FALSE);
pmap->pm_stats.wired_count--;
}
#ifdef DIAGNOSTIC
else {
printf("pmap_unwire: wiring for pmap %p va 0x%lx "
"didn't change!\n", pmap, va);
}
#endif
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: uvm_fault.c,v 1.38 1999/06/17 18:21:23 thorpej Exp $ */
/* $NetBSD: uvm_fault.c,v 1.39 1999/06/17 19:23:21 thorpej Exp $ */
/*
*
@ -1830,7 +1830,7 @@ uvm_fault_unwire_locked(map, start, end)
* if the entry is no longer wired, tell the pmap.
*/
if (VM_MAPENT_ISWIRED(entry) == 0)
pmap_change_wiring(pmap, va, FALSE);
pmap_unwire(pmap, va);
pg = PHYS_TO_VM_PAGE(pa);
if (pg)

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.32 1999/06/17 18:21:21 thorpej Exp $ */
/* $NetBSD: pmap.h,v 1.33 1999/06/17 19:23:20 thorpej Exp $ */
/*
* Copyright (c) 1991, 1993
@ -118,7 +118,7 @@ __BEGIN_DECLS
void *pmap_bootstrap_alloc __P((int));
void pmap_activate __P((struct proc *));
void pmap_deactivate __P((struct proc *));
void pmap_change_wiring __P((pmap_t, vaddr_t, boolean_t));
void pmap_unwire __P((pmap_t, vaddr_t));
#if defined(PMAP_NEW)
#if !defined(pmap_clear_modify)