05.02.2013 Views

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

TLB lockdown procedure, using the by entry model<br />

<strong>ARM</strong>v4 <strong>and</strong> <strong>ARM</strong>v5 Differences<br />

The normal procedure for locking down N TLB entries where the Base field can be modified is as follows:<br />

1. Ensure that no processor exceptions can occur during the execution of this procedure, for example by<br />

disabling interrupts.<br />

2. If an instruction TLB or unified TLB is being locked down, write the appropriate version of<br />

register c10 with Base == N, Victim == N, <strong>and</strong> P == 0. If appropriate, turn off facilities like branch<br />

prediction that make instruction prefetching harder to underst<strong>and</strong>.<br />

3. Invalidate the entire TLB to be locked down.<br />

4. If an instruction TLB is being locked down, ensure that all TLB entries are loaded that relate to any<br />

instruction that could be prefetched by the rest of the lockdown procedure. Provided care is taken<br />

about where the lockdown procedure starts, one TLB entry can usually cover all of these. This means<br />

that the first instruction prefetch after the TLB is invalidated can do this job.<br />

If a data TLB is being locked down, ensure that all TLB entries are loaded that relate to any data<br />

accessed by the rest of the lockdown procedure, including any inline literals used by its code. Usually<br />

the best way to do this is to avoid using inline literals in the lockdown procedure, <strong>and</strong> to put all other<br />

data used by it in an area covered by a single TLB entry, <strong>and</strong> then to load one data item.<br />

If a unified TLB is being locked down, do both of the above.<br />

5. For each of value of i from 0 to N-1:<br />

a. Write to the CP15 c10 register with Base == i, Victim == i, <strong>and</strong> P == 1.<br />

b. Force a translation table walk to occur for the area of memory whose translation table walk<br />

result is to be locked into TLB entry i as follows:<br />

If a data TLB or unified TLB is being locked down, load an item of data from the area<br />

of memory.<br />

If an instruction TLB is being locked down, use the CP15 c7 prefetch instruction cache<br />

line operation defined in Table H-21 on page AppxH-49 to prefetch an instruction from<br />

the area of memory.<br />

6. Write to the CP15 c10 register with Base == N, Victim == N, <strong>and</strong> P == 0.<br />

Note<br />

If the FCSE is being used, care is required in step 5b because:<br />

If a data TLB or a unified TLB is being locked down, the address used for the load instruction is<br />

subject to modification by the FCSE.<br />

If an instruction TLB is being locked down, the address used for the CP15 c7 operation is being<br />

treated as data <strong>and</strong> so is not subject to modification by the FCSE.<br />

To minimize the possible confusion caused by this, <strong>ARM</strong> recommends that the lockdown procedure:<br />

starts by disabling the FCSE, by setting the PID to zero<br />

<strong>ARM</strong> DDI 0406B Copyright © 1996-1998, 2000, 2004-2008 <strong>ARM</strong> Limited. All rights reserved. AppxH-61

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!