Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amiga Sync with Atari pmap: support for the UVM cha...
details: https://anonhg.NetBSD.org/src/rev/1d4c3a842153
branches: trunk
changeset: 473799:1d4c3a842153
user: is <is%NetBSD.org@localhost>
date: Sat Jun 19 19:44:08 1999 +0000
description:
Sync with Atari pmap: support for the UVM changes
diffstat:
sys/arch/amiga/amiga/pmap.c | 1040 ++++++++++++++++++++++------------------
sys/arch/amiga/include/pmap.h | 10 +-
2 files changed, 587 insertions(+), 463 deletions(-)
diffs (truncated from 1674 to 300 lines):
diff -r 1fe2776169c5 -r 1d4c3a842153 sys/arch/amiga/amiga/pmap.c
--- a/sys/arch/amiga/amiga/pmap.c Sat Jun 19 19:25:10 1999 +0000
+++ b/sys/arch/amiga/amiga/pmap.c Sat Jun 19 19:44:08 1999 +0000
@@ -1,4 +1,40 @@
-/* $NetBSD: pmap.c,v 1.67 1999/06/17 19:23:22 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.68 1999/06/19 19:44:09 is Exp $ */
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
/*
* Copyright (c) 1991 Regents of the University of California.
@@ -147,29 +183,32 @@
#define PDB_PVDUMP 0x8000
int debugmap = 0;
int pmapdebug = PDB_PARANOIA;
+
+static void pmap_check_wiring __P((char *, vaddr_t));
+static void pmap_pvdump __P((paddr_t));
#endif
/*
* Get STEs and PTEs for user/kernel address space
*/
#if defined(M68040) || defined(M68060)
-#define pmap_ste(m, v) (&((m)->pm_stab[(vm_offset_t)(v) >> pmap_ishift]))
-#define pmap_ste1(m, v) \
- (&((m)->pm_stab[(vm_offset_t)(v) >> SG4_SHIFT1]))
+#define pmap_ste(m, v) (&((m)->pm_stab[(vaddr_t)(v) >> pmap_ishift]))
+#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) \
+#define pmap_ste2(m, v) \
(&((m)->pm_stab[(u_int *)(*(u_int *)pmap_ste1(m,v) & SG4_ADDR1) \
- (m)->pm_stpa + (((v) & SG4_MASK2) >> SG4_SHIFT2)]))
-#define pmap_ste_v(m, v) \
- (mmutype == MMU_68040 \
- ? ((*pmap_ste1(m, v) & SG_V) && \
- (*pmap_ste2(m, v) & SG_V)) \
+#define pmap_ste_v(m, 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[(vm_offset_t)(v) >> SG_ISHIFT]))
+#else /* defined(M68040) || defined(M68060) */
+#define pmap_ste(m, v) (&((m)->pm_stab[(vaddr_t)(v) >> SG_ISHIFT]))
#define pmap_ste_v(m, v) (*pmap_ste(m, v) & SG_V)
-#endif
-#define pmap_pte(m, v) (&((m)->pm_ptab[(vm_offset_t)(v) >> PG_SHIFT]))
+#endif /* defined(M68040) || defined(M68060) */
+
+#define pmap_pte(m, v) (&((m)->pm_ptab[(vaddr_t)(v) >> PG_SHIFT]))
#define pmap_pte_pa(pte) (*(u_int *)(pte) & PG_FRAME)
@@ -214,8 +253,8 @@
struct kpt_page {
struct kpt_page *kpt_next; /* link on either used or free list */
- vm_offset_t kpt_va; /* always valid kernel VA */
- vm_offset_t kpt_pa; /* PA of this page (for speed) */
+ vaddr_t kpt_va; /* always valid kernel VA */
+ paddr_t kpt_pa; /* PA of this page (for speed) */
};
struct kpt_page *kpt_free_list, *kpt_used_list;
struct kpt_page *kpt_pages;
@@ -229,19 +268,18 @@
* Segtabzero is an empty segment table which all processes share til they
* reference something.
*/
-u_int *Sysseg;
-u_int *Sysseg_pa;
+u_int *Sysseg, *Sysseg_pa;
u_int *Sysmap, *Sysptmap;
u_int *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;
+vm_map_t pt_map;
+struct vm_map pt_map_store;
-vm_size_t mem_size; /* memory size in bytes */
-vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss)*/
-vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */
+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 the VM system */
boolean_t pmap_initialized = FALSE; /* Has pmap_init completed? */
char *pmap_attributes; /* reference and modify bits */
@@ -253,28 +291,36 @@
#endif
extern caddr_t msgbufaddr;
-extern vm_offset_t msgbufpa;
+extern paddr_t msgbufpa;
u_long noncontig_enable;
-extern const vm_offset_t amiga_uptbase;
+extern const vaddr_t amiga_uptbase;
-extern vm_offset_t z2mem_start;
+extern paddr_t z2mem_start;
+
+extern vaddr_t reserve_dumppages __P((vaddr_t));
-boolean_t pmap_testbit __P((register vm_offset_t, int));
-void pmap_enter_ptpage __P((register pmap_t, register vm_offset_t));
-void pmap_collect1 __P((pmap_t, vm_offset_t, vm_offset_t));
-extern vm_offset_t reserve_dumppages __P((vm_offset_t));
-static void amiga_protection_init __P((void));
-void pmap_check_wiring __P((char *, vm_offset_t));
-static void pmap_changebit __P((register vm_offset_t, int, boolean_t));
+boolean_t pmap_testbit __P((paddr_t, int));
+void pmap_enter_ptpage __P((pmap_t, vaddr_t));
+static void pmap_ptpage_addref __P((vaddr_t));
+static int pmap_ptpage_delref __P((vaddr_t));
+static void pmap_changebit __P((vaddr_t, int, boolean_t));
struct pv_entry * pmap_alloc_pv __P((void));
-void pmap_free_pv __P((struct pv_entry *));
-void pmap_pinit __P((pmap_t));
-void pmap_release __P((pmap_t));
+void pmap_free_pv __P((struct pv_entry *));
+void pmap_pinit __P((pmap_t));
+void pmap_release __P((pmap_t));
+static void pmap_remove_mapping __P((pmap_t, vaddr_t, pt_entry_t *, int));
+
+static void amiga_protection_init __P((void));
+void pmap_collect1 __P((pmap_t, paddr_t, paddr_t));
-#ifdef DEBUG
-void pmap_pvdump __P((vm_offset_t));
-#endif
+/* pmap_remove_mapping flags */
+#define PRM_TFLUSH 0x01
+#define PRM_CFLUSH 0x02
+#define PRM_KEEPPTPAGE 0x04
+
+
+
/*
@@ -283,8 +329,8 @@
caddr_t CADDR1, CADDR2, vmmap;
u_int *CMAP1, *CMAP2, *vmpte, *msgbufmap;
-#define PAGE_IS_MANAGED(pa) (pmap_initialized && \
- vm_physseg_find(atop((pa)), NULL) != -1)
+#define PAGE_IS_MANAGED(pa) (pmap_initialized \
+ && vm_physseg_find(atop((pa)), NULL) != -1)
#define pa_to_pvh(pa) \
({ \
@@ -315,14 +361,14 @@
*/
void
pmap_bootstrap(firstaddr, loadaddr)
- vm_offset_t firstaddr;
- vm_offset_t loadaddr;
+ paddr_t firstaddr;
+ paddr_t loadaddr;
{
- vm_offset_t va;
+ vaddr_t va;
u_int *pte;
int i;
struct boot_memseg *sp, *esp;
- vm_offset_t fromads, toads;
+ paddr_t fromads, toads;
fromads = firstaddr;
toads = maxmem << PGSHIFT;
@@ -442,14 +488,15 @@
void
pmap_init()
{
- extern vm_offset_t amigahwaddr;
- extern u_int namigahwpg;
- vm_offset_t addr, addr2;
- vm_size_t npages, s;
- int rv;
+ extern vaddr_t amigahwaddr;
+ extern u_int namigahwpg;
+ vaddr_t addr, addr2;
+ paddr_t paddr;
+ vsize_t s;
+ u_int npg;
struct pv_entry *pv;
char *attr;
- int bank;
+ int rv, bank;
#if defined(M68060)
struct kpt_page *kptp;
#endif
@@ -463,7 +510,7 @@
* unavailable regions which we have mapped in locore.
* XXX in pmap_bootstrap() ???
*/
- addr = (vm_offset_t) amigahwaddr;
+ addr = (vaddr_t) amigahwaddr;
if (uvm_map(kernel_map, &addr,
ptoa(namigahwpg),
NULL, UVM_UNKNOWN_OFFSET,
@@ -471,7 +518,7 @@
UVM_INH_NONE, UVM_ADV_RANDOM,
UVM_FLAG_FIXED)) != KERN_SUCCESS)
goto bogons;
- addr = (vm_offset_t) Sysmap;
+ addr = (vaddr_t) Sysmap;
if (uvm_map(kernel_map, &addr, AMIGA_KPTSIZE,
NULL, UVM_UNKNOWN_OFFSET,
UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE,
@@ -499,20 +546,18 @@
*/
for (page_cnt = 0, bank = 0; bank < vm_nphysseg; bank++) {
page_cnt += vm_physmem[bank].end - vm_physmem[bank].start;
+#ifdef DEBUG
printf("pmap_init: %2d: %08lx - %08lx (%10d)\n", bank,
vm_physmem[bank].start << PGSHIFT,
vm_physmem[bank].end << PGSHIFT, page_cnt << PGSHIFT);
+#endif
}
-#if 0 /* XXX def DEBUG */
- printf("pmap_init: avail_start %lx phys_segs[0].start %lx npg %ld\n",
- avail_start, phys_segs[0].start, page_cnt);
-#endif
s = AMIGA_STSIZE; /* Segtabzero */
s += page_cnt * sizeof(struct pv_entry); /* pv table */
s += page_cnt * sizeof(char); /* attribute table */
s = round_page(s);
- addr = (vm_offset_t) uvm_km_zalloc(kernel_map, s);
+ addr = uvm_km_zalloc(kernel_map, s);
if (addr == 0)
panic("pmap_init: can't allocate data structures");
Segtabzero = (u_int *) addr;
@@ -538,11 +583,11 @@
pv = pv_table;
attr = pmap_attributes;
for (bank = 0; bank < vm_nphysseg; bank++) {
- npages = vm_physmem[bank].end - vm_physmem[bank].start;
+ npg = vm_physmem[bank].end - vm_physmem[bank].start;
vm_physmem[bank].pmseg.pvent = pv;
vm_physmem[bank].pmseg.attrs = attr;
- pv += npages;
- attr += npages;
+ pv += npg;
+ attr += npg;
}
/*
@@ -550,17 +595,17 @@
* we need enough pages to map the page tables for each process
* plus some slop.
*/
- npages = howmany(((maxproc + 16) * AMIGA_UPTSIZE / NPTEPG), NBPG);
+ npg = howmany(((maxproc + 16) * AMIGA_UPTSIZE / NPTEPG), NBPG);
#ifdef NKPTADD
- npages += NKPTADD;
+ npg += NKPTADD;
#else
Home |
Main Index |
Thread Index |
Old Index