]>
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>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #ifndef __MACRO_IO_LIBV8_H__
19 #define __MACRO_IO_LIBV8_H__
21 // CurrentEL : 0xC = EL3; 8 = EL2; 4 = EL1
22 // This only selects between EL1 and EL2, else we die.
23 // Provide the Macro with a safe temp xreg to use.
24 #define EL1_OR_EL2(SAFE_XREG) \
25 mrs SAFE_XREG, CurrentEL ;\
26 cmp SAFE_XREG, #0x8 ;\
28 cmp SAFE_XREG, #0x4 ;\
29 b.ne . ;// We should never get here
30 // EL1 code starts here
32 // CurrentEL : 0xC = EL3; 8 = EL2; 4 = EL1
33 // This only selects between EL1 and EL2 and EL3, else we die.
34 // Provide the Macro with a safe temp xreg to use.
35 #define EL1_OR_EL2_OR_EL3(SAFE_XREG) \
36 mrs SAFE_XREG, CurrentEL ;\
37 cmp SAFE_XREG, #0xC ;\
39 cmp SAFE_XREG, #0x8 ;\
41 cmp SAFE_XREG, #0x4 ;\
42 b.ne . ;// We should never get here
43 // EL1 code starts here
44 #if defined(__clang__)
47 #define LoadConstant(_Data) \
55 // load _Reg with _Data
56 #define LoadConstantToReg(_Data, _Reg) \
64 #elif defined (__GNUC__)
66 #define LoadConstant(Data) \
69 #define LoadConstantToReg(Data, Reg) \
74 #endif // __MACRO_IO_LIBV8_H__