BookE pmap_enter() bug?

Alan Cox alc at cs.rice.edu
Tue Jun 1 16:50:06 UTC 2010


I've been reviewing the various pmap_enter() implementations and came 
across the following bit of code in the BookE pmap_enter():

        if (prot & VM_PROT_EXECUTE) {
            flags |= PTE_SX;
            if (!su)
                flags |= PTE_UX;

            /*
             * Check existing flags for execute permissions: if we
             * are turning execute permissions on, icache should
             * be flushed.
             */
            if ((flags & (PTE_UX | PTE_SX)) == 0)
                sync++;
        }


This will never flush the instruction cache because the new flags, not 
the old flags, are being used.  I suspect that the attached change 
should be made.

Alan

-------------- next part --------------
Index: powerpc/booke/pmap.c
===================================================================
--- powerpc/booke/pmap.c	(revision 208657)
+++ powerpc/booke/pmap.c	(working copy)
@@ -1621,7 +1621,7 @@ mmu_booke_enter_locked(mmu_t mmu, pmap_t pmap, vm_
 			 * are turning execute permissions on, icache should
 			 * be flushed.
 			 */
-			if ((flags & (PTE_UX | PTE_SX)) == 0)
+			if ((pte->flags & (PTE_UX | PTE_SX)) == 0)
 				sync++;
 		}
 


More information about the freebsd-ppc mailing list