Mapping an executable page
Scott Wood
scottwood at freescale.com
Wed Jun 15 06:26:01 EST 2011
On Tue, 14 Jun 2011 10:56:31 +0200
Thomas De Schampheleire <patrickdepinguin+linuxppc at gmail.com> wrote:
> * Therefore, to make sure that the mapping I intended with __ioremap()
> is actually reflected in the TLB tables, I added dummy reads of each
> page in the TLB, prior to jumping to the boot code, as follows:
> /* make sure memory is read, once every 4Kbyte is enough */
> for (p = vaddr; p < vaddr + map_size; p += 0x1000) {
> unsigned long dummy = *(volatile unsigned long *)p;
> (void)dummy;
> }
>
> * After these changes (make sure all code is mapped + make sure to
> read all pages so that the TLBs are updated), my scenario works fine.
This is fragile -- you are assuming that it's possible to fit this
set of pages in TLB0 all at once, and that none of them will be
evicted/invalidated by the time you're done.
If you really need to do this, I sugest using settlbcam() from
arch/powerpc/mm/fsl_booke_mmu.c to create TLB1 entries with IPROT set.
Better still if you could live with whatever memory the kernel has already
pinned.
-Scott
More information about the Linuxppc-dev
mailing list