
Cache Lockdown
Copyright 2000–2001 by LSI Logic Corporation. All rights reserved.
4-13
the lockdown data has been loaded. The IDX[1:0] bits must be set to the
next available set.
Note:
The write to CP15 register 9 must not be executed until the
line fill has completed. This is achieved by aligning the LDR
to the last address of the line.
4.4.1.2 I-Cache Lockdown
For the I-cache, the lockdown procedure is as follows:
1.
Write to CP15 register 9, setting LD = 1 (the load bit) and IDX[1:0]
= 0 (the cache set bits).
2.
Initialize the pointer to the first of the words to be locked into the
cache.
3.
Force a line fill from that location by writing to CP15 register 7
(I-cache preload).
4.
Increment the pointer by 32 (number of bytes in a cache line).
5.
Force a line fill from that location by writing to CP15 register 7. The
resulting line fill is captured in the I-cache.
6.
Repeat steps 4 and 5 until all words are loaded in the cache or one
set of the cache has been loaded.
7.
Write to CP15 register 9, setting LD = 0 and IDX[1:0] = 1.
If there are more instructions to lockdown, at the final step, the LD bit
must remain set and the process repeated. The LD bit must only be
cleared when all the lockdown instructions have been loaded. The
IDX[1:0] bits must be set to the next available set.
The only significant difference between the sequence of operations for
the D-cache and I-cache is that an
MCR
instruction must be used to force
the line fill in the I-cache, instead of an LDR. The rest of the sequence
is the same as for D-cache lockdown.
The MCR to perform the I-cache fetch is a CP15 register 7 operation:
MCR
p15, 0, Rd, c7, c13, 1
4.4.1.3 Example I-Cache Lockdown Subroutine
A subroutine that you can use to lockdown code in the I-cache is: