1 //------------------------------------------------------------------------------
3 // Copyright (c) 2008-2009 Apple Inc. All rights reserved.
5 // All rights reserved. This program and the accompanying materials
6 // are licensed and made available under the terms and conditions of the BSD License
7 // which accompanies this distribution. The full text of the license may be found at
8 // http://opensource.org/licenses/bsd-license.php
10 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 //------------------------------------------------------------------------------
15 EXPORT ArmCleanInvalidateDataCache
16 EXPORT ArmCleanDataCache
17 EXPORT ArmInvalidateDataCache
18 EXPORT ArmInvalidateInstructionCache
19 EXPORT ArmInvalidateDataCacheEntryByMVA
20 EXPORT ArmCleanDataCacheEntryByMVA
21 EXPORT ArmCleanInvalidateDataCacheEntryByMVA
24 EXPORT ArmEnableDataCache
25 EXPORT ArmDisableDataCache
26 EXPORT ArmEnableInstructionCache
27 EXPORT ArmDisableInstructionCache
28 EXPORT ArmEnableBranchPrediction
29 EXPORT ArmDisableBranchPrediction
32 DC_ON EQU ( 0x1:SHL:2 )
33 IC_ON EQU ( 0x1:SHL:12 )
35 AREA ArmCacheLib, CODE, READONLY
39 ArmInvalidateDataCacheEntryByMVA
40 MCR p15, 0, r0, c7, c6, 1 ; invalidate single data cache line
44 ArmCleanDataCacheEntryByMVA
45 MCR p15, 0, r0, c7, c10, 1 ; clean single data cache line
49 ArmCleanInvalidateDataCacheEntryByMVA
50 MCR p15, 0, r0, c7, c14, 1 ; clean and invalidate single data cache line
53 ArmEnableInstructionCache
55 MRC p15,0,R0,c1,c0,0 ;Read control register configuration data
56 ORR R0,R0,R1 ;Set I bit
57 MCR p15,0,r0,c1,c0,0 ;Write control register configuration data
60 ArmDisableInstructionCache
62 MRC p15,0,R0,c1,c0,0 ;Read control register configuration data
63 BIC R0,R0,R1 ;Clear I bit.
64 MCR p15,0,r0,c1,c0,0 ;Write control register configuration data
67 ArmInvalidateInstructionCache
69 MCR p15,0,R0,c7,c5,0 ;Invalidate entire instruction cache
71 MCR p15,0,R0,c7,c10,4 ;Drain write buffer
85 mcr p15,0,R0,c7,c10,4 ;Drain write buffer
90 MRC p15,0,R0,c1,c0,0 ;Read control register configuration data
91 ORR R0,R0,R1 ;Set C bit
92 MCR p15,0,r0,c1,c0,0 ;Write control register configuration data
97 MRC p15,0,R0,c1,c0,0 ;Read control register configuration data
98 BIC R0,R0,R1 ;Clear C bit
99 MCR p15,0,r0,c1,c0,0 ;Write control register configuration data
103 MRC p15,0,r15,c7,c10,3
104 BNE ArmCleanDataCache
106 MCR p15,0,R0,c7,c10,4 ;Drain write buffer
109 ArmInvalidateDataCache
111 MCR p15,0,R0,c7,c6,0 ;Invalidate entire data cache
113 MCR p15,0,R0,c7,c10,4 ;Drain write buffer
116 ArmCleanInvalidateDataCache
117 MRC p15,0,r15,c7,c14,3
118 BNE ArmCleanInvalidateDataCache
120 MCR p15,0,R0,c7,c10,4 ;Drain write buffer
123 ArmEnableBranchPrediction
124 bx LR ;Branch prediction is not supported.
126 ArmDisableBranchPrediction
127 bx LR ;Branch prediction is not supported.