]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Include/AsmMacroIoLib.h
MdeModulePkg/FaultTolerantWriteDxe: implement standalone MM version
[mirror_edk2.git] / ArmPkg / Include / AsmMacroIoLib.h
1 /** @file
2 Macros to work around lack of Apple support for LDR register, =expr
3
4 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
5 Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>
6 Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
7
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17
18
19 #ifndef __MACRO_IO_LIB_H__
20 #define __MACRO_IO_LIB_H__
21
22 #define _ASM_FUNC(Name, Section) \
23 .global Name ; \
24 .section #Section, "ax" ; \
25 .type Name, %function ; \
26 .p2align 2 ; \
27 Name:
28
29 #define ASM_FUNC(Name) _ASM_FUNC(ASM_PFX(Name), .text. ## Name)
30
31 #define MOV32(Reg, Val) \
32 movw Reg, #(Val) & 0xffff ; \
33 movt Reg, #(Val) >> 16
34
35 #define ADRL(Reg, Sym) \
36 movw Reg, #:lower16:(Sym) - (. + 16) ; \
37 movt Reg, #:upper16:(Sym) - (. + 12) ; \
38 add Reg, Reg, pc
39
40 #define LDRL(Reg, Sym) \
41 movw Reg, #:lower16:(Sym) - (. + 16) ; \
42 movt Reg, #:upper16:(Sym) - (. + 12) ; \
43 ldr Reg, [pc, Reg]
44
45 #endif