]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibReplaceEntry.S
ArmLib: remove ArmReplaceLiveTranslationEntry() implementation
[mirror_edk2.git] / ArmPkg / Library / ArmMmuLib / AArch64 / ArmMmuLibReplaceEntry.S
1 #------------------------------------------------------------------------------
2 #
3 # Copyright (c) 2016, Linaro Limited. All rights reserved.
4 #
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
9 #
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.
12 #
13 #------------------------------------------------------------------------------
14
15 #include <AsmMacroIoLibV8.h>
16
17 GCC_ASM_EXPORT(ArmReplaceLiveTranslationEntry)
18
19 .set CTRL_M_BIT, (1 << 0)
20
21 .macro __replace_entry, el
22
23 // disable the MMU
24 mrs x8, sctlr_el\el
25 bic x9, x8, #CTRL_M_BIT
26 msr sctlr_el\el, x9
27 isb
28
29 // write updated entry
30 str x1, [x0]
31
32 // invalidate again to get rid of stale clean cachelines that may
33 // have been filled speculatively since the last invalidate
34 dmb sy
35 dc ivac, x0
36
37 // flush the TLBs
38 .if \el == 1
39 tlbi vmalle1
40 .else
41 tlbi alle\el
42 .endif
43 dsb sy
44
45 // re-enable the MMU
46 msr sctlr_el\el, x8
47 isb
48 .endm
49
50 //VOID
51 //ArmReplaceLiveTranslationEntry (
52 // IN UINT64 *Entry,
53 // IN UINT64 Value
54 // )
55 ASM_PFX(ArmReplaceLiveTranslationEntry):
56
57 // disable interrupts
58 mrs x2, daif
59 msr daifset, #0xf
60 isb
61
62 // clean and invalidate first so that we don't clobber
63 // adjacent entries that are dirty in the caches
64 dc civac, x0
65 dsb ish
66
67 EL1_OR_EL2_OR_EL3(x3)
68 1:__replace_entry 1
69 b 4f
70 2:__replace_entry 2
71 b 4f
72 3:__replace_entry 3
73
74 4:msr daif, x2
75 ret
76
77 ASM_GLOBAL ASM_PFX(ArmReplaceLiveTranslationEntrySize)
78
79 ASM_PFX(ArmReplaceLiveTranslationEntrySize):
80 .long . - ArmReplaceLiveTranslationEntry