Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/sys/arch/sh3/sh3 Pull up revision 1.36 (via patch, requ...
details: https://anonhg.NetBSD.org/src/rev/8b786b4f2856
branches: netbsd-1-5
changeset: 493015:8b786b4f2856
user: he <he%NetBSD.org@localhost>
date: Thu Mar 28 22:45:59 2002 +0000
description:
Pull up revision 1.36 (via patch, requested by chs):
Avoid accounting errors in pmap_enter() by only updating the counters
once the operation can no longer fail. Fixes PR#16028.
diffstat:
sys/arch/sh3/sh3/pmap.c | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
diffs (80 lines):
diff -r fd931d5ac00c -r 8b786b4f2856 sys/arch/sh3/sh3/pmap.c
--- a/sys/arch/sh3/sh3/pmap.c Thu Mar 28 22:45:39 2002 +0000
+++ b/sys/arch/sh3/sh3/pmap.c Thu Mar 28 22:45:59 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.8 2000/06/02 17:46:43 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.8.2.1 2002/03/28 22:45:59 he Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -3119,6 +3119,7 @@
struct pv_head *pvh;
struct pv_entry *pve;
int bank, off, error;
+ int ptpdelta, wireddelta, resdelta;
boolean_t wired = (flags & PMAP_WIRED) != 0;
#ifdef DIAGNOSTIC
@@ -3163,15 +3164,19 @@
if (pmap_valid_entry(opte)) {
/*
- * first, update pm_stats. resident count will not
- * change since we are replacing/changing a valid
- * mapping. wired count might change...
+ * first, calculate pm_stats updates. resident count will not
+ * change since we are replacing/changing a valid mapping.
+ * wired count might change...
*/
+ resdelta = 0;
if (wired && (opte & PG_W) == 0)
- pmap->pm_stats.wired_count++;
+ wireddelta = 1;
else if (!wired && (opte & PG_W) != 0)
- pmap->pm_stats.wired_count--;
+ wireddelta = -1;
+ else
+ wireddelta = 0;
+ ptpdelta = 0;
/*
* is the currently mapped PA the same as the one we
@@ -3224,17 +3229,20 @@
}
} else { /* opte not valid */
pve = NULL;
- pmap->pm_stats.resident_count++;
+ resdelta = 1;
if (wired)
- pmap->pm_stats.wired_count++;
+ wireddelta = 1;
+ else
+ wireddelta = 0;
if (ptp)
- ptp->wire_count++; /* count # of valid entrys */
+ ptpdelta = 1;
+ else
+ ptpdelta = 0;
}
/*
- * at this point pm_stats has been updated. pve is either NULL
- * or points to a now-free pv_entry structure (the latter case is
- * if we called pmap_remove_pv above).
+ * pve is either NULL or points to a now-free pv_entry structure
+ * (the latter case is if we called pmap_remove_pv above).
*
* if this entry is to be on a pvlist, enter it now.
*/
@@ -3267,6 +3275,10 @@
* at this point pvh is !NULL if we want the PG_PVLIST bit set
*/
+ pmap->pm_stats.resident_count += resdelta;
+ pmap->pm_stats.wired_count += wireddelta;
+ if (ptp)
+ ptp->wire_count += ptpdelta;
npte = pa | protection_codes[prot] | PG_V | PG_N | PG_4K;
if (pvh)
npte |= PG_PVLIST;
Home |
Main Index |
Thread Index |
Old Index