Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sun2/sun2 Catch-up to revision 1.135 of the sun3 pm...



details:   https://anonhg.NetBSD.org/src/rev/daa223f6da40
branches:  trunk
changeset: 518464:daa223f6da40
user:      fredette <fredette%NetBSD.org@localhost>
date:      Fri Nov 30 18:22:51 2001 +0000

description:
Catch-up to revision 1.135 of the sun3 pmap.  This revision
corresponds tightly to that one.

diffstat:

 sys/arch/sun2/sun2/pmap.c |  759 +++++++++++++++++++++++++--------------------
 1 files changed, 421 insertions(+), 338 deletions(-)

diffs (truncated from 1750 to 300 lines):

diff -r e35f141ecc22 -r daa223f6da40 sys/arch/sun2/sun2/pmap.c
--- a/sys/arch/sun2/sun2/pmap.c Fri Nov 30 18:15:24 2001 +0000
+++ b/sys/arch/sun2/sun2/pmap.c Fri Nov 30 18:22:51 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.15 2001/09/15 20:36:35 chs Exp $    */
+/*     $NetBSD: pmap.c,v 1.16 2001/11/30 18:22:51 fredette Exp $       */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  * be stolen from it.  PMEGs allocated to a particular segment of a
  * pmap's virtual space will be fought over by the other pmaps.
  *
- * This pmap was once sys/arch/sun3/sun3/pmap.c revision 1.124.
+ * This pmap was once sys/arch/sun3/sun3/pmap.c revision 1.135.
  */
 
 /*
@@ -94,7 +94,7 @@
 #include <sys/systm.h>
 #include <sys/proc.h>
 #include <sys/malloc.h>
-#include <sys/pool.h>
+#include <sys/pool.h>
 #include <sys/user.h>
 #include <sys/queue.h>
 #include <sys/kcore.h>
@@ -143,7 +143,7 @@
  * Only "main memory" pages are registered in the pv_lists.
  * This macro is used to determine if a given pte refers to
  * "main memory" or not.  One slight hack here deserves more
- * explanation:  On the Sun-2, the bwtwo and zsc1 appear
+ * explanation:  On the Sun-2, the bwtwo and zs1 appear
  * as PG_OBMEM devices at 0x00700000 and 0x00780000, 
  * respectively.  We do not want to consider these as 
  * "main memory" so the macro below treats obmem addresses
@@ -155,6 +155,10 @@
 /* Does this (pseudo) PA represent device space? */
 #define PA_IS_DEV(pa) (((pa) & PMAP_TYPE) != 0 || (pa) >= 0x00700000)
 
+/*
+ * Is there a Virtually Addressed Cache (VAC) alias problem
+ * if one page is mapped at both a1 and a2?
+ */
 #define        BADALIAS(a1, a2)        (0)
 
 
@@ -173,7 +177,8 @@
 #define PMD_CREATE     0x200
 #define PMD_SEGMAP     0x400
 #define PMD_SETPTE     0x800
-#define PMD_FAULT  0x1000
+#define PMD_FAULT      0x1000
+#define PMD_KMAP       0x2000
 
 #define        PMD_REMOVE      PMD_ENTER
 #define        PMD_UNLINK      PMD_LINK
@@ -184,7 +189,6 @@
 int pmap_db_watchpmeg = -1;
 #endif /* PMAP_DEBUG */
 
-
 /*
  * Miscellaneous variables.
  *
@@ -193,25 +197,27 @@
  * These are set in pmap_bootstrap() and used in
  * pmap_next_page().
  */
-vm_offset_t virtual_avail, virtual_end;
-vm_offset_t avail_start, avail_end;
+vaddr_t virtual_avail, virtual_end;
+paddr_t avail_start, avail_end;
 #define        managed(pa)     (((pa) >= avail_start) && ((pa) < avail_end))
 
 /* used to skip a single hole in RAM */
-static vm_offset_t hole_start, hole_size;
+static vaddr_t hole_start, hole_size;
 
 /* This is for pmap_next_page() */
-static vm_offset_t avail_next;
+static paddr_t avail_next;
 
 /* This is where we map a PMEG without a context. */
-static vm_offset_t temp_seg_va;
+static vaddr_t temp_seg_va;
+#ifdef DIAGNOSTIC
 static int temp_seg_inuse;
