Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 01 Jun 2010 11:21:29 -0500
From:      Alan Cox <alc@cs.rice.edu>
To:        ppc@freebsd.org
Cc:        Marcel Moolenaar <marcel@freebsd.org>, Alan Cox <alc@cs.rice.edu>
Subject:   BookE pmap_enter() bug?
Message-ID:  <4C053389.1040204@cs.rice.edu>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------070902080904060507040709
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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


--------------070902080904060507040709
Content-Type: text/plain;
 name="booke.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="booke.patch"

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++;
 		}
 

--------------070902080904060507040709--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C053389.1040204>