From 44509f207ffb90a4c042b0c0dc5a3e9d028286e1 Mon Sep 17 00:00:00 2001 From: alc Date: Sun, 29 Jun 2003 21:20:04 +0000 Subject: [PATCH] - Export pmap_enter_quick() to the MI VM. This will permit the implementation of a largely MI pmap_object_init_pt() for vnode-backed objects. pmap_enter_quick() is implemented via pmap_enter() on sparc64 and powerpc. - Correct a mismatch between pmap_object_init_pt()'s prototype and its various implementations. (I plan to keep pmap_object_init_pt() as the MD hook for device-backed objects on i386 and amd64.) - Correct an error in ia64's pmap_enter_quick() and adjust its interface to match the other versions. Discussed with: marcel --- sys/alpha/alpha/pmap.c | 4 +--- sys/amd64/amd64/pmap.c | 4 +--- sys/i386/i386/pmap.c | 4 +--- sys/ia64/ia64/pmap.c | 18 ++++++++++-------- sys/powerpc/aim/mmu_oea.c | 8 ++++++++ sys/powerpc/powerpc/mmu_oea.c | 8 ++++++++ sys/powerpc/powerpc/pmap.c | 8 ++++++++ sys/sparc64/sparc64/pmap.c | 8 ++++++++ sys/vm/pmap.h | 4 +++- 9 files changed, 48 insertions(+), 18 deletions(-) diff --git a/sys/alpha/alpha/pmap.c b/sys/alpha/alpha/pmap.c index d4166a3ff995..27667975c0f3 100644 --- a/sys/alpha/alpha/pmap.c +++ b/sys/alpha/alpha/pmap.c @@ -330,8 +330,6 @@ static pv_entry_t get_pv_entry(void); static void alpha_protection_init(void); static void pmap_changebit(vm_page_t m, int bit, boolean_t setem); -static vm_page_t pmap_enter_quick(pmap_t pmap, vm_offset_t va, - vm_page_t m, vm_page_t mpte); static int pmap_remove_pte(pmap_t pmap, pt_entry_t* ptq, vm_offset_t sva); static void pmap_remove_page(struct pmap *pmap, vm_offset_t va); static int pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va); @@ -1973,7 +1971,7 @@ validate: * but is *MUCH* faster than pmap_enter... */ -static vm_page_t +vm_page_t pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_page_t mpte) { register pt_entry_t *pte; diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index c53c8ac148c3..875f783abe34 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -208,8 +208,6 @@ static pv_entry_t get_pv_entry(void); static void amd64_protection_init(void); static __inline void pmap_changebit(vm_page_t m, int bit, boolean_t setem); -static vm_page_t pmap_enter_quick(pmap_t pmap, vm_offset_t va, - vm_page_t m, vm_page_t mpte); static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t sva); static void pmap_remove_page(struct pmap *pmap, vm_offset_t va); static int pmap_remove_entry(struct pmap *pmap, vm_page_t m, @@ -1951,7 +1949,7 @@ validate: * but is *MUCH* faster than pmap_enter... */ -static vm_page_t +vm_page_t pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_page_t mpte) { pt_entry_t *pte; diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 573cffd2cb72..f2da703cda96 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -243,8 +243,6 @@ static pv_entry_t get_pv_entry(void); static void i386_protection_init(void); static __inline void pmap_changebit(vm_page_t m, int bit, boolean_t setem); -static vm_page_t pmap_enter_quick(pmap_t pmap, vm_offset_t va, - vm_page_t m, vm_page_t mpte); static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t sva); static void pmap_remove_page(struct pmap *pmap, vm_offset_t va); static int pmap_remove_entry(struct pmap *pmap, vm_page_t m, @@ -2090,7 +2088,7 @@ validate: * but is *MUCH* faster than pmap_enter... */ -static vm_page_t +vm_page_t pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_page_t mpte) { pt_entry_t *pte; diff --git a/sys/ia64/ia64/pmap.c b/sys/ia64/ia64/pmap.c index 8b8e63fd7f18..e866e6fa4cc8 100644 --- a/sys/ia64/ia64/pmap.c +++ b/sys/ia64/ia64/pmap.c @@ -267,7 +267,6 @@ static void ia64_protection_init(void); static pmap_t pmap_install(pmap_t); static void pmap_invalidate_all(pmap_t pmap); -static void pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m); vm_offset_t pmap_steal_memory(vm_size_t size) @@ -1709,8 +1708,8 @@ validate: * but is *MUCH* faster than pmap_enter... */ -static void -pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m) +vm_page_t +pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_page_t mpte) { struct ia64_lpte *pte; pmap_t oldpmap; @@ -1719,7 +1718,7 @@ pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m) pte = pmap_find_pte(va); if (pte->pte_p) - return; + goto reinstall; /* * Enter on the PV list since its part of our managed memory. @@ -1737,8 +1736,9 @@ pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m) pmap_set_pte(pte, va, VM_PAGE_TO_PHYS(m), PTE_IG_MANAGED, PTE_PL_USER, PTE_AR_R); - +reinstall: pmap_install(oldpmap); + return (NULL); } /* @@ -1821,7 +1821,8 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); pmap_enter_quick(pmap, - addr + ia64_ptob(tmpidx), p); + addr + ia64_ptob(tmpidx), p, + NULL); VM_OBJECT_LOCK(object); vm_page_lock_queues(); vm_page_wakeup(p); @@ -1855,7 +1856,8 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, vm_page_unlock_queues(); VM_OBJECT_UNLOCK(object); pmap_enter_quick(pmap, - addr + ia64_ptob(tmpidx), p); + addr + ia64_ptob(tmpidx), p, + NULL); VM_OBJECT_LOCK(object); vm_page_lock_queues(); vm_page_wakeup(p); @@ -1951,7 +1953,7 @@ pmap_prefault(pmap, addra, entry) } vm_page_busy(m); vm_page_unlock_queues(); - pmap_enter_quick(pmap, addr, m); + pmap_enter_quick(pmap, addr, m, NULL); vm_page_lock_queues(); vm_page_wakeup(m); } diff --git a/sys/powerpc/aim/mmu_oea.c b/sys/powerpc/aim/mmu_oea.c index ef84865ecf0e..35f2a8e62c4d 100644 --- a/sys/powerpc/aim/mmu_oea.c +++ b/sys/powerpc/aim/mmu_oea.c @@ -1032,6 +1032,14 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, pmap_syncicache(VM_PAGE_TO_PHYS(m), PAGE_SIZE); } +vm_page_t +pmap_enter_quick(pmap_t pm, vm_offset_t va, vm_page_t m, vm_page_t mpte) +{ + + pmap_enter(pm, va, m, VM_PROT_READ | VM_PROT_EXECUTE, FALSE); + return (NULL); +} + vm_offset_t pmap_extract(pmap_t pm, vm_offset_t va) { diff --git a/sys/powerpc/powerpc/mmu_oea.c b/sys/powerpc/powerpc/mmu_oea.c index ef84865ecf0e..35f2a8e62c4d 100644 --- a/sys/powerpc/powerpc/mmu_oea.c +++ b/sys/powerpc/powerpc/mmu_oea.c @@ -1032,6 +1032,14 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, pmap_syncicache(VM_PAGE_TO_PHYS(m), PAGE_SIZE); } +vm_page_t +pmap_enter_quick(pmap_t pm, vm_offset_t va, vm_page_t m, vm_page_t mpte) +{ + + pmap_enter(pm, va, m, VM_PROT_READ | VM_PROT_EXECUTE, FALSE); + return (NULL); +} + vm_offset_t pmap_extract(pmap_t pm, vm_offset_t va) { diff --git a/sys/powerpc/powerpc/pmap.c b/sys/powerpc/powerpc/pmap.c index ef84865ecf0e..35f2a8e62c4d 100644 --- a/sys/powerpc/powerpc/pmap.c +++ b/sys/powerpc/powerpc/pmap.c @@ -1032,6 +1032,14 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, pmap_syncicache(VM_PAGE_TO_PHYS(m), PAGE_SIZE); } +vm_page_t +pmap_enter_quick(pmap_t pm, vm_offset_t va, vm_page_t m, vm_page_t mpte) +{ + + pmap_enter(pm, va, m, VM_PROT_READ | VM_PROT_EXECUTE, FALSE); + return (NULL); +} + vm_offset_t pmap_extract(pmap_t pm, vm_offset_t va) { diff --git a/sys/sparc64/sparc64/pmap.c b/sys/sparc64/sparc64/pmap.c index 8a7b1da48dbe..947fd929951c 100644 --- a/sys/sparc64/sparc64/pmap.c +++ b/sys/sparc64/sparc64/pmap.c @@ -1331,6 +1331,14 @@ pmap_enter(pmap_t pm, vm_offset_t va, vm_page_t m, vm_prot_t prot, } } +vm_page_t +pmap_enter_quick(pmap_t pm, vm_offset_t va, vm_page_t m, vm_page_t mpte) +{ + + pmap_enter(pm, va, m, VM_PROT_READ | VM_PROT_EXECUTE, FALSE); + return (NULL); +} + void pmap_object_init_pt(pmap_t pm, vm_offset_t addr, vm_object_t object, vm_pindex_t pindex, vm_size_t size, int limit) diff --git a/sys/vm/pmap.h b/sys/vm/pmap.h index 4f937041ecc0..c623fda05bbd 100644 --- a/sys/vm/pmap.h +++ b/sys/vm/pmap.h @@ -103,6 +103,8 @@ void pmap_copy(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t); void pmap_copy_page(vm_page_t, vm_page_t); void pmap_enter(pmap_t, vm_offset_t, vm_page_t, vm_prot_t, boolean_t); +vm_page_t pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, + vm_page_t mpte); vm_paddr_t pmap_extract(pmap_t pmap, vm_offset_t va); void pmap_growkernel(vm_offset_t); void pmap_init(vm_paddr_t, vm_paddr_t); @@ -110,7 +112,7 @@ boolean_t pmap_is_modified(vm_page_t m); boolean_t pmap_ts_referenced(vm_page_t m); vm_offset_t pmap_map(vm_offset_t *, vm_paddr_t, vm_paddr_t, int); void pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, - vm_object_t object, vm_pindex_t pindex, vm_offset_t size, + vm_object_t object, vm_pindex_t pindex, vm_size_t size, int pagelimit); boolean_t pmap_page_exists_quick(pmap_t pmap, vm_page_t m); void pmap_page_protect(vm_page_t m, vm_prot_t prot);