diff --git a/sys/arch/arm/include/arm32/pmap.h b/sys/arch/arm/include/arm32/pmap.h index 8af5d63a72da..117b67540e82 100644 --- a/sys/arch/arm/include/arm32/pmap.h +++ b/sys/arch/arm/include/arm32/pmap.h @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.19 2001/11/23 19:21:48 thorpej Exp $ */ +/* $NetBSD: pmap.h,v 1.20 2002/01/19 16:55:22 chs Exp $ */ /* * Copyright (c) 1994,1995 Mark Brinicombe. @@ -211,6 +211,12 @@ boolean_t pmap_pageidlezero __P((paddr_t)); #define KERNEL_PD_SIZE \ (PD_SIZE - (KERNEL_SPACE_START >> PDSHIFT) * sizeof(pd_entry_t)) +/* + * tell MI code that the cache is virtually-indexed *and* virtually-tagged. + */ + +#define PMAP_CACHE_VIVT + #endif /* _KERNEL */ #endif /* _ARM32_PMAP_H_ */ diff --git a/sys/uvm/uvm_bio.c b/sys/uvm/uvm_bio.c index f21e8ad09b6d..cdca7fe61695 100644 --- a/sys/uvm/uvm_bio.c +++ b/sys/uvm/uvm_bio.c @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_bio.c,v 1.22 2001/11/19 02:44:27 enami Exp $ */ +/* $NetBSD: uvm_bio.c,v 1.23 2002/01/19 16:55:20 chs Exp $ */ /* * Copyright (c) 1998 Chuck Silvers. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.22 2001/11/19 02:44:27 enami Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.23 2002/01/19 16:55:20 chs Exp $"); #include "opt_uvmhist.h" @@ -229,6 +229,7 @@ ubc_fault(ufi, ign1, ign2, ign3, ign4, fault_type, access_type, flags) vaddr_t va, eva, ubc_offset, slot_offset; int i, error, npages; struct vm_page *pgs[ubc_winsize >> PAGE_SHIFT], *pg; + vm_prot_t prot; UVMHIST_FUNC("ubc_fault"); UVMHIST_CALLED(ubchist); /* @@ -288,6 +289,18 @@ again: va = ufi->orig_rvaddr; eva = ufi->orig_rvaddr + (npages << PAGE_SHIFT); + /* + * for virtually-indexed, virtually-tagged caches we should avoid + * creating writable mappings when we don't absolutely need them, + * since the "compatible alias" trick doesn't work on such caches. + * otherwise, we can always map the pages writable. + */ + +#ifdef PMAP_CACHE_VIVT + prot = VM_PROT_READ | access_type; +#else + prot = VM_PROT_READ | VM_PROT_WRITE; +#endif UVMHIST_LOG(ubchist, "va 0x%lx eva 0x%lx", va, eva, 0,0); simple_lock(&uobj->vmobjlock); uvm_lock_pageq(); @@ -309,7 +322,7 @@ again: KASSERT(access_type == VM_PROT_READ || (pg->flags & PG_RDONLY) == 0); pmap_enter(ufi->orig_map->pmap, va, VM_PAGE_TO_PHYS(pg), - VM_PROT_READ | VM_PROT_WRITE, access_type); + prot, access_type); uvm_pageactivate(pg); pg->flags &= ~(PG_BUSY); UVM_PAGE_OWN(pg, NULL);