System Control Coprocessor
ARM DDI 0301H Copyright © 2004-2009 ARM Limited. All rights reserved. 3-153
ID012310 Non-Confidential, Unrestricted Access
To use the TLB lockdown access registers read or write CP15 with:
• Opcode_1 set to 5
• CRn set to c15
• CRm set to:
— c4, TLB Lockdown Index Register
— c5, TLB Lockdown VA Register
— c6, TLB Lockdown PA Register
— c7, TLB Lockdown Attributes Register.
Opcode_2 set to 2.
For example:
MRC p15, 5, <Rd>, c15, c4, 2 ; Read TLB Lockdown Index Register
MCR p15, 5, <Rd>, c15, c4, 2 ; Write TLB Lockdown Index Register
MRC p15, 5, <Rd>, c15, c5, 2 ; Read TLB Lockdown VA Register
MCR p15, 5, <Rd>, c15, c5, 2 ; Write TLB Lockdown VA Register
MRC p15, 5, <Rd>, c15, c6, 2 ; Read TLB Lockdown PA Register
MCR p15, 5, <Rd>, c15, c6, 2 ; Write TLB Lockdown PA Register
MRC p15, 5, <Rd>, c15, c7, 2 ; Read TLB Lockdown Attributes Register
MCR p15, 5, <Rd>, c15, c7, 2 ; Write TLB Lockdown Attributes Register
Example 3-3 is a code sequence that stores all 8 TLB Lockdown entries to memory, and later
restores them to the TLB Lockdown region. You might use sequences similar to this for entry
into Dormant mode.
Example 3-3 Save and restore all TLB Lockdown entries
ADR r1,TLBLockAddr ; Set r1 to save address
MOV R0,#0 ; Initialize counter
CPSID aif ; Disable interrupts
TLBLockSave MCR p15,5,R0,c15,c4,2 ; Set TLB Lockdown Index
MRC p15,5,R2,c15,c5,2 ; Read TLB Lockdown VA
MRC p15,5,R3,c15,c7,2 ; Read TLB Lockdown Attrs
MRC p15,5,R4,c15,c6,2 ; Read TLB Lockdown PA
STMIA r1!,{R2-R4} ; Save TLB Lockdown entry
ADD R0,R0,#1 ; Increment counter
CMP R0,#8 ; Saved all 8 entries?
BNE TLBLockSave ; Loop until all saved
CPSIE aif ; Re-enable interrupts
; insert other code here
ADR r1,TLBLockAddr ; Set r1 to save address
MOV R0,#0 ; Initialize counter
CPSID aif ; Disable interrupts
TLBLockLoad LDMIA r1!,{R2-R4} ; Load TLB Lockdown entry
MCR p15,5,R0,c15,c4,2 ; Set TLB Lockdown Index
MCR p15,5,R2,c15,c5,2 ; Write TLB Lockdown VA
MCR p15,5,R3,c15,c7,2 ; Write TLB Lockdown Attrs
MCR p15,5,R4,c15,c6,2 ; Write TLB Lockdown PA
ADD R0,R0,#1 ; Increment counter
CMP R0,#8 ; Restored all 8 entries?
BNE TLBLockLoad ; Loop until all restored
CPSIE aif ; Re-enable interrupts