]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Macros to work around lack of Apple support for LDR register, =expr\r | |
3 | \r | |
4 | Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r | |
5 | Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>\r | |
6 | Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>\r | |
7 | \r | |
8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
9 | \r | |
10 | **/\r | |
11 | \r | |
12 | \r | |
13 | #ifndef ASM_MACRO_IO_LIB_H_\r | |
14 | #define ASM_MACRO_IO_LIB_H_\r | |
15 | \r | |
16 | #define _ASM_FUNC(Name, Section) \\r | |
17 | .global Name ; \\r | |
18 | .section #Section, "ax" ; \\r | |
19 | .type Name, %function ; \\r | |
20 | .p2align 2 ; \\r | |
21 | Name:\r | |
22 | \r | |
23 | #define ASM_FUNC(Name) _ASM_FUNC(ASM_PFX(Name), .text. ## Name)\r | |
24 | \r | |
25 | #define MOV32(Reg, Val) \\r | |
26 | movw Reg, #(Val) & 0xffff ; \\r | |
27 | movt Reg, #(Val) >> 16\r | |
28 | \r | |
29 | #define ADRL(Reg, Sym) \\r | |
30 | movw Reg, #:lower16:(Sym) - (. + 16) ; \\r | |
31 | movt Reg, #:upper16:(Sym) - (. + 12) ; \\r | |
32 | add Reg, Reg, pc\r | |
33 | \r | |
34 | #define LDRL(Reg, Sym) \\r | |
35 | movw Reg, #:lower16:(Sym) - (. + 16) ; \\r | |
36 | movt Reg, #:upper16:(Sym) - (. + 12) ; \\r | |
37 | ldr Reg, [pc, Reg]\r | |
38 | \r | |
39 | #endif // ASM_MACRO_IO_LIB_H_\r |