]>
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 | \r | |
7 | This program and the accompanying materials\r | |
8 | are licensed and made available under the terms and conditions of the BSD License\r | |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | \r | |
18 | #ifndef __MACRO_IO_LIB_H__\r | |
19 | #define __MACRO_IO_LIB_H__\r | |
20 | \r | |
21 | #if defined(__APPLE__)\r | |
22 | \r | |
23 | //\r | |
24 | // ldr reg, =expr does not work with current Apple tool chain. So do the work our selves\r | |
25 | //\r | |
26 | \r | |
27 | // load _Reg with _Data\r | |
28 | #define LoadConstantToReg(_Data, _Reg) \\r | |
29 | ldr _Reg, [pc, #0] ; \\r | |
30 | b 1f ; \\r | |
31 | .long (_Data) ; \\r | |
32 | 1:\r | |
33 | \r | |
34 | #elif defined (__GNUC__)\r | |
35 | \r | |
36 | #define LoadConstantToReg(Data, Reg) \\r | |
37 | ldr Reg, =Data\r | |
38 | \r | |
39 | #else\r | |
40 | \r | |
41 | //\r | |
42 | // Use ARM assembly macros, form armasam\r | |
43 | //\r | |
44 | // Less magic in the macros if ldr reg, =expr works\r | |
45 | //\r | |
46 | \r | |
47 | // load _Reg with _Data\r | |
48 | \r | |
49 | \r | |
50 | #define LoadConstantToReg(Data, Reg) LoadConstantToRegMacro Data, Reg\r | |
51 | \r | |
52 | #endif\r | |
53 | \r | |
54 | #endif\r |