Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sun3/sun3x Initialize pmap->pm_refcount properly in...
details: https://anonhg.NetBSD.org/src/rev/a71fbbc0e65d
branches: trunk
changeset: 498379:a71fbbc0e65d
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat Oct 21 14:10:25 2000 +0000
description:
Initialize pmap->pm_refcount properly in pmap_pinit() and
add simple_locks where pmap->pm_refcount are refered.
This should fix a long-standing "out of space kmem_map" panic bug on sun3x.
diffstat:
sys/arch/sun3/sun3x/pmap.c | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diffs (67 lines):
diff -r 3084e118189e -r a71fbbc0e65d sys/arch/sun3/sun3x/pmap.c
--- a/sys/arch/sun3/sun3x/pmap.c Sat Oct 21 13:56:17 2000 +0000
+++ b/sys/arch/sun3/sun3x/pmap.c Sat Oct 21 14:10:25 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.54 2000/06/29 07:19:14 mrg Exp $ */
+/* $NetBSD: pmap.c,v 1.55 2000/10/21 14:10:25 tsutsui Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -360,9 +360,11 @@
#define NUM_KERN_PTES (KVAS_SIZE >> MMU_TIC_SHIFT)
/*************************** MISCELANEOUS MACROS *************************/
-#define PMAP_LOCK() ; /* Nothing, for now */
-#define PMAP_UNLOCK() ; /* same. */
-#define NULL 0
+#define pmap_lock(pmap) simple_lock(&pmap->pm_lock)
+#define pmap_unlock(pmap) simple_unlock(&pmap->pm_lock)
+#define pmap_add_ref(pmap) ++pmap->pm_refcount
+#define pmap_del_ref(pmap) --pmap->pm_refcount
+#define pmap_refcount(pmap) pmap->pm_refcount
static INLINE void * mmu_ptov __P((vm_offset_t pa));
static INLINE vm_offset_t mmu_vtop __P((void * va));
@@ -825,6 +827,7 @@
kernel_pmap.pm_a_tmgr = NULL;
kernel_pmap.pm_a_phys = kernAphys;
kernel_pmap.pm_refcount = 1; /* always in use */
+ simple_lock_init(&kernel_pmap.pm_lock);
kernel_crp.rp_attr = MMU_LONG_DTE_LU | MMU_DT_LONG;
kernel_crp.rp_addr = kernAphys;
@@ -2567,6 +2570,8 @@
bzero(pmap, sizeof(struct pmap));
pmap->pm_a_tmgr = NULL;
pmap->pm_a_phys = kernAphys;
+ pmap->pm_refcount = 1;
+ simple_lock_init(&pmap->pm_lock);
}
/* pmap_release INTERFACE
@@ -2629,9 +2634,9 @@
if (pmap == NULL)
return;
- /* pmap_lock(pmap); */
- pmap->pm_refcount++;
- /* pmap_unlock(pmap); */
+ pmap_lock(pmap);
+ pmap_add_ref(pmap);
+ pmap_unlock(pmap);
}
/* pmap_dereference INTERNAL
@@ -2648,9 +2653,9 @@
if (pmap == NULL)
return 0;
- /* pmap_lock(pmap); */
- rtn = --pmap->pm_refcount;
- /* pmap_unlock(pmap); */
+ pmap_lock(pmap);
+ rtn = pmap_del_ref(pmap);
+ pmap_unlock(pmap);
return rtn;
}
Home |
Main Index |
Thread Index |
Old Index