+#endif
 
 /*
  * Location to store virtual addresses
  * to be used in copy/zero operations.
  */
-vm_offset_t tmp_vpages[2] = {
+vaddr_t tmp_vpages[2] = {
        NBPG * 8,
        NBPG * 9 };
 int tmp_vpages_inuse;
@@ -220,9 +226,9 @@
 struct pmap kernel_pmap_store;
 #define kernel_pmap (&kernel_pmap_store)
 static u_char kernel_segmap[NSEGMAP];
-
-/* memory pool for pmap structures */
-struct pool    pmap_pmap_pool;
+
+/* memory pool for pmap structures */
+struct pool    pmap_pmap_pool;
 
 /* statistics... */
 struct pmap_stats {
@@ -239,27 +245,12 @@
        int     ps_vac_recached;        /* re-cached when bad alias gone */
 } pmap_stats;
 
-
-/*
- * locking issues:  These used to do spl* stuff.
- * XXX: Use these for reentrance detection?
- */
-#define PMAP_LOCK()    (void)/XXX
-#define PMAP_UNLOCK()  (void)/XXX
-
 #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
 
-/*
- * Note that splvm() is used in routines called at splnet() and
- * MUST NOT lower the priority.  For this reason we arrange that:
- *    splimp = max(splnet,splbio)
- * Would splvm() be more natural here? (same level as splimp).
- */
-
 #ifdef PMAP_DEBUG
 #define        CHECK_SPL() do { \
        if ((getsr() & PSL_IPL) < PSL_IPL4) \
@@ -275,17 +266,13 @@
  * (i.e. Find all virtual mappings of a physical page.)
  */
 
-/*
- * XXX - Could eliminate this by causing managed() to return 0
- * ( avail_start = avail_end = 0 )
- */
 int pv_initialized = 0;
 
 /* One of these for each mapped virtual page. */
 struct pv_entry {
        struct pv_entry *pv_next;
        pmap_t         pv_pmap;
-       vm_offset_t      pv_va;
+       vaddr_t        pv_va;
 };
 typedef struct pv_entry *pv_entry_t;
 
@@ -344,7 +331,7 @@
        int            pmeg_index;
        pmap_t         pmeg_owner;
        int            pmeg_version;
-       vm_offset_t    pmeg_va;
+       vaddr_t        pmeg_va;
        int            pmeg_wired;
        int            pmeg_reserved;
        int            pmeg_vpages;
@@ -370,58 +357,56 @@
 static int get_pte_pmeg __P((int, int));
 static void set_pte_pmeg __P((int, int, int));
 
-static void context_allocate __P((pmap_t pmap));
-static void context_free __P((pmap_t pmap));
+static void context_allocate __P((pmap_t));
+static void context_free __P((pmap_t));
 static void context_init __P((void));
 
 static void pmeg_init __P((void));
-static void pmeg_reserve __P((int pmeg_num));
-
-static pmeg_t pmeg_allocate __P((pmap_t pmap, vm_offset_t va));
-static void pmeg_mon_init __P((vm_offset_t sva, vm_offset_t eva, int keep));
-static void pmeg_release __P((pmeg_t pmegp));
-static void pmeg_free __P((pmeg_t pmegp));
-static pmeg_t pmeg_cache __P((pmap_t pmap, vm_offset_t va));
-static void pmeg_set_wiring __P((pmeg_t pmegp, vm_offset_t va, int));
-
-static int  pv_link   __P((pmap_t pmap, int pte, vm_offset_t va));
-static void pv_unlink __P((pmap_t pmap, int pte, vm_offset_t va));
-static void pv_remove_all __P((vm_offset_t pa));
-static void pv_changepte __P((vm_offset_t pa, int, int));
+static void pmeg_reserve __P((int));
+
+static pmeg_t pmeg_allocate __P((pmap_t, vaddr_t));
+static void pmeg_mon_init __P((vaddr_t, vaddr_t, int));
+static void pmeg_release __P((pmeg_t));
+static void pmeg_free __P((pmeg_t));
+static pmeg_t pmeg_cache __P((pmap_t, vaddr_t));
+static void pmeg_set_wiring __P((pmeg_t, vaddr_t, int));
+
+static int  pv_link   __P((pmap_t, int, vaddr_t));
+static void pv_unlink __P((pmap_t, int, vaddr_t));
+static void pv_remove_all __P((paddr_t));
+static void pv_changepte __P((paddr_t, int, int));
 static u_int pv_syncflags __P((pv_entry_t));
 static void pv_init __P((void));
 
-static void pmeg_clean __P((pmeg_t pmegp));
+static void pmeg_clean __P((pmeg_t));
 static void pmeg_clean_free __P((void));
 
-static void pmap_common_init __P((pmap_t pmap));
-static void pmap_kernel_init __P((pmap_t pmap));
-static void pmap_user_init __P((pmap_t pmap));
+static void pmap_common_init __P((pmap_t));
+static void pmap_kernel_init __P((pmap_t));
+static void pmap_user_init __P((pmap_t));
 static void pmap_page_upload __P((void));
 
-static void pmap_enter_kernel __P((vm_offset_t va,
-       int new_pte, boolean_t wired));
-static void pmap_enter_user __P((pmap_t pmap, vm_offset_t va,
-       int new_pte, boolean_t wired));
-
-static void pmap_protect1 __P((pmap_t, vm_offset_t, vm_offset_t));
-static void pmap_protect_mmu __P((pmap_t, vm_offset_t, vm_offset_t));
-static void pmap_protect_noctx __P((pmap_t, vm_offset_t, vm_offset_t));
-
-static void pmap_remove1 __P((pmap_t pmap, vm_offset_t, vm_offset_t));
-static void pmap_remove_mmu __P((pmap_t, vm_offset_t, vm_offset_t));
-static void pmap_remove_noctx __P((pmap_t, vm_offset_t, vm_offset_t));
-
-static int  pmap_fault_reload __P((struct pmap *, vm_offset_t, int));
+static void pmap_enter_kernel __P((vaddr_t, int, boolean_t));
+static void pmap_enter_user __P((pmap_t, vaddr_t, int, boolean_t));
+
+static void pmap_protect1 __P((pmap_t, vaddr_t, vaddr_t));
+static void pmap_protect_mmu __P((pmap_t, vaddr_t, vaddr_t));
+static void pmap_protect_noctx __P((pmap_t, vaddr_t, vaddr_t));
+
+static void pmap_remove1 __P((pmap_t, vaddr_t, vaddr_t));
+static void pmap_remove_mmu __P((pmap_t, vaddr_t, vaddr_t));
+static void pmap_remove_noctx __P((pmap_t, vaddr_t, vaddr_t));
+
+static int  pmap_fault_reload __P((struct pmap *, vaddr_t, int));
 
 /* Called only from locore.s and pmap.c */
-void   _pmap_switch __P((pmap_t pmap));
+void   _pmap_switch __P((pmap_t));
 
 #ifdef PMAP_DEBUG
-void pmap_print __P((pmap_t pmap));
-void pv_print __P((vm_offset_t pa));
-void pmeg_print __P((pmeg_t pmegp));
-static void pmeg_verify_empty __P((vm_offset_t va));
+void pmap_print __P((pmap_t));
+void pv_print __P((struct vm_page *));
+void pmeg_print __P((pmeg_t));
+static void pmeg_verify_empty __P((vaddr_t));
 #endif /* PMAP_DEBUG */
 void pmap_pinit __P((pmap_t));
 void pmap_release __P((pmap_t));
@@ -451,7 +436,7 @@
 }
 
 static inline struct pv_entry **
-pa_to_pvhead(vm_offset_t pa)
+pa_to_pvhead(paddr_t pa)
 {
        int idx;
 
@@ -464,7 +449,7 @@
 }
 
 static inline u_char *
-pa_to_pvflags(vm_offset_t pa)
+pa_to_pvflags(paddr_t pa)
 {
        int idx;
 
@@ -476,6 +461,18 @@
        return (&pv_flags_tbl[idx]);
 }
 
+/*
+ * Save the MOD bit from the given PTE using its PA
+ */
+static inline void
+save_modref_bits(int pte)
+{
+       u_char *pv_flags;
+
+       pv_flags = pa_to_pvflags(PG_PA(pte));
+       *pv_flags |= ((pte & PG_MODREF) >> PV_SHIFT);
+}
+
 static inline pmeg_t
 pmeg_p(int sme)
 {



Home | Main Index | Thread Index | Old Index