]>
Commit | Line | Data |
---|---|---|
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 |
25402f5d HL |
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_LIBV8_H__\r | |
19 | #define __MACRO_IO_LIBV8_H__\r | |
20 | \r | |
25402f5d HL |
21 | // CurrentEL : 0xC = EL3; 8 = EL2; 4 = EL1\r |
22 | // This only selects between EL1 and EL2, else we die.\r | |
23 | // Provide the Macro with a safe temp xreg to use.\r | |
24 | #define EL1_OR_EL2(SAFE_XREG) \\r | |
25 | mrs SAFE_XREG, CurrentEL ;\\r | |
eaa84fd5 OM |
26 | cmp SAFE_XREG, #0x8 ;\\r |
27 | b.eq 2f ;\\r | |
28 | cmp SAFE_XREG, #0x4 ;\\r | |
29 | b.ne . ;// We should never get here\r | |
30 | // EL1 code starts here\r | |
25402f5d HL |
31 | \r |
32 | // CurrentEL : 0xC = EL3; 8 = EL2; 4 = EL1\r | |
33 | // This only selects between EL1 and EL2 and EL3, else we die.\r | |
34 | // Provide the Macro with a safe temp xreg to use.\r | |
eaa84fd5 | 35 | #define EL1_OR_EL2_OR_EL3(SAFE_XREG) \\r |
25402f5d | 36 | mrs SAFE_XREG, CurrentEL ;\\r |
eaa84fd5 OM |
37 | cmp SAFE_XREG, #0xC ;\\r |
38 | b.eq 3f ;\\r | |
39 | cmp SAFE_XREG, #0x8 ;\\r | |
40 | b.eq 2f ;\\r | |
25402f5d | 41 | cmp SAFE_XREG, #0x4 ;\\r |
eaa84fd5 OM |
42 | b.ne . ;// We should never get here\r |
43 | // EL1 code starts here\r | |
5f1103bd OM |
44 | #if defined(__clang__)\r |
45 | \r | |
46 | // load x0 with _Data\r | |
47 | #define LoadConstant(_Data) \\r | |
48 | ldr x0, 1f ; \\r | |
49 | b 2f ; \\r | |
50 | .align(8) ; \\r | |
51 | 1: \\r | |
52 | .8byte (_Data) ; \\r | |
53 | 2:\r | |
54 | \r | |
55 | // load _Reg with _Data\r | |
56 | #define LoadConstantToReg(_Data, _Reg) \\r | |
57 | ldr _Reg, 1f ; \\r | |
58 | b 2f ; \\r | |
59 | .align(8) ; \\r | |
60 | 1: \\r | |
61 | .8byte (_Data) ; \\r | |
62 | 2:\r | |
63 | \r | |
64 | #elif defined (__GNUC__)\r | |
25402f5d | 65 | \r |
5f1103bd OM |
66 | #define LoadConstant(Data) \\r |
67 | ldr x0, =Data\r | |
25402f5d | 68 | \r |
5f1103bd OM |
69 | #define LoadConstantToReg(Data, Reg) \\r |
70 | ldr Reg, =Data\r | |
25402f5d | 71 | \r |
5f1103bd | 72 | #endif // __GNUC__\r |
25402f5d HL |
73 | \r |
74 | #endif // __MACRO_IO_LIBV8_H__\r | |
75 | \r |