]>
Commit | Line | Data |
---|---|---|
2ef2b01e A |
1 | /** @file\r |
2 | Macros to work around lack of Apple support for LDR register, =expr\r | |
3 | \r | |
d6ebcab7 | 4 | Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r |
1377db63 | 5 | Copyright (c) 2011-2012, ARM Ltd. All rights reserved.<BR>\r |
d2d0e27c | 6 | Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>\r |
2ef2b01e | 7 | \r |
d6ebcab7 | 8 | This program and the accompanying materials\r |
2ef2b01e A |
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_LIB_H__\r | |
20 | #define __MACRO_IO_LIB_H__\r | |
21 | \r | |
d2d0e27c AB |
22 | #define _ASM_FUNC(Name, Section) \\r |
23 | .global Name ; \\r | |
24 | .section #Section, "ax" ; \\r | |
25 | .type Name, %function ; \\r | |
493b4045 | 26 | .p2align 2 ; \\r |
d2d0e27c AB |
27 | Name:\r |
28 | \r | |
29 | #define ASM_FUNC(Name) _ASM_FUNC(ASM_PFX(Name), .text. ## Name)\r | |
30 | \r | |
31 | #define MOV32(Reg, Val) \\r | |
32 | movw Reg, #(Val) & 0xffff ; \\r | |
33 | movt Reg, #(Val) >> 16\r | |
34 | \r | |
35 | #define ADRL(Reg, Sym) \\r | |
36 | movw Reg, #:lower16:(Sym) - (. + 16) ; \\r | |
37 | movt Reg, #:upper16:(Sym) - (. + 12) ; \\r | |
38 | add Reg, Reg, pc\r | |
39 | \r | |
40 | #define LDRL(Reg, Sym) \\r | |
41 | movw Reg, #:lower16:(Sym) - (. + 16) ; \\r | |
42 | movt Reg, #:upper16:(Sym) - (. + 12) ; \\r | |
43 | ldr Reg, [pc, Reg]\r | |
44 | \r | |
2ef2b01e | 45 | #endif\r |