diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2002-09-10 18:29:45 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2002-09-10 18:29:45 +0000 |
commit | dc9f06d0330e3e7e4470e3ea0dc68bebaef4bff9 (patch) | |
tree | 1503c1f1af5126456f6dc9827abc9b960308687f /sys/arch | |
parent | 7730c554bf1c303d60002833793768dbd9a6a681 (diff) |
Change the pmap_zero_page and pmap_copy_page API to take the struct vm_page *
instead of the pa. Most callers already had it handy and those who didn't
only called it for managed pages and were outside time-critical code.
This will allow us to make those functions clean and fast on sparc and
sparc64 letting us to avoid unnecessary cache flushes.
deraadt@ miod@ drahn@ ok.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/alpha/alpha/pmap.c | 13 | ||||
-rw-r--r-- | sys/arch/amiga/amiga/pmap.c | 11 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/pmap.c | 13 | ||||
-rw-r--r-- | sys/arch/i386/i386/pmap.c | 17 | ||||
-rw-r--r-- | sys/arch/m68k/m68k/pmap_motorola.c | 12 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/pmap.c | 11 | ||||
-rw-r--r-- | sys/arch/powerpc/powerpc/pmap.c | 9 | ||||
-rw-r--r-- | sys/arch/sparc/include/pmap.h | 14 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/pmap.c | 24 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/locore.s | 6 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/pmap.c | 39 | ||||
-rw-r--r-- | sys/arch/sun3/sun3/pmap.c | 11 | ||||
-rw-r--r-- | sys/arch/vax/include/pmap.h | 21 |
13 files changed, 121 insertions, 80 deletions
diff --git a/sys/arch/alpha/alpha/pmap.c b/sys/arch/alpha/alpha/pmap.c index 80444e3e27c..92f2ca2c30c 100644 --- a/sys/arch/alpha/alpha/pmap.c +++ b/sys/arch/alpha/alpha/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.35 2002/07/24 00:33:49 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.36 2002/09/10 18:29:42 art Exp $ */ /* $NetBSD: pmap.c,v 1.154 2000/12/07 22:18:55 thorpej Exp $ */ /*- @@ -2355,8 +2355,9 @@ pmap_deactivate(struct proc *p) * Note: no locking is necessary in this function. */ void -pmap_zero_page(paddr_t phys) +pmap_zero_page(struct vm_page *pg) { + paddr_t phys = VM_PAGE_TO_PHYS(pg); u_long *p0, *p1, *pend; #ifdef DEBUG @@ -2410,8 +2411,10 @@ pmap_zero_page(paddr_t phys) * Note: no locking is necessary in this function. */ void -pmap_copy_page(paddr_t src, paddr_t dst) +pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg) { + paddr_t src = VM_PAGE_TO_PHYS(srcpg); + paddr_t dst = VM_PAGE_TO_PHYS(dstpg); caddr_t s, d; #ifdef DEBUG @@ -3722,11 +3725,11 @@ pmap_ptpage_free(pmap_t pmap, pt_entry_t *pte, pt_entry_t **ptp) * zero it, and return the KSEG address of the page. */ if (ptp != NULL) { - pmap_zero_page(ptpa); + pmap_zero_page(PHYS_TO_VM_PAGE(ptpa)); *ptp = (pt_entry_t *)ALPHA_PHYS_TO_K0SEG(ptpa); } else { #ifdef DEBUG - pmap_zero_page(ptpa); + pmap_zero_page(PHYS_TO_VM_PAGE(ptpa)); #endif pmap_physpage_free(ptpa); } diff --git a/sys/arch/amiga/amiga/pmap.c b/sys/arch/amiga/amiga/pmap.c index e7cb023231a..a2debb1fba8 100644 --- a/sys/arch/amiga/amiga/pmap.c +++ b/sys/arch/amiga/amiga/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.49 2002/05/28 14:29:05 deraadt Exp $ */ +/* $OpenBSD: pmap.c,v 1.50 2002/09/10 18:29:43 art Exp $ */ /* $NetBSD: pmap.c,v 1.68 1999/06/19 19:44:09 is Exp $ */ /*- @@ -1665,9 +1665,9 @@ pmap_deactivate(p) * at a time. */ void -pmap_zero_page(phys) - paddr_t phys; +pmap_zero_page(struct vm_page *pg) { + paddr_t phys = VM_PAGE_TO_PHYS(pg); #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) printf("pmap_zero_page(%lx)\n", phys); @@ -1683,9 +1683,10 @@ pmap_zero_page(phys) * time. */ void -pmap_copy_page(src, dst) - paddr_t src, dst; +pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg) { + paddr_t src = VM_PAGE_TO_PHYS(srcpg); + paddr_t dst = VM_PAGE_TO_PHYS(dstpg); #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) printf("pmap_copy_page(%lx, %lx)\n", src, dst); diff --git a/sys/arch/hppa/hppa/pmap.c b/sys/arch/hppa/hppa/pmap.c index ee71e0eac1f..ce5b70accd2 100644 --- a/sys/arch/hppa/hppa/pmap.c +++ b/sys/arch/hppa/hppa/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.81 2002/09/05 18:41:19 mickey Exp $ */ +/* $OpenBSD: pmap.c,v 1.82 2002/09/10 18:29:43 art Exp $ */ /* * Copyright (c) 1998-2002 Michael Shalayeff @@ -1178,9 +1178,10 @@ pmap_flush_page(paddr_t pa, int purge) } void -pmap_zero_page(pa) - paddr_t pa; +pmap_zero_page(struct vm_page *pg) { + paddr_t pa = VM_PAGE_TO_PHYS(pg); + DPRINTF(PDB_FOLLOW|PDB_PHYS, ("pmap_zero_page(%x)\n", pa)); pmap_flush_page(pa, 1); @@ -1189,10 +1190,10 @@ pmap_zero_page(pa) } void -pmap_copy_page(spa, dpa) - paddr_t spa; - paddr_t dpa; +pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg) { + paddr_t spa = VM_PAGE_TO_PHYS(srcpg); + paddr_t dpa = VM_PAGE_TO_PHYS(dstpg); DPRINTF(PDB_FOLLOW|PDB_PHYS, ("pmap_copy_page(%x, %x)\n", spa, dpa)); pmap_flush_page(spa, 0); diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c index 133fd36fe41..357803d93fe 100644 --- a/sys/arch/i386/i386/pmap.c +++ b/sys/arch/i386/i386/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.61 2002/07/31 07:21:04 aaron Exp $ */ +/* $OpenBSD: pmap.c,v 1.62 2002/09/10 18:29:43 art Exp $ */ /* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */ /* @@ -1535,7 +1535,7 @@ pmap_alloc_ptp(pmap, pde_index, just_try) return (NULL); } /* stole one; zero it. */ - pmap_zero_page(VM_PAGE_TO_PHYS(ptp)); + pmap_zero_page(ptp); } /* got one! */ @@ -2022,9 +2022,10 @@ pmap_virtual_space(startp, endp) */ void -pmap_zero_page(pa) - paddr_t pa; +pmap_zero_page(struct vm_page *pg) { + paddr_t pa = VM_PAGE_TO_PHYS(pg); + simple_lock(&pmap_zero_page_lock); #ifdef DIAGNOSTIC if (*zero_pte) @@ -2067,9 +2068,11 @@ pmap_zero_page_uncached(pa) */ void -pmap_copy_page(srcpa, dstpa) - paddr_t srcpa, dstpa; +pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg) { + paddr_t srcpa = VM_PAGE_TO_PHYS(srcpg); + paddr_t dstpa = VM_PAGE_TO_PHYS(dstpg); + simple_lock(&pmap_copy_page_lock); #ifdef DIAGNOSTIC if (*csrc_pte || *cdst_pte) @@ -3610,7 +3613,7 @@ pmap_growkernel(maxkvaddr) if (uvm_page_physget(&ptaddr) == FALSE) panic("pmap_growkernel: out of memory"); - pmap_zero_page(ptaddr); + pmap_zero_page(PHYS_TO_VM_PAGE(ptaddr)); kpm->pm_pdir[PDSLOT_KERN + nkpde] = ptaddr | PG_RW | PG_V; diff --git a/sys/arch/m68k/m68k/pmap_motorola.c b/sys/arch/m68k/m68k/pmap_motorola.c index 269eea75365..20afbbbb606 100644 --- a/sys/arch/m68k/m68k/pmap_motorola.c +++ b/sys/arch/m68k/m68k/pmap_motorola.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap_motorola.c,v 1.19 2002/06/02 22:16:52 miod Exp $ */ +/* $OpenBSD: pmap_motorola.c,v 1.20 2002/09/10 18:29:43 art Exp $ */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -1880,9 +1880,9 @@ ok: * Note: WE DO NOT CURRENTLY LOCK THE TEMPORARY ADDRESSES! */ void -pmap_zero_page(phys) - paddr_t phys; +pmap_zero_page(struct vm_page *pg) { + paddr_t phys = VM_PAGE_TO_PHYS(pg); int npte; PMAP_DPRINTF(PDB_FOLLOW, ("pmap_zero_page(%lx)\n", phys)); @@ -1930,9 +1930,11 @@ pmap_zero_page(phys) * Note: WE DO NOT CURRENTLY LOCK THE TEMPORARY ADDRESSES! */ void -pmap_copy_page(src, dst) - paddr_t src, dst; +pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg) { + paddr_t src = VM_PAGE_TO_PHYS(srcpg); + paddr_t dst = VM_PAGE_TO_PHYS(dstpg); + int npte1, npte2; PMAP_DPRINTF(PDB_FOLLOW, ("pmap_copy_page(%lx, %lx)\n", src, dst)); diff --git a/sys/arch/mvme88k/mvme88k/pmap.c b/sys/arch/mvme88k/mvme88k/pmap.c index 31ef3af7461..337e377d4db 100644 --- a/sys/arch/mvme88k/mvme88k/pmap.c +++ b/sys/arch/mvme88k/mvme88k/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.66 2002/05/07 00:54:37 miod Exp $ */ +/* $OpenBSD: pmap.c,v 1.67 2002/09/10 18:29:43 art Exp $ */ /* * Copyright (c) 2001, 2002 Miodrag Vallat * Copyright (c) 1998-2001 Steve Murphree, Jr. @@ -1228,9 +1228,9 @@ pmap_init(void) * mappings effective, and zeros all the bits. */ void -pmap_zero_page(phys) - paddr_t phys; +pmap_zero_page(struct vm_page *pg) { + paddr_t phys = VM_PAGE_TO_PHYS(pg); vaddr_t srcva; int spl; int cpu; @@ -2751,9 +2751,10 @@ pmap_deactivate(p) * new mappings effective, and performs the copy. */ void -pmap_copy_page(src, dst) - paddr_t src, dst; +pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg) { + paddr_t src = VM_PAGE_TO_PHYS(srcpg); + paddr_t dst = VM_PAGE_TO_PHYS(dstpg); vaddr_t dstva, srcva; int spl; pt_entry_t template, *dstpte, *srcpte; diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c index eaf45ef032e..94dc5b44a97 100644 --- a/sys/arch/powerpc/powerpc/pmap.c +++ b/sys/arch/powerpc/powerpc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.73 2002/07/24 02:19:28 drahn Exp $ */ +/* $OpenBSD: pmap.c,v 1.74 2002/09/10 18:29:43 art Exp $ */ /* * Copyright (c) 2001, 2002 Dale Rahn. All rights reserved. @@ -989,8 +989,9 @@ pmap_collect(pmap_t pm) * Fill the given physical page with zeros. */ void -pmap_zero_page(paddr_t pa) +pmap_zero_page(struct vm_page *pg) { + paddr_t pa = VM_PAGE_TO_PHYS(pg); #ifdef USE_DCBZ int i; paddr_t addr = zero_page; @@ -1015,8 +1016,10 @@ pmap_zero_page(paddr_t pa) * copy the given physical page with zeros. */ void -pmap_copy_page(paddr_t srcpa, paddr_t dstpa) +pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg) { + paddr_t srcpa = VM_PAGE_TO_PHYS(srcpg); + paddr_t dstpa = VM_PAGE_TO_PHYS(dstpg); /* simple_lock(&pmap_copy_page_lock); */ pmap_kenter_pa(copy_src_page, srcpa, VM_PROT_READ); diff --git a/sys/arch/sparc/include/pmap.h b/sys/arch/sparc/include/pmap.h index 2a03b363b8f..d4bc88aba33 100644 --- a/sys/arch/sparc/include/pmap.h +++ b/sys/arch/sparc/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.32 2002/03/14 03:16:00 millert Exp $ */ +/* $OpenBSD: pmap.h,v 1.33 2002/09/10 18:29:43 art Exp $ */ /* $NetBSD: pmap.h,v 1.30 1997/08/04 20:00:47 pk Exp $ */ /* @@ -315,7 +315,6 @@ void pmap_writetext(unsigned char *, int); #if defined(SUN4) || defined(SUN4C) boolean_t pmap_clear_modify4_4c(struct vm_page *); boolean_t pmap_clear_reference4_4c(struct vm_page *); -void pmap_copy_page4_4c(paddr_t, paddr_t); int pmap_enter4_4c(pmap_t, vaddr_t, paddr_t, vm_prot_t, int); boolean_t pmap_extract4_4c(pmap_t, vaddr_t, paddr_t *); boolean_t pmap_is_modified4_4c(struct vm_page *); @@ -324,7 +323,8 @@ void pmap_kenter_pa4_4c(vaddr_t, paddr_t, vm_prot_t); void pmap_kremove4_4c(vaddr_t, vsize_t); void pmap_page_protect4_4c(struct vm_page *, vm_prot_t); void pmap_protect4_4c(pmap_t, vaddr_t, vaddr_t, vm_prot_t); -void pmap_zero_page4_4c(paddr_t); +void pmap_copy_page4_4c(struct vm_page *, struct vm_page *); +void pmap_zero_page4_4c(struct vm_page *); void pmap_changeprot4_4c(pmap_t, vaddr_t, vm_prot_t, int); #endif @@ -333,7 +333,6 @@ void pmap_changeprot4_4c(pmap_t, vaddr_t, vm_prot_t, int); #if defined(SUN4M) boolean_t pmap_clear_modify4m(struct vm_page *); boolean_t pmap_clear_reference4m(struct vm_page *); -void pmap_copy_page4m(paddr_t, paddr_t); int pmap_enter4m(pmap_t, vaddr_t, paddr_t, vm_prot_t, int); boolean_t pmap_extract4m(pmap_t, vaddr_t, paddr_t *); boolean_t pmap_is_modified4m(struct vm_page *); @@ -342,7 +341,8 @@ void pmap_kenter_pa4m(vaddr_t, paddr_t, vm_prot_t); void pmap_kremove4m(vaddr_t, vsize_t); void pmap_page_protect4m(struct vm_page *, vm_prot_t); void pmap_protect4m(pmap_t, vaddr_t, vaddr_t, vm_prot_t); -void pmap_zero_page4m(paddr_t); +void pmap_copy_page4m(struct vm_page *, struct vm_page *); +void pmap_zero_page4m(struct vm_page *); void pmap_changeprot4m(pmap_t, vaddr_t, vm_prot_t, int); #endif /* defined SUN4M */ @@ -382,7 +382,6 @@ void pmap_changeprot4m(pmap_t, vaddr_t, vm_prot_t, int); extern boolean_t (*pmap_clear_modify_p)(struct vm_page *); extern boolean_t (*pmap_clear_reference_p)(struct vm_page *); -extern void (*pmap_copy_page_p)(paddr_t, paddr_t); extern int (*pmap_enter_p)(pmap_t, vaddr_t, paddr_t, vm_prot_t, int); extern boolean_t (*pmap_extract_p)(pmap_t, vaddr_t, paddr_t *); @@ -394,7 +393,8 @@ extern void (*pmap_page_protect_p)(struct vm_page *, vm_prot_t); extern void (*pmap_protect_p)(pmap_t, vaddr_t, vaddr_t, vm_prot_t); -extern void (*pmap_zero_page_p)(paddr_t); +extern void (*pmap_copy_page_p)(struct vm_page *, struct vm_page *); +extern void (*pmap_zero_page_p)(struct vm_page *); extern void (*pmap_changeprot_p)(pmap_t, vaddr_t, vm_prot_t, int); diff --git a/sys/arch/sparc/sparc/pmap.c b/sys/arch/sparc/sparc/pmap.c index 0a6d2ad1d3e..8835f82b675 100644 --- a/sys/arch/sparc/sparc/pmap.c +++ b/sys/arch/sparc/sparc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.128 2002/09/06 22:46:48 art Exp $ */ +/* $OpenBSD: pmap.c,v 1.129 2002/09/10 18:29:43 art Exp $ */ /* $NetBSD: pmap.c,v 1.118 1998/05/19 19:00:18 thorpej Exp $ */ /* @@ -511,7 +511,6 @@ void pv_unlink4_4c(struct pvlist *, struct pmap *, vaddr_t); /* from pmap.h: */ boolean_t (*pmap_clear_modify_p)(struct vm_page *); boolean_t (*pmap_clear_reference_p)(struct vm_page *); -void (*pmap_copy_page_p)(paddr_t, paddr_t); int (*pmap_enter_p)(pmap_t, vaddr_t, paddr_t, vm_prot_t, int); boolean_t (*pmap_extract_p)(pmap_t, vaddr_t, paddr_t *); boolean_t (*pmap_is_modified_p)(struct vm_page *); @@ -520,7 +519,8 @@ void (*pmap_kenter_pa_p)(vaddr_t, paddr_t, vm_prot_t); void (*pmap_kremove_p)(vaddr_t, vsize_t); void (*pmap_page_protect_p)(struct vm_page *, vm_prot_t); void (*pmap_protect_p)(pmap_t, vaddr_t, vaddr_t, vm_prot_t); -void (*pmap_zero_page_p)(paddr_t); +void (*pmap_copy_page_p)(struct vm_page *, struct vm_page *); +void (*pmap_zero_page_p)(struct vm_page *); void (*pmap_changeprot_p)(pmap_t, vaddr_t, vm_prot_t, int); /* local: */ void (*pmap_rmk_p)(struct pmap *, vaddr_t, vaddr_t, int, int); @@ -5920,9 +5920,9 @@ pmap_is_referenced4m(pg) #if defined(SUN4) || defined(SUN4C) void -pmap_zero_page4_4c(pa) - paddr_t pa; +pmap_zero_page4_4c(struct vm_page *pg) { + paddr_t pa = VM_PAGE_TO_PHYS(pg); caddr_t va; int pte; struct pvlist *pv; @@ -5953,9 +5953,10 @@ pmap_zero_page4_4c(pa) * the processor. */ void -pmap_copy_page4_4c(src, dst) - paddr_t src, dst; +pmap_copy_page4_4c(struct vm_page *srcpg, struct vm_page *dstpg) { + paddr_t src = VM_PAGE_TO_PHYS(srcpg); + paddr_t dst = VM_PAGE_TO_PHYS(dstpg); caddr_t sva, dva; int spte, dpte; struct pvlist *pv; @@ -5991,9 +5992,9 @@ pmap_copy_page4_4c(src, dst) * XXX might be faster to use destination's context and allow cache to fill? */ void -pmap_zero_page4m(pa) - paddr_t pa; +pmap_zero_page4m(struct vm_page *pg) { + paddr_t pa = VM_PAGE_TO_PHYS(pg); int pte; struct pvlist *pv; static int *ptep; @@ -6036,9 +6037,10 @@ pmap_zero_page4m(pa) * the processor. */ void -pmap_copy_page4m(src, dst) - paddr_t src, dst; +pmap_copy_page4m(struct vm_page *srcpg, struct vm_page *dstpg) { + paddr_t src = VM_PAGE_TO_PHYS(srcpg); + paddr_t dst = VM_PAGE_TO_PHYS(dstpg); int spte, dpte; struct pvlist *pv; static int *sptep, *dptep; diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s index 3d8957680e6..1b93f3b9607 100644 --- a/sys/arch/sparc64/sparc64/locore.s +++ b/sys/arch/sparc64/sparc64/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.24 2002/07/31 01:40:17 jason Exp $ */ +/* $OpenBSD: locore.s,v 1.25 2002/09/10 18:29:44 art Exp $ */ /* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */ /* @@ -8052,7 +8052,7 @@ ENTRY(probeset) paginuse: .word 0 .text -ENTRY(pmap_zero_page) +ENTRY(pmap_zero_phys) !! !! If we have 64-bit physical addresses (and we do now) !! we need to move the pointer from %o0:%o1 to %o0 @@ -8342,7 +8342,7 @@ pmap_zero_phys: * We also need to blast the D$ and flush like * pmap_zero_page. */ -ENTRY(pmap_copy_page) +ENTRY(pmap_copy_phys) !! !! If we have 64-bit physical addresses (and we do now) !! we need to move the pointer from %o0:%o1 to %o0 and diff --git a/sys/arch/sparc64/sparc64/pmap.c b/sys/arch/sparc64/sparc64/pmap.c index 252018fee75..f8819ca183e 100644 --- a/sys/arch/sparc64/sparc64/pmap.c +++ b/sys/arch/sparc64/sparc64/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.16 2002/08/20 19:28:55 jason Exp $ */ +/* $OpenBSD: pmap.c,v 1.17 2002/09/10 18:29:44 art Exp $ */ /* $NetBSD: pmap.c,v 1.107 2001/08/31 16:47:41 eeh Exp $ */ #undef NO_VCACHE /* Don't forget the locked TLB in dostart */ /* @@ -174,6 +174,9 @@ static paddr_t pseg_find(struct pmap* pm, vaddr_t addr, paddr_t spare) { extern struct vm_page *vm_page_alloc1(void); extern void vm_page_free1(struct vm_page *); +/* XXX - temporary workaround for pmap_{copy,zero}_page api change */ +void pmap_zero_phys(paddr_t pa); +void pmap_copy_phys(paddr_t src, paddr_t dst); #ifdef DEBUG #ifdef __STDC__ @@ -487,7 +490,7 @@ pmap_enter_kpage(va, data) prom_printf("pmap_enter_kpage: out of pages\n"); panic("pmap_enter_kpage"); } - pmap_zero_page(newp); + pmap_zero_phys(newp); #ifdef DEBUG enter_stats.ptpneeded ++; #endif @@ -1234,7 +1237,7 @@ remap_data: { paddr_t p; for (p = mp->start; p < mp->start+mp->size; p += NBPG) - pmap_zero_page(p); + pmap_zero_phys(p); } #endif /* @@ -1281,7 +1284,7 @@ remap_data: do { pmap_get_page(&newp); - pmap_zero_page(newp); + pmap_zero_phys(newp); } while (!newp); /* Throw away page zero */ pmap_kernel()->pm_segs=(int64_t *)(u_long)newp; pmap_kernel()->pm_physaddr = newp; @@ -1379,7 +1382,7 @@ remap_data: int64_t data; pmap_get_page(&pa); - pmap_zero_page(pa); + pmap_zero_phys(pa); prom_map_phys(pa, NBPG, vmmap, -1); data = TSB_DATA(0 /* global */, PGSZ_8K, @@ -1503,7 +1506,7 @@ pmap_init() u_int64_t data; pa = VM_PAGE_TO_PHYS(m); - pmap_zero_page(pa); + pmap_zero_page(m); data = TSB_DATA(0 /* global */, PGSZ_8K, pa, @@ -1604,7 +1607,7 @@ pmap_growkernel(maxkvaddr) } pg = (paddr_t)VM_PAGE_TO_PHYS(page); } - pmap_zero_page((paddr_t)pg); + pmap_zero_phys((paddr_t)pg); #ifdef DEBUG enter_stats.ptpneeded ++; #endif @@ -1666,7 +1669,7 @@ pmap_pinit(pm) uvm_wait("pmap_pinit"); } pm->pm_physaddr = (paddr_t)VM_PAGE_TO_PHYS(page); - pmap_zero_page(pm->pm_physaddr); + pmap_zero_phys(pm->pm_physaddr); pm->pm_segs = (int64_t *)(u_long)pm->pm_physaddr; if (!pm->pm_physaddr) panic("pmap_pinit"); #ifdef NOTDEF_DEBUG @@ -1875,6 +1878,22 @@ pmap_collect(pm) #endif } +void +pmap_zero_page(struct vm_page *pg) +{ + + pmap_zero_phys(VM_PAGE_TO_PHYS(pg)); +} + +void +pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg) +{ + paddr_t src = VM_PAGE_TO_PHYS(srcpg); + paddr_t dst = VM_PAGE_TO_PHYS(dstpg); + + pmap_copy_phys(src, dst); +} + #if 0 /* * The two following routines are now in locore.s so I can code them in assembly @@ -2014,7 +2033,7 @@ pmap_kenter_pa(va, pa, prot) } pg = (paddr_t)VM_PAGE_TO_PHYS(page); } - pmap_zero_page((paddr_t)pg); + pmap_zero_phys((paddr_t)pg); #ifdef DEBUG enter_stats.ptpneeded ++; #endif @@ -2244,7 +2263,7 @@ pmap_enter(pm, va, pa, prot, flags) } pg = (paddr_t)VM_PAGE_TO_PHYS(page); } - pmap_zero_page((paddr_t)pg); + pmap_zero_phys((paddr_t)pg); #ifdef DEBUG enter_stats.ptpneeded ++; #endif diff --git a/sys/arch/sun3/sun3/pmap.c b/sys/arch/sun3/sun3/pmap.c index f2ba5a2fd41..dc55729c455 100644 --- a/sys/arch/sun3/sun3/pmap.c +++ b/sys/arch/sun3/sun3/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.35 2002/03/14 01:26:47 millert Exp $ */ +/* $OpenBSD: pmap.c,v 1.36 2002/09/10 18:29:44 art Exp $ */ /* $NetBSD: pmap.c,v 1.64 1996/11/20 18:57:35 gwr Exp $ */ /*- @@ -3127,9 +3127,10 @@ pmap_resident_pages(pmap) * time. */ void -pmap_copy_page(src, dst) - vm_offset_t src, dst; +pmap_copy_page(struct vm_page *srcpg, struct vm_page *dstpg) { + paddr_t src = VM_PAGE_TO_PHYS(srcpg); + paddr_t dst = VM_PAGE_TO_PHYS(dstpg); int pte; int s; @@ -3168,9 +3169,9 @@ pmap_copy_page(src, dst) * at a time. */ void -pmap_zero_page(pa) - vm_offset_t pa; +pmap_zero_page(struct vm_page *pg) { + paddr_t pa = VM_PAGE_TO_PHYS(pg); int pte; int s; diff --git a/sys/arch/vax/include/pmap.h b/sys/arch/vax/include/pmap.h index 84b4a37ca3b..cf0b83594ff 100644 --- a/sys/arch/vax/include/pmap.h +++ b/sys/arch/vax/include/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.16 2002/03/14 01:26:48 millert Exp $ */ +/* $OpenBSD: pmap.h,v 1.17 2002/09/10 18:29:44 art Exp $ */ /* $NetBSD: pmap.h,v 1.37 1999/08/01 13:48:07 ragge Exp $ */ /* @@ -132,14 +132,19 @@ extern struct pmap kernel_pmap_store; #define pmap_reference(pmap) (pmap)->ref_count++ /* These can be done as efficient inline macros */ -#define pmap_copy_page(src, dst) \ +#define pmap_copy_page(srcpg, dstpg) do { \ + paddr_t __src = VM_PAGE_TO_PHYS(srcpg); \ + paddr_t __dst = VM_PAGE_TO_PHYS(dstpg); \ __asm__("addl3 $0x80000000,%0,r0;addl3 $0x80000000,%1,r1; \ - movc3 $4096,(r0),(r1)" \ - :: "r"(src),"r"(dst):"r0","r1","r2","r3","r4","r5"); - -#define pmap_zero_page(phys) \ - __asm__("addl3 $0x80000000,%0,r0;movc5 $0,(r0),$0,$4096,(r0)" \ - :: "r"(phys): "r0","r1","r2","r3","r4","r5"); + movc3 $4096,(r0),(r1)" \ + :: "r"(__src),"r"(__dst):"r0","r1","r2","r3","r4","r5"); \ +} while (0) + +#define pmap_zero_page(pg) do { \ + paddr_t __pa = VM_PAGE_TO_PHYS(pg); \ + __asm__("addl3 $0x80000000,%0,r0;movc5 $0,(r0),$0,$4096,(r0)" \ + :: "r"(__pa): "r0","r1","r2","r3","r4","r5"); \ +} while (0) /* Prototypes */ void pmap_bootstrap(void); |