From 4e067a8592596021d40c4c1bc2a80160ee7f24aa Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 2 Dec 2005 18:02:54 +0000 Subject: [PATCH] Change pmap_enter_quick() to use the vm_prot_t parameter introduced in revision 1.179 to correctly set/clear execute permission on the mapping it creates. Thus, mmap(2)ing a memory resident file will not result in the file being mapped with execute permission when execute permission was not requested. Eliminate an unneeded Instruction Memory Barrier (IMB) in pmap_enter_quick(). Since there was no previous (instruction) mapping for the given virtual address prior to pmap_enter_quick(), there can be no instructions from the given virtual address in the pipeline that need flushing. MFC after: 1 week --- sys/alpha/alpha/pmap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/alpha/alpha/pmap.c b/sys/alpha/alpha/pmap.c index 13704ffee05d..5fdbb342c70d 100644 --- a/sys/alpha/alpha/pmap.c +++ b/sys/alpha/alpha/pmap.c @@ -1941,11 +1941,12 @@ pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, pmap->pm_stats.resident_count++; /* - * Now validate mapping with RO protection + * Validate the mapping with limited access, read and/or execute but + * not write. */ - *pte = pmap_phys_to_pte(VM_PAGE_TO_PHYS(m)) | PG_V | PG_KRE | PG_URE | managed; + *pte = pmap_phys_to_pte(VM_PAGE_TO_PHYS(m)) | PG_V | pte_prot(pmap, + prot & (VM_PROT_READ | VM_PROT_EXECUTE)) | managed; out: - alpha_pal_imb(); /* XXX overkill? */ PMAP_UNLOCK(pmap); return mpte; }