Mapping an executable page
Thomas De Schampheleire
patrickdepinguin+linuxppc at gmail.com
Wed Jun 22 17:44:28 EST 2011
On Tue, Jun 14, 2011 at 10:02 PM, Timur Tabi <timur at freescale.com> wrote:
> Thomas De Schampheleire wrote:
>
>> * However, if you jump to an address in that page, you'll have to make
>> sure that the entire code that executes is mapped (make map_size large
>> enough).
>
> Well, that seems obvious.
Agreed.
>
>> * When that range spanned multiple pages, I faced the issue of only
>> one page being actually mapped in the TLBs. My assumption is that the
>> call to __ioremap not necessarily updates the TLBs, but mainly some
>> kernel-internal tables. The actual TLB mapping presumably happens when
>> a data exception occurs.
>
> Hmmm.... I find that surprising. Memory allocated via ioremap() is supposed to
> be available in interrupt handlers, where TLB mappings can't be created
> on-the-fly. I'm not sure that your observation is correct.
>
>> * 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) {
>
> You should at least use PAGE_SIZE instead of 0x1000.
Thanks, I fixed this.
Thomas
More information about the Linuxppc-dev
mailing list