Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/sys/arch/mac68k/mac68k pullup 1.52->1.54 (scottr): sync...
details: https://anonhg.NetBSD.org/src/rev/c2ebd19aa89d
branches: netbsd-1-4
changeset: 468405:c2ebd19aa89d
user: perry <perry%NetBSD.org@localhost>
date: Wed Apr 21 14:56:47 1999 +0000
description:
pullup 1.52->1.54 (scottr): sync to hp300 pmap
diffstat:
sys/arch/mac68k/mac68k/pmap.c | 1195 +++++++++++++++++++---------------------
1 files changed, 566 insertions(+), 629 deletions(-)
diffs (truncated from 2159 to 300 lines):
diff -r 3b30ee875234 -r c2ebd19aa89d sys/arch/mac68k/mac68k/pmap.c
--- a/sys/arch/mac68k/mac68k/pmap.c Wed Apr 21 14:53:44 1999 +0000
+++ b/sys/arch/mac68k/mac68k/pmap.c Wed Apr 21 14:56:47 1999 +0000
@@ -1,6 +1,6 @@
-/* $NetBSD: pmap.c,v 1.52 1999/03/27 05:57:04 mycroft Exp $ */
+/* $NetBSD: pmap.c,v 1.52.2.1 1999/04/21 14:56:47 perry Exp $ */
-/*
+/*
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -59,7 +59,7 @@
* Bitwise and/or operations are significantly faster than bitfield
* references so we use them when accessing STE/PTEs in the pmap_pte_*
* macros. Note also that the two are not always equivalent; e.g.:
- * (*pte & PG_PROT)[4] != pte->pg_prot [1]
+ * (*pte & PG_PROT)[4] != pte->pg_prot[1]
* and a couple of routines that deal with protection and wiring take
* some shortcuts that assume the and/or definitions.
*
@@ -98,6 +98,7 @@
#include <sys/proc.h>
#include <sys/malloc.h>
#include <sys/user.h>
+#include <sys/pool.h>
#include <machine/pte.h>
@@ -109,58 +110,7 @@
#include <machine/cpu.h>
-#ifdef PMAPSTATS
-struct {
- int collectscans;
- int collectpages;
- int kpttotal;
- int kptinuse;
- int kptmaxuse;
-} kpt_stats;
-struct {
- int kernel; /* entering kernel mapping */
- int user; /* entering user mapping */
- int ptpneeded; /* needed to allocate a PT page */
- int nochange; /* no change at all */
- int pwchange; /* no mapping change, just wiring or protection */
- int wchange; /* no mapping change, just wiring */
- int pchange; /* no mapping change, just protection */
- int mchange; /* was mapped but mapping to different page */
- int managed; /* a managed page */
- int firstpv; /* first mapping for this PA */
- int secondpv; /* second mapping for this PA */
- int ci; /* cache inhibited */
- int unmanaged; /* not a managed page */
- int flushes; /* cache flushes */
-} enter_stats;
-struct {
- int calls;
- int removes;
- int pvfirst;
- int pvsearch;
- int ptinvalid;
- int uflushes;
- int sflushes;
-} remove_stats;
-struct {
- int calls;
- int changed;
- int alreadyro;
- int alreadyrw;
-} protect_stats;
-struct chgstats {
- int setcalls;
- int sethits;
- int setmiss;
- int clrcalls;
- int clrhits;
- int clrmiss;
-} changebit_stats[16];
-#endif
-
#ifdef DEBUG
-int debugmap = 0;
-int pmapdebug = 0x2000;
#define PDB_FOLLOW 0x0001
#define PDB_INIT 0x0002
#define PDB_ENTER 0x0004
@@ -177,31 +127,36 @@
#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
+
#if defined(M68040)
int dowriteback = 1; /* 68040: enable writeback caching */
int dokwriteback = 1; /* 68040: enable writeback caching of kernel AS */
#endif
-
-extern vaddr_t pager_sva, pager_eva;
-#endif
+#else /* ! DEBUG */
+#define PMAP_DPRINTF(l, x) /* nothing */
+#endif /* DEBUG */
/*
* Get STEs and PTEs for user/kernel address space
*/
#if defined(M68040)
-#define pmap_ste1(m, v) \
+#define pmap_ste1(m, v) \
(&((m)->pm_stab[(vaddr_t)(v) >> SG4_SHIFT1]))
/* XXX assumes physically contiguous ST pages (if more than one) */
#define pmap_ste2(m, v) \
(&((m)->pm_stab[(st_entry_t *)(*(u_int *)pmap_ste1(m, v) & SG4_ADDR1) \
- (m)->pm_stpa + (((v) & SG4_MASK2) >> SG4_SHIFT2)]))
-#define pmap_ste(m, v) \
+#define pmap_ste(m, v) \
(&((m)->pm_stab[(vaddr_t)(v) \
>> (mmutype == MMU_68040 ? SG4_SHIFT1 : SG_ISHIFT)]))
#define pmap_ste_v(m, v) \
- (mmutype == MMU_68040 \
- ? ((*pmap_ste1(m, v) & SG_V) && \
- (*pmap_ste2(m, v) & SG_V)) \
+ (mmutype == MMU_68040 \
+ ? ((*pmap_ste1(m, v) & SG_V) && \
+ (*pmap_ste2(m, v) & SG_V)) \
: (*pmap_ste(m, v) & SG_V))
#else
#define pmap_ste(m, v) (&((m)->pm_stab[(vaddr_t)(v) >> SG_ISHIFT]))
@@ -217,17 +172,13 @@
#define pmap_pte_prot(pte) (*(pte) & PG_PROT)
#define pmap_pte_v(pte) (*(pte) & PG_V)
-#define pmap_pte_set_w(pte, v) \
+#define pmap_pte_set_w(pte, v) \
if (v) *(pte) |= PG_W; else *(pte) &= ~PG_W
#define pmap_pte_set_prot(pte, v) \
if (v) *(pte) |= PG_PROT; else *(pte) &= ~PG_PROT
#define pmap_pte_w_chg(pte, nw) ((nw) ^ pmap_pte_w(pte))
#define pmap_pte_prot_chg(pte, np) ((np) ^ pmap_pte_prot(pte))
-#define pmap_valid_page(pa) (pmap_initialized && pmap_page_index(pa) >= 0)
-
-int pmap_page_index(paddr_t pa);
-
/*
* Given a map and a machine independent protection code,
* convert to a m68k protection code.
@@ -258,19 +209,15 @@
st_entry_t *Sysseg;
pt_entry_t *Sysmap, *Sysptmap;
st_entry_t *Segtabzero, *Segtabzeropa;
-vm_size_t Sysptsize = VM_KERNEL_PT_PAGES;
+vsize_t Sysptsize = VM_KERNEL_PT_PAGES;
struct pmap kernel_pmap_store;
vm_map_t st_map, pt_map;
struct vm_map st_map_store, pt_map_store;
-paddr_t avail_start; /* PA of first available physical page */
-paddr_t avail_next; /* Next available physical page */
-int avail_remaining;/* Number of physical free pages left */
-int avail_range; /* Range avail_next is in */
-paddr_t avail_end; /* Set for ps and friends as */
- /* avail_start + avail_remaining. */
-vm_size_t mem_size; /* memory size in bytes */
+paddr_t avail_start; /* PA of first available physical page */
+paddr_t avail_end; /* PA of last available physical page */
+vsize_t mem_size; /* memory size in bytes */
vaddr_t virtual_avail; /* VA of first avail page (after kernel bss)*/
vaddr_t virtual_end; /* VA of last avail page (end of kernel AS) */
int page_cnt; /* number of pages managed by VM system */
@@ -282,9 +229,6 @@
int pv_nfree;
/* The following four variables are defined in pmap_bootstrap.c */
-extern int numranges;
-extern unsigned long low[8];
-extern unsigned long high[8];
extern int vidlen;
#define VIDMAPSIZE btoc(vidlen)
@@ -292,11 +236,19 @@
int protostfree; /* prototype (default) free ST map */
#endif
+extern caddr_t CADDR1, CADDR2;
+
+pt_entry_t *caddr1_pte; /* PTE for CADDR1 */
+pt_entry_t *caddr2_pte; /* PTE for CADDR2 */
+
+struct pool pmap_pmap_pool; /* memory pool for pmap structures */
+
struct pv_entry *pmap_alloc_pv __P((void));
void pmap_free_pv __P((struct pv_entry *));
void pmap_collect_pv __P((void));
-void pmap_pinit __P((pmap_t));
-void pmap_release __P((pmap_t));
+
+#define PAGE_IS_MANAGED(pa) (pmap_initialized && \
+ vm_physseg_find(atop((pa)), NULL) != -1)
#define pa_to_pvh(pa) \
({ \
@@ -319,9 +271,11 @@
*/
void pmap_remove_mapping __P((pmap_t, vaddr_t, pt_entry_t *, int));
boolean_t pmap_testbit __P((paddr_t, int));
-void pmap_changebit __P((paddr_t, int, boolean_t));
+void pmap_changebit __P((paddr_t, int, int));
void pmap_enter_ptpage __P((pmap_t, vaddr_t));
void pmap_collect1 __P((pmap_t, paddr_t, vaddr_t));
+void pmap_pinit __P((pmap_t));
+void pmap_release __P((pmap_t));
#ifdef DEBUG
void pmap_pvdump __P((paddr_t));
@@ -333,12 +287,15 @@
#define PRM_CFLUSH 2
/*
- * Routine: pmap_virtual_space
+ * pmap_virtual_space: [ INTERFACE ]
+ *
+ * Report the range of available kernel virtual address
+ * space to the VM system during bootstrap.
*
- * Function:
- * Report the range of available kernel virtual address
- * space to the VM system during bootstrap. Called by
- * vm_bootstrap_steal_memory().
+ * This is only an interface function if we do not use
+ * pmap_steal_memory()!
+ *
+ * Note: no locking is necessary in this function.
*/
void
pmap_virtual_space(vstartp, vendp)
@@ -350,43 +307,53 @@
}
/*
- * Routine: pmap_procwr
+ * pmap_procwr: [ INTERFACE ]
+ *
+ * Synchronize caches corresponding to [addr, addr+len) in p.
*
- * Function:
- * Synchronize caches corresponding to [addr, addr+len) in
- * p.
- *
- */
+ * Note: no locking is necessary in this function.
+ */
void
pmap_procwr(p, va, len)
- struct proc *p;
- vm_offset_t va;
- u_long len;
+ struct proc *p;
+ vaddr_t va;
+ u_long len;
{
+
(void)cachectl1(0x80000004, va, len, p);
}
/*
- * Initialize the pmap module.
- * Called by vm_init, to initialize any structures that the pmap
- * system needs to map virtual memory.
+ * pmap_init: [ INTERFACE ]
+ *
+ * Initialize the pmap module. Called by vm_init(), to initialize any
+ * structures that the pmap system needs to map virtual memory.
+ *
+ * Note: no locking is necessary in this function.
*/
void
pmap_init()
{
vaddr_t addr, addr2;
- vm_size_t s;
- struct pv_entry *pv;
+ vsize_t s;
+ struct pv_entry *pv;
char *attr;
- int rv, npages, bank;
+ int rv;
+ int npages;
+ int bank;
-#ifdef DEBUG
- if (pmapdebug & PDB_FOLLOW)
- printf("pmap_init()\n");
-#endif
Home |
Main Index |
Thread Index |
Old Index