Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Minor tweak to the pv_table management in the Hible...
details: https://anonhg.NetBSD.org/src/rev/6ac1528c1e21
branches: trunk
changeset: 746975:6ac1528c1e21
user: thorpej <thorpej%NetBSD.org@localhost>
date: Wed Aug 26 00:30:01 2009 +0000
description:
Minor tweak to the pv_table management in the Hibler-derived m68k pmaps:
The head of the list is now a pv_header, which contains the first pv_entry
as well as a 16-bit attributes field (replaces the pmap_attributes array
plus the pv_entry::pv_flags field) as a 16-bit count of caller-specified
cache-inhibited mappings.
Tested on hp300 (shared pmap_motorola.c), changes to atari and amiga copies
are purely mechanical.
diffstat:
sys/arch/amiga/amiga/pmap.c | 125 ++++++++++++++++-------------
sys/arch/amiga/include/vmparam.h | 5 +-
sys/arch/atari/atari/pmap.c | 120 +++++++++++++++------------
sys/arch/atari/include/vmparam.h | 5 +-
sys/arch/cesfic/include/vmparam.h | 5 +-
sys/arch/hp300/include/vmparam.h | 5 +-
sys/arch/luna68k/include/vmparam.h | 5 +-
sys/arch/m68k/include/pmap_motorola.h | 8 +-
sys/arch/m68k/m68k/pmap_motorola.c | 143 ++++++++++++++++++---------------
sys/arch/mac68k/include/vmparam.h | 5 +-
sys/arch/mvme68k/include/vmparam.h | 5 +-
sys/arch/news68k/include/vmparam.h | 5 +-
sys/arch/next68k/include/vmparam.h | 5 +-
sys/arch/x68k/include/vmparam.h | 5 +-
14 files changed, 236 insertions(+), 210 deletions(-)
diffs (truncated from 1408 to 300 lines):
diff -r 10f863804a63 -r 6ac1528c1e21 sys/arch/amiga/amiga/pmap.c
--- a/sys/arch/amiga/amiga/pmap.c Wed Aug 26 00:20:20 2009 +0000
+++ b/sys/arch/amiga/amiga/pmap.c Wed Aug 26 00:30:01 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.153 2009/08/18 18:06:53 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.154 2009/08/26 00:30:01 thorpej Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.153 2009/08/18 18:06:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.154 2009/08/26 00:30:01 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -273,7 +273,19 @@
st_entry_t *Segtabzero, *Segtabzeropa;
vsize_t Sysptsize = VM_KERNEL_PT_PAGES;
-struct pv_entry *pv_table; /* array of entries, one per page */
+struct pv_header {
+ struct pv_entry pvh_first; /* first PV entry */
+ uint16_t pvh_attrs; /* attributes:
+ bits 0-7: PTE bits
+ bits 8-15: flags */
+ uint16_t pvh_cimappings; /* # caller-specified CI
+ mappings */
+};
+
+#define PVH_CI 0x10 /* all entries are cache-inhibited */
+#define PVH_PTPAGE 0x20 /* entry maps a page table page */
+
+struct pv_header *pv_table; /* array of entries, one per page */
static struct pmap kernel_pmap_store;
struct pmap *const kernel_pmap_ptr = &kernel_pmap_store;
@@ -287,7 +299,6 @@
vaddr_t virtual_end; /* VA of last avail page (end of kernel AS) */
int page_cnt; /* number of pages managed by the VM system */
bool pmap_initialized = false; /* Has pmap_init completed? */
-char *pmap_attributes; /* reference and modify bits */
TAILQ_HEAD(pv_page_list, pv_page) pv_page_freelist;
int pv_nfree;
#if defined(M68040) || defined(M68060)
@@ -323,25 +334,13 @@
#define PAGE_IS_MANAGED(pa) (pmap_initialized && uvm_pageismanaged(pa))
-static inline struct pv_entry *pa_to_pvh(paddr_t pa);
-static inline char *pa_to_attribute(paddr_t pa);
-
-static inline struct pv_entry *
+static inline struct pv_header *
pa_to_pvh(paddr_t pa)
{
int bank, pg = 0; /* XXX gcc4 -Wuninitialized */
bank = vm_physseg_find(atop((pa)), &pg);
- return &vm_physmem[bank].pmseg.pvent[pg];
-}
-
-static inline char *
-pa_to_attribute(paddr_t pa)
-{
- int bank, pg = 0; /* XXX gcc4 -Wuninitialized */
-
- bank = vm_physseg_find(atop((pa)), &pg);
- return &vm_physmem[bank].pmseg.attrs[pg];
+ return &vm_physmem[bank].pmseg.pvheader[pg];
}
/*
@@ -355,8 +354,7 @@
vaddr_t addr, addr2;
vsize_t s;
u_int npg;
- struct pv_entry *pv;
- char *attr;
+ struct pv_header *pvh;
int rv, bank;
#if defined(M68060)
struct kpt_page *kptp;
@@ -397,8 +395,7 @@
#endif
}
s = M68K_STSIZE; /* Segtabzero */
- s += page_cnt * sizeof(struct pv_entry); /* pv table */
- s += page_cnt * sizeof(char); /* attribute table */
+ s += page_cnt * sizeof(struct pv_header); /* pv table */
s = round_page(s);
addr = uvm_km_alloc(kernel_map, s, 0, UVM_KMF_WIRED | UVM_KMF_ZERO);
@@ -408,30 +405,26 @@
(void) pmap_extract(pmap_kernel(), addr, (paddr_t *)(void *)&Segtabzeropa);
addr += M68K_STSIZE;
- pv_table = (struct pv_entry *) addr;
- addr += page_cnt * sizeof(struct pv_entry);
+ pv_table = (struct pv_header *) addr;
+ addr += page_cnt * sizeof(struct pv_header);
- pmap_attributes = (char *) addr;
#ifdef DEBUG
if (pmapdebug & PDB_INIT)
printf("pmap_init: %lx bytes: page_cnt %x s0 %p(%p) "
- "tbl %p atr %p\n",
+ "tbl %p\n",
s, page_cnt, Segtabzero, Segtabzeropa,
- pv_table, pmap_attributes);
+ pv_table);
#endif
/*
* Now that the pv and attribute tables have been allocated,
* assign them to the memory segments.
*/
- pv = pv_table;
- attr = pmap_attributes;
+ pvh = pv_table;
for (bank = 0; bank < vm_nphysseg; bank++) {
npg = vm_physmem[bank].end - vm_physmem[bank].start;
- vm_physmem[bank].pmseg.pvent = pv;
- vm_physmem[bank].pmseg.attrs = attr;
- pv += npg;
- attr += npg;
+ vm_physmem[bank].pmseg.pvheader = pvh;
+ pvh += npg;
}
/*
@@ -796,6 +789,7 @@
void
pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
{
+ struct pv_header *pvh;
struct pv_entry *pv;
int s;
paddr_t pa = VM_PAGE_TO_PHYS(pg);
@@ -815,7 +809,8 @@
break;
/* remove_all */
default:
- pv = pa_to_pvh(pa);
+ pvh = pa_to_pvh(pa);
+ pv = &pvh->pvh_first;
s = splvm();
while (pv->pv_pmap != NULL) {
pt_entry_t *pte;
@@ -1030,13 +1025,15 @@
* since pmap_enter can be called at interrupt time.
*/
if (PAGE_IS_MANAGED(pa)) {
+ struct pv_header *pvh;
struct pv_entry *pv, *npv;
int s;
#ifdef DEBUG
enter_stats.managed++;
#endif
- pv = pa_to_pvh(pa);
+ pvh = pa_to_pvh(pa);
+ pv = &pvh->pvh_first;
s = splvm();
#ifdef DEBUG
if (pmapdebug & PDB_ENTER)
@@ -1055,7 +1052,6 @@
pv->pv_next = NULL;
pv->pv_ptste = NULL;
pv->pv_ptpmap = NULL;
- pv->pv_flags = 0;
}
/*
* There is at least one other VA mapping this page.
@@ -1278,10 +1274,12 @@
while (sva < nssva) {
if (pmap_pte_v(pte)) {
#ifdef DEBUG
+ struct pv_header *pvh;
struct pv_entry *pv;
int s;
- pv = pa_to_pvh(pmap_pte_pa(pte));
+ pvh = pa_to_pvh(pmap_pte_pa(pte));
+ pv = &pvh->pvh_first;
s = splvm();
while (pv->pv_pmap != NULL) {
KASSERT(pv->pv_pmap != pmap_kernel() ||
@@ -1472,6 +1470,7 @@
pmap_collect1(pmap_t pmap, paddr_t startpa, paddr_t endpa)
{
paddr_t pa;
+ struct pv_header *pvh;
struct pv_entry *pv;
pt_entry_t *pte;
paddr_t kpa;
@@ -1487,8 +1486,10 @@
* Locate physical pages which are being used as kernel
* page table pages.
*/
- pv = pa_to_pvh(pa);
- if (pv->pv_pmap != pmap_kernel() || !(pv->pv_flags & PV_PTPAGE))
+ pvh = pa_to_pvh(pa);
+ pv = &pvh->pvh_first;
+ if (pv->pv_pmap != pmap_kernel() ||
+ !(pvh->pvh_attrs & PVH_PTPAGE))
continue;
do {
if (pv->pv_ptste && pv->pv_ptpmap == pmap_kernel())
@@ -1812,6 +1813,7 @@
pmap_remove_mapping(pmap_t pmap, vaddr_t va, pt_entry_t *pte, int flags)
{
paddr_t pa;
+ struct pv_header *pvh;
struct pv_entry *pv, *npv;
pmap_t ptpmap;
st_entry_t *ste;
@@ -1878,6 +1880,7 @@
*/
if (refs == 0 && (flags & PRM_KEEPPTPAGE) == 0) {
#ifdef DIAGNOSTIC
+ struct pv_header *_pvh;
struct pv_entry *_pv;
#endif
paddr_t _pa;
@@ -1886,7 +1889,8 @@
#ifdef DIAGNOSTIC
if (PAGE_IS_MANAGED(_pa) == 0)
panic("pmap_remove_mapping: unmanaged PT page");
- _pv = pa_to_pvh(_pa);
+ _pvh = pa_to_pvh(_pa);
+ _pv = &_pvh->pvh_first;
if (_pv->pv_ptste == NULL)
panic("pmap_remove_mapping: ptste == NULL");
if (_pv->pv_pmap != pmap_kernel() ||
@@ -1918,7 +1922,8 @@
* Otherwise remove it from the PV table
* (raise IPL since we may be called at interrupt time).
*/
- pv = pa_to_pvh(pa);
+ pvh = pa_to_pvh(pa);
+ pv = &pvh->pvh_first;
ste = ST_ENTRY_NULL;
s = splvm();
/*
@@ -1932,7 +1937,6 @@
ptpmap = pv->pv_ptpmap;
npv = pv->pv_next;
if (npv) {
- npv->pv_flags = pv->pv_flags;
*pv = *npv;
pmap_free_pv(npv);
} else
@@ -1957,7 +1961,8 @@
ptpmap = npv->pv_ptpmap;
pv->pv_next = npv->pv_next;
pmap_free_pv(npv);
- pv = pa_to_pvh(pa);
+ pvh = pa_to_pvh(pa);
+ pv = &pvh->pvh_first;
}
/*
@@ -2040,13 +2045,13 @@
else
TBIAU();
#endif
- pv->pv_flags &= ~PV_PTPAGE;
+ pvh->pvh_attrs &= ~PVH_PTPAGE;
ptpmap->pm_ptpages--;
}
/*
* Update saved attributes for managed page
*/
- *pa_to_attribute(pa) |= bits;
+ pvh->pvh_attrs |= bits;
splx(s);
}
@@ -2088,18 +2093,20 @@
bool
pmap_testbit(paddr_t pa, int bit)
{
+ struct pv_header *pvh;
struct pv_entry *pv;
int *pte;
int s;
- pv = pa_to_pvh(pa);
+ pvh = pa_to_pvh(pa);
+ pv = &pvh->pvh_first;
s = splvm();
/*
* Check saved info first
*/
- if (*pa_to_attribute(pa) & bit) {
Home |
Main Index |
Thread Index |
Old Index