diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2001-07-18 10:47:06 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2001-07-18 10:47:06 +0000 |
commit | 7014e9bdb5c2bbd8611c221808ec547e916bbb79 (patch) | |
tree | 696ce0ce037cffc3cf643967ca0d7b194de7df7a /sys/arch/mac68k | |
parent | 33fbe5eea52c9938f6f888b886db7cbe2583b9d3 (diff) |
Get rid of the PMAP_NEW option by making it mandatory for all archs.
The archs that didn't have a proper PMAP_NEW now have a dummy implementation
with wrappers around the old functions.
Diffstat (limited to 'sys/arch/mac68k')
-rw-r--r-- | sys/arch/mac68k/mac68k/pmap.c | 78 |
1 files changed, 55 insertions, 23 deletions
diff --git a/sys/arch/mac68k/mac68k/pmap.c b/sys/arch/mac68k/mac68k/pmap.c index a97f05d39d0..72b9f2655d3 100644 --- a/sys/arch/mac68k/mac68k/pmap.c +++ b/sys/arch/mac68k/mac68k/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.25 2001/06/27 04:22:38 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.26 2001/07/18 10:47:04 art Exp $ */ /* $NetBSD: pmap.c,v 1.55 1999/04/22 04:24:53 chs Exp $ */ /* @@ -663,21 +663,14 @@ pmap_map(va, spa, epa, prot) * * Note: no locking is necessary in this function. */ -pmap_t -pmap_create(size) - vsize_t size; +struct pmap * +pmap_create(void) { - pmap_t pmap; + struct pmap *pmap; PMAP_DPRINTF(PDB_FOLLOW|PDB_CREATE, ("pmap_create(%lx)\n", size)); - /* - * Software use map does not need a pmap - */ - if (size) - return (NULL); - pmap = pool_get(&pmap_pmap_pool, PR_WAITOK); bzero(pmap, sizeof(*pmap)); @@ -896,13 +889,14 @@ pmap_remove(pmap, sva, eva) * the permissions specified. */ void -pmap_page_protect(pa, prot) - paddr_t pa; - vm_prot_t prot; +pmap_page_protect(struct vm_page *pg, vm_prot_t prot) { + paddr_t pa; struct pv_entry *pv; int s; + pa = VM_PAGE_TO_PHYS(pg); + #ifdef DEBUG if ((pmapdebug & (PDB_FOLLOW|PDB_PROTECT)) || (prot == VM_PROT_NONE && (pmapdebug & PDB_REMOVE))) @@ -1654,14 +1648,19 @@ pmap_copy_page(src, dst) * * Clear the modify bits on the specified physical page. */ -void -pmap_clear_modify(pa) - paddr_t pa; +boolean_t +pmap_clear_modify(struct vm_page *pg) { + paddr_t pa = VM_PAGE_TO_PHYS(pg); + boolean_t ret; + + ret = pmap_is_modified(pg); PMAP_DPRINTF(PDB_FOLLOW, ("pmap_clear_modify(%lx)\n", pa)); pmap_changebit(pa, 0, ~PG_M); + + return (ret); } /* @@ -1670,13 +1669,18 @@ pmap_clear_modify(pa) * Clear the reference bit on the specified physical page. */ void -pmap_clear_reference(pa) - paddr_t pa; +pmap_clear_reference(struct vm_page *pg) { + paddr_t pa = VM_PAGE_TO_PHYS(pg); + boolean_t ret; + + ret = pmap_is_referenced(pg); PMAP_DPRINTF(PDB_FOLLOW, ("pmap_clear_reference(%lx)\n", pa)); pmap_changebit(pa, 0, ~PG_U); + + return (ret); } /* @@ -1686,9 +1690,10 @@ pmap_clear_reference(pa) * by any physical maps. */ boolean_t -pmap_is_referenced(pa) - paddr_t pa; +pmap_is_referenced(struct vm_page *pg) { + paddr_t pa = VM_PAGE_TO_PHYS(pg); + #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) { boolean_t rv = pmap_testbit(pa, PG_U); @@ -1706,9 +1711,10 @@ pmap_is_referenced(pa) * by any physical maps. */ boolean_t -pmap_is_modified(pa) - paddr_t pa; +pmap_is_modified(struct vm_page *pg) { + paddr_t pa = VM_PAGE_TO_PHYS(pg); + #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) { boolean_t rv = pmap_testbit(pa, PG_M); @@ -2352,3 +2358,29 @@ pmap_check_wiring(str, va) str, va, entry->wired_count, count); } #endif /* DEBUG */ + +void +pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot) +{ + pmap_enter(pmap_kernel(), va, pa, prot, 1, VM_PROT_READ|VM_PROT_WRITE); +} + +void +pmap_kenter_pgs(vaddr_t va, struct vm_page **pgs, int npgs) +{ + int i; + + for (i = 0; i < npgs; i++, va += PAGE_SIZE) { + pmap_enter(pmap_kernel(), va, VM_PAGE_TO_PHYS(pgs[i]), + VM_PROT_READ|VM_PROT_WRITE, 1, + VM_PROT_READ|VM_PROT_WRITE); + } +} + +void +pmap_kremove(vaddr_t va, vsize_t len) +{ + for (len >>= PAGE_SHIFT; len > 0; len--, va += PAGE_SIZE) { + pmap_remove(pmap_kernel(), va, va + PAGE_SIZE); + } +} |