TianoCore EDK2
master
Loading...
Searching...
No Matches
AsmMacroLib.h
Go to the documentation of this file.
1
12
#ifndef ASM_MACRO_IO_LIBV8_H_
13
#define ASM_MACRO_IO_LIBV8_H_
14
15
// CurrentEL : 0xC = EL3; 8 = EL2; 4 = EL1
16
// This only selects between EL1 and EL2, else we die.
17
// Provide the Macro with a safe temp xreg to use.
18
#define EL1_OR_EL2(SAFE_XREG) \
19
mrs SAFE_XREG, CurrentEL ;\
20
cmp SAFE_XREG, #0x8 ;\
21
b.gt . ;\
22
b.eq 2f ;\
23
cbnz SAFE_XREG, 1f ;\
24
b . ;
// We should never get here
25
26
#define _ASM_FUNC(Name, Section) \
27
.global Name ; \
28
.section #Section, "ax"
; \
29
.type Name, %function ; \
30
Name: ; \
31
AARCH64_BTI(c)
32
33
#define _ASM_FUNC_ALIGN(Name, Section, Align) \
34
.global Name ; \
35
.section #Section, "ax"
; \
36
.type Name, %function ; \
37
.balign Align ; \
38
Name: ; \
39
AARCH64_BTI(c)
40
41
#define ASM_FUNC(Name) _ASM_FUNC(ASM_PFX(Name), .text. ## Name)
42
43
#define ASM_FUNC_ALIGN(Name, Align) \
44
_ASM_FUNC_ALIGN(ASM_PFX(Name), .text. ## Name, Align)
45
46
#define MOV32(Reg, Val) \
47
movz Reg, (Val) >> 16, lsl #16 ; \
48
movk Reg, (Val) & 0xffff
49
50
#define MOV64(Reg, Val) \
51
movz Reg, (Val) >> 48, lsl #48 ; \
52
movk Reg, ((Val) >> 32) & 0xffff, lsl #32 ; \
53
movk Reg, ((Val) >> 16) & 0xffff, lsl #16 ; \
54
movk Reg, (Val) & 0xffff
55
56
#endif
// ASM_MACRO_IO_LIBV8_H_
MdePkg
Include
AArch64
AsmMacroLib.h
Generated on Fri Nov 15 2024 18:01:14 for TianoCore EDK2 by
1.9.6