]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Include/AsmMacroIoLibV8.h
BaseTools/Capsule: Do not support -o with --dump-info
[mirror_edk2.git] / ArmPkg / Include / AsmMacroIoLibV8.h
CommitLineData
25402f5d 1/** @file\r
5f1103bd 2 Macros to work around lack of Clang support for LDR register, =expr\r
25402f5d
HL
3\r
4 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
0a6f2862 5 Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>\r
d2d0e27c 6 Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>\r
25402f5d
HL
7\r
8 This program and the accompanying materials\r
9 are licensed and made available under the terms and conditions of the BSD License\r
10 which accompanies this distribution. The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16**/\r
17\r
18\r
19#ifndef __MACRO_IO_LIBV8_H__\r
20#define __MACRO_IO_LIBV8_H__\r
21\r
25402f5d
HL
22// CurrentEL : 0xC = EL3; 8 = EL2; 4 = EL1\r
23// This only selects between EL1 and EL2, else we die.\r
24// Provide the Macro with a safe temp xreg to use.\r
25#define EL1_OR_EL2(SAFE_XREG) \\r
26 mrs SAFE_XREG, CurrentEL ;\\r
eaa84fd5 27 cmp SAFE_XREG, #0x8 ;\\r
a34608ca 28 b.gt . ;\\r
eaa84fd5 29 b.eq 2f ;\\r
a34608ca
AB
30 cbnz SAFE_XREG, 1f ;\\r
31 b . ;// We should never get here\r
32\r
25402f5d
HL
33\r
34// CurrentEL : 0xC = EL3; 8 = EL2; 4 = EL1\r
35// This only selects between EL1 and EL2 and EL3, else we die.\r
36// Provide the Macro with a safe temp xreg to use.\r
eaa84fd5 37#define EL1_OR_EL2_OR_EL3(SAFE_XREG) \\r
25402f5d 38 mrs SAFE_XREG, CurrentEL ;\\r
eaa84fd5 39 cmp SAFE_XREG, #0x8 ;\\r
a34608ca 40 b.gt 3f ;\\r
eaa84fd5 41 b.eq 2f ;\\r
a34608ca
AB
42 cbnz SAFE_XREG, 1f ;\\r
43 b . ;// We should never get here\r
44\r
d2d0e27c
AB
45#define _ASM_FUNC(Name, Section) \\r
46 .global Name ; \\r
47 .section #Section, "ax" ; \\r
48 .type Name, %function ; \\r
49 Name:\r
50\r
51#define ASM_FUNC(Name) _ASM_FUNC(ASM_PFX(Name), .text. ## Name)\r
52\r
53#define MOV32(Reg, Val) \\r
54 movz Reg, (Val) >> 16, lsl #16 ; \\r
55 movk Reg, (Val) & 0xffff\r
25402f5d 56\r
d2d0e27c
AB
57#define MOV64(Reg, Val) \\r
58 movz Reg, (Val) >> 48, lsl #48 ; \\r
59 movk Reg, ((Val) >> 32) & 0xffff, lsl #32 ; \\r
60 movk Reg, ((Val) >> 16) & 0xffff, lsl #16 ; \\r
61 movk Reg, (Val) & 0xffff\r
62\r
63#endif // __MACRO_IO_LIBV8_H__\r