]>
git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Include/AsmMacroIoLibV8.h
2 Macros to work around lack of Clang support for LDR register, =expr
4 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
5 Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
6 Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
13 #ifndef __MACRO_IO_LIBV8_H__
14 #define __MACRO_IO_LIBV8_H__
16 // CurrentEL : 0xC = EL3; 8 = EL2; 4 = EL1
17 // This only selects between EL1 and EL2, else we die.
18 // Provide the Macro with a safe temp xreg to use.
19 #define EL1_OR_EL2(SAFE_XREG) \
20 mrs SAFE_XREG, CurrentEL ;\
21 cmp SAFE_XREG, #0x8 ;\
25 b . ;// We should never get here
28 // CurrentEL : 0xC = EL3; 8 = EL2; 4 = EL1
29 // This only selects between EL1 and EL2 and EL3, else we die.
30 // Provide the Macro with a safe temp xreg to use.
31 #define EL1_OR_EL2_OR_EL3(SAFE_XREG) \
32 mrs SAFE_XREG, CurrentEL ;\
33 cmp SAFE_XREG, #0x8 ;\
37 b . ;// We should never get here
39 #define _ASM_FUNC(Name, Section) \
41 .section #Section, "ax" ; \
42 .type Name, %function ; \
45 #define ASM_FUNC(Name) _ASM_FUNC(ASM_PFX(Name), .text. ## Name)
47 #define MOV32(Reg, Val) \
48 movz Reg, (Val) >> 16, lsl #16 ; \
49 movk Reg, (Val) & 0xffff
51 #define MOV64(Reg, Val) \
52 movz Reg, (Val) >> 48, lsl #48 ; \
53 movk Reg, ((Val) >> 32) & 0xffff, lsl #32 ; \
54 movk Reg, ((Val) >> 16) & 0xffff, lsl #16 ; \
55 movk Reg, (Val) & 0xffff
57 #endif // __MACRO_IO_LIBV8_H__