]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/ArmLib/AArch64/AArch64Support.S
ArmPkg/ArmLib: don't invalidate entire I-cache on range operation
[mirror_edk2.git] / ArmPkg / Library / ArmLib / AArch64 / AArch64Support.S
CommitLineData
25402f5d
HL
1#------------------------------------------------------------------------------\r
2#\r
3# Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>\r
9401d6f4 4# Copyright (c) 2011 - 2014, ARM Limited. All rights reserved.\r
25402f5d
HL
5#\r
6# This program and the accompanying materials\r
7# are licensed and made available under the terms and conditions of the BSD License\r
8# which accompanies this distribution. The full text of the license may be found at\r
9# http://opensource.org/licenses/bsd-license.php\r
10#\r
11# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13#\r
14#------------------------------------------------------------------------------\r
15\r
16#include <Chipset/AArch64.h>\r
17#include <AsmMacroIoLibV8.h>\r
18\r
19.text\r
20.align 3\r
21\r
22GCC_ASM_EXPORT (ArmInvalidateInstructionCache)\r
23GCC_ASM_EXPORT (ArmInvalidateDataCacheEntryByMVA)\r
24GCC_ASM_EXPORT (ArmCleanDataCacheEntryByMVA)\r
b7de7e3c 25GCC_ASM_EXPORT (ArmCleanDataCacheEntryToPoUByMVA)\r
cf580da1 26GCC_ASM_EXPORT (ArmInvalidateInstructionCacheEntryToPoUByMVA)\r
25402f5d
HL
27GCC_ASM_EXPORT (ArmCleanInvalidateDataCacheEntryByMVA)\r
28GCC_ASM_EXPORT (ArmInvalidateDataCacheEntryBySetWay)\r
29GCC_ASM_EXPORT (ArmCleanDataCacheEntryBySetWay)\r
30GCC_ASM_EXPORT (ArmCleanInvalidateDataCacheEntryBySetWay)\r
25402f5d
HL
31GCC_ASM_EXPORT (ArmEnableMmu)\r
32GCC_ASM_EXPORT (ArmDisableMmu)\r
33GCC_ASM_EXPORT (ArmDisableCachesAndMmu)\r
34GCC_ASM_EXPORT (ArmMmuEnabled)\r
35GCC_ASM_EXPORT (ArmEnableDataCache)\r
36GCC_ASM_EXPORT (ArmDisableDataCache)\r
37GCC_ASM_EXPORT (ArmEnableInstructionCache)\r
38GCC_ASM_EXPORT (ArmDisableInstructionCache)\r
39GCC_ASM_EXPORT (ArmDisableAlignmentCheck)\r
40GCC_ASM_EXPORT (ArmEnableAlignmentCheck)\r
41GCC_ASM_EXPORT (ArmEnableBranchPrediction)\r
42GCC_ASM_EXPORT (ArmDisableBranchPrediction)\r
43GCC_ASM_EXPORT (AArch64AllDataCachesOperation)\r
25402f5d 44GCC_ASM_EXPORT (ArmDataMemoryBarrier)\r
cf93a378 45GCC_ASM_EXPORT (ArmDataSynchronizationBarrier)\r
25402f5d
HL
46GCC_ASM_EXPORT (ArmInstructionSynchronizationBarrier)\r
47GCC_ASM_EXPORT (ArmWriteVBar)\r
f0247796 48GCC_ASM_EXPORT (ArmReadVBar)\r
25402f5d
HL
49GCC_ASM_EXPORT (ArmEnableVFP)\r
50GCC_ASM_EXPORT (ArmCallWFI)\r
25402f5d
HL
51GCC_ASM_EXPORT (ArmReadMpidr)\r
52GCC_ASM_EXPORT (ArmReadTpidrurw)\r
53GCC_ASM_EXPORT (ArmWriteTpidrurw)\r
54GCC_ASM_EXPORT (ArmIsArchTimerImplemented)\r
55GCC_ASM_EXPORT (ArmReadIdPfr0)\r
56GCC_ASM_EXPORT (ArmReadIdPfr1)\r
57GCC_ASM_EXPORT (ArmWriteHcr)\r
d2bb61a2 58GCC_ASM_EXPORT (ArmReadHcr)\r
25402f5d 59GCC_ASM_EXPORT (ArmReadCurrentEL)\r
61b02ba1
AB
60GCC_ASM_EXPORT (ArmReplaceLiveTranslationEntry)\r
61GCC_ASM_EXPORT (ArmReplaceLiveTranslationEntrySize)\r
25402f5d
HL
62\r
63.set CTRL_M_BIT, (1 << 0)\r
64.set CTRL_A_BIT, (1 << 1)\r
65.set CTRL_C_BIT, (1 << 2)\r
66.set CTRL_I_BIT, (1 << 12)\r
67.set CTRL_V_BIT, (1 << 12)\r
68.set CPACR_VFP_BITS, (3 << 20)\r
69\r
70ASM_PFX(ArmInvalidateDataCacheEntryByMVA):\r
71 dc ivac, x0 // Invalidate single data cache line\r
25402f5d
HL
72 ret\r
73\r
74\r
75ASM_PFX(ArmCleanDataCacheEntryByMVA):\r
76 dc cvac, x0 // Clean single data cache line\r
25402f5d
HL
77 ret\r
78\r
79\r
b7de7e3c
EC
80ASM_PFX(ArmCleanDataCacheEntryToPoUByMVA):\r
81 dc cvau, x0 // Clean single data cache line to PoU\r
82 ret\r
83\r
cf580da1
AB
84ASM_PFX(ArmInvalidateInstructionCacheEntryToPoUByMVA):\r
85 ic ivau, x0 // Invalidate single instruction cache line to PoU\r
86 ret\r
87\r
b7de7e3c 88\r
25402f5d
HL
89ASM_PFX(ArmCleanInvalidateDataCacheEntryByMVA):\r
90 dc civac, x0 // Clean and invalidate single data cache line\r
25402f5d
HL
91 ret\r
92\r
93\r
94ASM_PFX(ArmInvalidateDataCacheEntryBySetWay):\r
95 dc isw, x0 // Invalidate this line\r
25402f5d
HL
96 ret\r
97\r
98\r
99ASM_PFX(ArmCleanInvalidateDataCacheEntryBySetWay):\r
100 dc cisw, x0 // Clean and Invalidate this line\r
25402f5d
HL
101 ret\r
102\r
103\r
104ASM_PFX(ArmCleanDataCacheEntryBySetWay):\r
105 dc csw, x0 // Clean this line\r
25402f5d
HL
106 ret\r
107\r
108\r
109ASM_PFX(ArmInvalidateInstructionCache):\r
110 ic iallu // Invalidate entire instruction cache\r
111 dsb sy\r
112 isb\r
113 ret\r
114\r
115\r
116ASM_PFX(ArmEnableMmu):\r
117 EL1_OR_EL2_OR_EL3(x1)\r
1181: mrs x0, sctlr_el1 // Read System control register EL1\r
119 b 4f\r
1202: mrs x0, sctlr_el2 // Read System control register EL2\r
121 b 4f\r
1223: mrs x0, sctlr_el3 // Read System control register EL3\r
1234: orr x0, x0, #CTRL_M_BIT // Set MMU enable bit\r
124 EL1_OR_EL2_OR_EL3(x1)\r
70f89c0b 1251: tlbi vmalle1\r
ee95f9e1 126 dsb nsh\r
25402f5d
HL
127 isb\r
128 msr sctlr_el1, x0 // Write back\r
129 b 4f\r
1302: tlbi alle2\r
ee95f9e1 131 dsb nsh\r
25402f5d
HL
132 isb\r
133 msr sctlr_el2, x0 // Write back\r
134 b 4f\r
1353: tlbi alle3\r
ee95f9e1 136 dsb nsh\r
25402f5d
HL
137 isb\r
138 msr sctlr_el3, x0 // Write back\r
ee95f9e1 1394: isb\r
25402f5d
HL
140 ret\r
141\r
142\r
143ASM_PFX(ArmDisableMmu):\r
144 EL1_OR_EL2_OR_EL3(x1)\r
1451: mrs x0, sctlr_el1 // Read System Control Register EL1\r
146 b 4f\r
1472: mrs x0, sctlr_el2 // Read System Control Register EL2\r
148 b 4f\r
1493: mrs x0, sctlr_el3 // Read System Control Register EL3\r
73ca5009 1504: and x0, x0, #~CTRL_M_BIT // Clear MMU enable bit\r
25402f5d
HL
151 EL1_OR_EL2_OR_EL3(x1)\r
1521: msr sctlr_el1, x0 // Write back\r
70f89c0b 153 tlbi vmalle1\r
25402f5d
HL
154 b 4f\r
1552: msr sctlr_el2, x0 // Write back\r
156 tlbi alle2\r
157 b 4f\r
1583: msr sctlr_el3, x0 // Write back\r
159 tlbi alle3\r
1604: dsb sy\r
161 isb\r
162 ret\r
163\r
164\r
165ASM_PFX(ArmDisableCachesAndMmu):\r
166 EL1_OR_EL2_OR_EL3(x1)\r
1671: mrs x0, sctlr_el1 // Get control register EL1\r
168 b 4f\r
1692: mrs x0, sctlr_el2 // Get control register EL2\r
170 b 4f\r
1713: mrs x0, sctlr_el3 // Get control register EL3\r
73ca5009
BJ
1724: mov x1, #~(CTRL_M_BIT | CTRL_C_BIT | CTRL_I_BIT) // Disable MMU, D & I caches\r
173 and x0, x0, x1\r
25402f5d
HL
174 EL1_OR_EL2_OR_EL3(x1)\r
1751: msr sctlr_el1, x0 // Write back control register\r
176 b 4f\r
1772: msr sctlr_el2, x0 // Write back control register\r
178 b 4f\r
1793: msr sctlr_el3, x0 // Write back control register\r
1804: dsb sy\r
181 isb\r
182 ret\r
183\r
184\r
185ASM_PFX(ArmMmuEnabled):\r
186 EL1_OR_EL2_OR_EL3(x1)\r
1871: mrs x0, sctlr_el1 // Get control register EL1\r
188 b 4f\r
1892: mrs x0, sctlr_el2 // Get control register EL2\r
190 b 4f\r
1913: mrs x0, sctlr_el3 // Get control register EL3\r
1924: and x0, x0, #CTRL_M_BIT\r
193 ret\r
194\r
195\r
196ASM_PFX(ArmEnableDataCache):\r
197 EL1_OR_EL2_OR_EL3(x1)\r
1981: mrs x0, sctlr_el1 // Get control register EL1\r
199 b 4f\r
2002: mrs x0, sctlr_el2 // Get control register EL2\r
201 b 4f\r
2023: mrs x0, sctlr_el3 // Get control register EL3\r
2034: orr x0, x0, #CTRL_C_BIT // Set C bit\r
204 EL1_OR_EL2_OR_EL3(x1)\r
2051: msr sctlr_el1, x0 // Write back control register\r
206 b 4f\r
2072: msr sctlr_el2, x0 // Write back control register\r
208 b 4f\r
2093: msr sctlr_el3, x0 // Write back control register\r
2104: dsb sy\r
211 isb\r
212 ret\r
213\r
214\r
215ASM_PFX(ArmDisableDataCache):\r
216 EL1_OR_EL2_OR_EL3(x1)\r
2171: mrs x0, sctlr_el1 // Get control register EL1\r
218 b 4f\r
2192: mrs x0, sctlr_el2 // Get control register EL2\r
220 b 4f\r
2213: mrs x0, sctlr_el3 // Get control register EL3\r
73ca5009 2224: and x0, x0, #~CTRL_C_BIT // Clear C bit\r
25402f5d
HL
223 EL1_OR_EL2_OR_EL3(x1)\r
2241: msr sctlr_el1, x0 // Write back control register\r
225 b 4f\r
2262: msr sctlr_el2, x0 // Write back control register\r
227 b 4f\r
2283: msr sctlr_el3, x0 // Write back control register\r
2294: dsb sy\r
230 isb\r
231 ret\r
232\r
233\r
234ASM_PFX(ArmEnableInstructionCache):\r
235 EL1_OR_EL2_OR_EL3(x1)\r
2361: mrs x0, sctlr_el1 // Get control register EL1\r
237 b 4f\r
2382: mrs x0, sctlr_el2 // Get control register EL2\r
239 b 4f\r
2403: mrs x0, sctlr_el3 // Get control register EL3\r
2414: orr x0, x0, #CTRL_I_BIT // Set I bit\r
242 EL1_OR_EL2_OR_EL3(x1)\r
2431: msr sctlr_el1, x0 // Write back control register\r
244 b 4f\r
2452: msr sctlr_el2, x0 // Write back control register\r
246 b 4f\r
2473: msr sctlr_el3, x0 // Write back control register\r
2484: dsb sy\r
249 isb\r
250 ret\r
251\r
252\r
253ASM_PFX(ArmDisableInstructionCache):\r
254 EL1_OR_EL2_OR_EL3(x1)\r
2551: mrs x0, sctlr_el1 // Get control register EL1\r
256 b 4f\r
2572: mrs x0, sctlr_el2 // Get control register EL2\r
258 b 4f\r
2593: mrs x0, sctlr_el3 // Get control register EL3\r
73ca5009 2604: and x0, x0, #~CTRL_I_BIT // Clear I bit\r
25402f5d
HL
261 EL1_OR_EL2_OR_EL3(x1)\r
2621: msr sctlr_el1, x0 // Write back control register\r
263 b 4f\r
2642: msr sctlr_el2, x0 // Write back control register\r
265 b 4f\r
2663: msr sctlr_el3, x0 // Write back control register\r
2674: dsb sy\r
268 isb\r
269 ret\r
270\r
271\r
272ASM_PFX(ArmEnableAlignmentCheck):\r
273 EL1_OR_EL2(x1)\r
2741: mrs x0, sctlr_el1 // Get control register EL1\r
275 b 3f\r
2762: mrs x0, sctlr_el2 // Get control register EL2\r
2773: orr x0, x0, #CTRL_A_BIT // Set A (alignment check) bit\r
278 EL1_OR_EL2(x1)\r
2791: msr sctlr_el1, x0 // Write back control register\r
280 b 3f\r
2812: msr sctlr_el2, x0 // Write back control register\r
2823: dsb sy\r
283 isb\r
284 ret\r
285\r
286\r
287ASM_PFX(ArmDisableAlignmentCheck):\r
288 EL1_OR_EL2_OR_EL3(x1)\r
2891: mrs x0, sctlr_el1 // Get control register EL1\r
290 b 4f\r
2912: mrs x0, sctlr_el2 // Get control register EL2\r
292 b 4f\r
2933: mrs x0, sctlr_el3 // Get control register EL3\r
73ca5009 2944: and x0, x0, #~CTRL_A_BIT // Clear A (alignment check) bit\r
25402f5d
HL
295 EL1_OR_EL2_OR_EL3(x1)\r
2961: msr sctlr_el1, x0 // Write back control register\r
297 b 4f\r
2982: msr sctlr_el2, x0 // Write back control register\r
299 b 4f\r
3003: msr sctlr_el3, x0 // Write back control register\r
3014: dsb sy\r
302 isb\r
303 ret\r
304\r
305\r
306// Always turned on in AArch64. Else implementation specific. Leave in for C compatibility for now\r
307ASM_PFX(ArmEnableBranchPrediction):\r
308 ret\r
309\r
310\r
311// Always turned on in AArch64. Else implementation specific. Leave in for C compatibility for now.\r
312ASM_PFX(ArmDisableBranchPrediction):\r
313 ret\r
314\r
315\r
316ASM_PFX(AArch64AllDataCachesOperation):\r
317// We can use regs 0-7 and 9-15 without having to save/restore.\r
fb7ea611
OM
318// Save our link register on the stack. - The stack must always be quad-word aligned\r
319 str x30, [sp, #-16]!\r
25402f5d
HL
320 mov x1, x0 // Save Function call in x1\r
321 mrs x6, clidr_el1 // Read EL1 CLIDR\r
322 and x3, x6, #0x7000000 // Mask out all but Level of Coherency (LoC)\r
433a49a0
OM
323 lsr x3, x3, #23 // Left align cache level value - the level is shifted by 1 to the\r
324 // right to ease the access to CSSELR and the Set/Way operation.\r
25402f5d
HL
325 cbz x3, L_Finished // No need to clean if LoC is 0\r
326 mov x10, #0 // Start clean at cache level 0\r
25402f5d
HL
327\r
328Loop1:\r
329 add x2, x10, x10, lsr #1 // Work out 3x cachelevel for cache info\r
330 lsr x12, x6, x2 // bottom 3 bits are the Cache type for this level\r
331 and x12, x12, #7 // get those 3 bits alone\r
332 cmp x12, #2 // what cache at this level?\r
333 b.lt L_Skip // no cache or only instruction cache at this level\r
334 msr csselr_el1, x10 // write the Cache Size selection register with current level (CSSELR)\r
335 isb // isb to sync the change to the CacheSizeID reg\r
336 mrs x12, ccsidr_el1 // reads current Cache Size ID register (CCSIDR)\r
337 and x2, x12, #0x7 // extract the line length field\r
338 add x2, x2, #4 // add 4 for the line length offset (log2 16 bytes)\r
339 mov x4, #0x400\r
340 sub x4, x4, #1\r
341 and x4, x4, x12, lsr #3 // x4 is the max number on the way size (right aligned)\r
342 clz w5, w4 // w5 is the bit position of the way size increment\r
343 mov x7, #0x00008000\r
344 sub x7, x7, #1\r
345 and x7, x7, x12, lsr #13 // x7 is the max number of the index size (right aligned)\r
346\r
347Loop2:\r
348 mov x9, x4 // x9 working copy of the max way size (right aligned)\r
349\r
350Loop3:\r
351 lsl x11, x9, x5\r
352 orr x0, x10, x11 // factor in the way number and cache number\r
353 lsl x11, x7, x2\r
354 orr x0, x0, x11 // factor in the index number\r
355\r
356 blr x1 // Goto requested cache operation\r
357\r
358 subs x9, x9, #1 // decrement the way number\r
359 b.ge Loop3\r
360 subs x7, x7, #1 // decrement the index\r
361 b.ge Loop2\r
362L_Skip:\r
363 add x10, x10, #2 // increment the cache number\r
364 cmp x3, x10\r
365 b.gt Loop1\r
366\r
367L_Finished:\r
368 dsb sy\r
369 isb\r
370 ldr x30, [sp], #0x10\r
371 ret\r
372\r
373\r
374ASM_PFX(ArmDataMemoryBarrier):\r
375 dmb sy\r
376 ret\r
377\r
378\r
cf93a378 379ASM_PFX(ArmDataSynchronizationBarrier):\r
25402f5d
HL
380 dsb sy\r
381 ret\r
382\r
383\r
384ASM_PFX(ArmInstructionSynchronizationBarrier):\r
385 isb\r
386 ret\r
387\r
388\r
389ASM_PFX(ArmWriteVBar):\r
390 EL1_OR_EL2_OR_EL3(x1)\r
3911: msr vbar_el1, x0 // Set the Address of the EL1 Vector Table in the VBAR register\r
392 b 4f\r
3932: msr vbar_el2, x0 // Set the Address of the EL2 Vector Table in the VBAR register\r
394 b 4f\r
3953: msr vbar_el3, x0 // Set the Address of the EL3 Vector Table in the VBAR register\r
3964: isb\r
397 ret\r
398\r
f0247796
OM
399ASM_PFX(ArmReadVBar):\r
400 EL1_OR_EL2_OR_EL3(x1)\r
4011: mrs x0, vbar_el1 // Set the Address of the EL1 Vector Table in the VBAR register\r
402 ret\r
4032: mrs x0, vbar_el2 // Set the Address of the EL2 Vector Table in the VBAR register\r
404 ret\r
4053: mrs x0, vbar_el3 // Set the Address of the EL3 Vector Table in the VBAR register\r
406 ret\r
407\r
408\r
25402f5d
HL
409ASM_PFX(ArmEnableVFP):\r
410 // Check whether floating-point is implemented in the processor.\r
411 mov x1, x30 // Save LR\r
412 bl ArmReadIdPfr0 // Read EL1 Processor Feature Register (PFR0)\r
413 mov x30, x1 // Restore LR\r
414 ands x0, x0, #AARCH64_PFR0_FP// Extract bits indicating VFP implementation\r
415 cmp x0, #0 // VFP is implemented if '0'.\r
416 b.ne 4f // Exit if VFP not implemented.\r
417 // FVP is implemented.\r
418 // Make sure VFP exceptions are not trapped (to any exception level).\r
419 mrs x0, cpacr_el1 // Read EL1 Coprocessor Access Control Register (CPACR)\r
420 orr x0, x0, #CPACR_VFP_BITS // Disable FVP traps to EL1\r
421 msr cpacr_el1, x0 // Write back EL1 Coprocessor Access Control Register (CPACR)\r
422 mov x1, #AARCH64_CPTR_TFP // TFP Bit for trapping VFP Exceptions\r
423 EL1_OR_EL2_OR_EL3(x2)\r
4241:ret // Not configurable in EL1\r
4252:mrs x0, cptr_el2 // Disable VFP traps to EL2\r
426 bic x0, x0, x1\r
427 msr cptr_el2, x0\r
428 ret\r
4293:mrs x0, cptr_el3 // Disable VFP traps to EL3\r
430 bic x0, x0, x1\r
431 msr cptr_el3, x0\r
4324:ret\r
433\r
434\r
435ASM_PFX(ArmCallWFI):\r
436 wfi\r
437 ret\r
438\r
439\r
25402f5d
HL
440ASM_PFX(ArmReadMpidr):\r
441 mrs x0, mpidr_el1 // read EL1 MPIDR\r
442 ret\r
443\r
444\r
445// Keep old function names for C compatibilty for now. Change later?\r
446ASM_PFX(ArmReadTpidrurw):\r
447 mrs x0, tpidr_el0 // read tpidr_el0 (v7 TPIDRURW) -> (v8 TPIDR_EL0)\r
448 ret\r
449\r
450\r
451// Keep old function names for C compatibilty for now. Change later?\r
452ASM_PFX(ArmWriteTpidrurw):\r
453 msr tpidr_el0, x0 // write tpidr_el0 (v7 TPIDRURW) -> (v8 TPIDR_EL0)\r
454 ret\r
455\r
456\r
457// Arch timers are mandatory on AArch64\r
458ASM_PFX(ArmIsArchTimerImplemented):\r
459 mov x0, #1\r
460 ret\r
461\r
462\r
463ASM_PFX(ArmReadIdPfr0):\r
464 mrs x0, id_aa64pfr0_el1 // Read ID_AA64PFR0 Register\r
465 ret\r
466\r
467\r
468// Q: id_aa64pfr1_el1 not defined yet. What does this funtion want to access?\r
469// A: used to setup arch timer. Check if we have security extensions, permissions to set stuff.\r
470// See: ArmPkg/Library/ArmArchTimerLib/AArch64/ArmArchTimerLib.c\r
471// Not defined yet, but stick in here for now, should read all zeros.\r
472ASM_PFX(ArmReadIdPfr1):\r
473 mrs x0, id_aa64pfr1_el1 // Read ID_PFR1 Register\r
474 ret\r
475\r
476// VOID ArmWriteHcr(UINTN Hcr)\r
477ASM_PFX(ArmWriteHcr):\r
478 msr hcr_el2, x0 // Write the passed HCR value\r
479 ret\r
480\r
d2bb61a2
EC
481// UINTN ArmReadHcr(VOID)\r
482ASM_PFX(ArmReadHcr):\r
483 mrs x0, hcr_el2\r
484 ret\r
485\r
25402f5d
HL
486// UINTN ArmReadCurrentEL(VOID)\r
487ASM_PFX(ArmReadCurrentEL):\r
488 mrs x0, CurrentEL\r
489 ret\r
490\r
61b02ba1
AB
491\r
492 .macro __replace_entry, el\r
493\r
494 // disable the MMU\r
495 mrs x8, sctlr_el\el\r
496 bic x9, x8, #CTRL_M_BIT\r
497 msr sctlr_el\el, x9\r
498 isb\r
499\r
500 // write updated entry\r
501 str x1, [x0]\r
502\r
503 // invalidate again to get rid of stale clean cachelines that may\r
504 // have been filled speculatively since the last invalidate\r
505 dmb sy\r
506 dc ivac, x0\r
507\r
508 // flush the TLBs\r
509 .if \el == 1\r
510 tlbi vmalle1\r
511 .else\r
512 tlbi alle\el\r
513 .endif\r
514 dsb sy\r
515\r
516 // re-enable the MMU\r
517 msr sctlr_el\el, x8\r
518 isb\r
519 .endm\r
520\r
521//VOID\r
522//ArmReplaceLiveTranslationEntry (\r
523// IN UINT64 *Entry,\r
524// IN UINT64 Value\r
525// )\r
526ASM_PFX(ArmReplaceLiveTranslationEntry):\r
527\r
528 // disable interrupts\r
529 mrs x2, daif\r
530 msr daifset, #0xf\r
531 isb\r
532\r
533 // clean and invalidate first so that we don't clobber\r
534 // adjacent entries that are dirty in the caches\r
535 dc civac, x0\r
536 dsb ish\r
537\r
538 EL1_OR_EL2_OR_EL3(x3)\r
5391:__replace_entry 1\r
540 b 4f\r
5412:__replace_entry 2\r
542 b 4f\r
5433:__replace_entry 3\r
544\r
5454:msr daif, x2\r
546 ret\r
547\r
548ASM_PFX(ArmReplaceLiveTranslationEntrySize):\r
549 .long . - ArmReplaceLiveTranslationEntry\r
550\r
25402f5d 551ASM_FUNCTION_REMOVE_IF_UNREFERENCED\r