1 #------------------------------------------------------------------------------
3 # Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
5 # 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 #include <AsmMacroIoLib.h>
19 GCC_ASM_EXPORT(ArmCleanInvalidateDataCache)
20 GCC_ASM_EXPORT(ArmCleanDataCache)
21 GCC_ASM_EXPORT(ArmInvalidateDataCache)
22 GCC_ASM_EXPORT(ArmInvalidateInstructionCache)
23 GCC_ASM_EXPORT(ArmInvalidateDataCacheEntryByMVA)
24 GCC_ASM_EXPORT(ArmCleanDataCacheEntryByMVA)
25 GCC_ASM_EXPORT(ArmCleanInvalidateDataCacheEntryByMVA)
26 GCC_ASM_EXPORT(ArmEnableMmu)
27 GCC_ASM_EXPORT(ArmDisableMmu)
28 GCC_ASM_EXPORT(ArmMmuEnabled)
29 GCC_ASM_EXPORT(ArmEnableDataCache)
30 GCC_ASM_EXPORT(ArmDisableDataCache)
31 GCC_ASM_EXPORT(ArmEnableInstructionCache)
32 GCC_ASM_EXPORT(ArmDisableInstructionCache)
33 GCC_ASM_EXPORT(ArmEnableBranchPrediction)
34 GCC_ASM_EXPORT(ArmDisableBranchPrediction)
35 GCC_ASM_EXPORT(ArmDataMemoryBarrier)
36 GCC_ASM_EXPORT(ArmDataSyncronizationBarrier)
37 GCC_ASM_EXPORT(ArmInstructionSynchronizationBarrier)
44 ASM_PFX(ArmInvalidateDataCacheEntryByMVA):
45 mcr p15, 0, r0, c7, c6, 1 @invalidate single data cache line
49 ASM_PFX(ArmCleanDataCacheEntryByMVA):
50 mcr p15, 0, r0, c7, c10, 1 @clean single data cache line
54 ASM_PFX(ArmCleanInvalidateDataCacheEntryByMVA):
55 mcr p15, 0, r0, c7, c14, 1 @clean and invalidate single data cache line
59 ASM_PFX(ArmCleanDataCache):
60 mcr p15, 0, r0, c7, c10, 0 @ clean entire data cache
64 ASM_PFX(ArmCleanInvalidateDataCache):
65 mcr p15, 0, r0, c7, c14, 0 @ clean and invalidate entire data cache
69 ASM_PFX(ArmInvalidateDataCache):
70 mcr p15, 0, r0, c7, c6, 0 @ invalidate entire data cache
74 ASM_PFX(ArmInvalidateInstructionCache):
75 mcr p15, 0, r0, c7, c5, 0 @invalidate entire instruction cache
77 mcr p15,0,R0,c7,c5,4 @Flush Prefetch buffer
80 ASM_PFX(ArmEnableMmu):
86 ASM_PFX(ArmMmuEnabled):
91 ASM_PFX(ArmDisableMmu):
96 mcr p15,0,R0,c7,c10,4 @Data synchronization barrier
98 mcr p15,0,R0,c7,c5,4 @Flush Prefetch buffer
101 ASM_PFX(ArmEnableDataCache):
102 LoadConstantToReg(DC_ON, R1) @ldr R1,=DC_ON
103 mrc p15,0,R0,c1,c0,0 @Read control register configuration data
104 orr R0,R0,R1 @Set C bit
105 mcr p15,0,r0,c1,c0,0 @Write control register configuration data
108 ASM_PFX(ArmDisableDataCache):
109 LoadConstantToReg(DC_ON, R1) @ldr R1,=DC_ON
110 mrc p15,0,R0,c1,c0,0 @Read control register configuration data
111 bic R0,R0,R1 @Clear C bit
112 mcr p15,0,r0,c1,c0,0 @Write control register configuration data
115 ASM_PFX(ArmEnableInstructionCache):
117 mrc p15,0,R0,c1,c0,0 @Read control register configuration data
118 orr R0,R0,R1 @Set I bit
119 mcr p15,0,r0,c1,c0,0 @Write control register configuration data
122 ASM_PFX(ArmDisableInstructionCache):
124 mrc p15,0,R0,c1,c0,0 @Read control register configuration data
125 bic R0,R0,R1 @Clear I bit.
126 mcr p15,0,r0,c1,c0,0 @Write control register configuration data
129 ASM_PFX(ArmEnableBranchPrediction):
130 mrc p15, 0, r0, c1, c0, 0
131 orr r0, r0, #0x00000800
132 mcr p15, 0, r0, c1, c0, 0
135 ASM_PFX(ArmDisableBranchPrediction):
136 mrc p15, 0, r0, c1, c0, 0
137 bic r0, r0, #0x00000800
138 mcr p15, 0, r0, c1, c0, 0
141 ASM_PFX(ArmDataMemoryBarrier):
143 mcr P15, #0, R0, C7, C10, #5
146 ASM_PFX(ArmDataSyncronizationBarrier):
148 mcr P15, #0, R0, C7, C10, #4
151 ASM_PFX(ArmInstructionSynchronizationBarrier):
153 mcr P15, #0, R0, C7, C5, #4
157 ASM_FUNCTION_REMOVE_IF_UNREFERENCED