]>
Commit | Line | Data |
---|---|---|
ebd04fc2 | 1 | /** @file\r |
2 | Processor or Compiler specific defines and types for ARM.\r | |
3 | \r | |
987363c9 | 4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9df063a0 | 5 | Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r |
987363c9 LG |
6 | This program and the accompanying materials\r |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
ebd04fc2 | 10 | \r |
987363c9 LG |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
ebd04fc2 | 13 | \r |
14 | **/\r | |
15 | \r | |
16 | #ifndef __PROCESSOR_BIND_H__\r | |
17 | #define __PROCESSOR_BIND_H__\r | |
18 | \r | |
19 | ///\r | |
20 | /// Define the processor type so other code can make processor based choices\r | |
21 | ///\r | |
22 | #define MDE_CPU_ARM\r | |
23 | \r | |
24 | //\r | |
ea3c1b3a | 25 | // Make sure we are using the correct packing rules per EFI specification\r |
ebd04fc2 | 26 | //\r |
5b8766bb | 27 | #if !defined(__GNUC__) && !defined(__ASSEMBLER__)\r |
ebd04fc2 | 28 | #pragma pack()\r |
29 | #endif\r | |
30 | \r | |
987363c9 LG |
31 | #if defined(_MSC_EXTENSIONS)\r |
32 | \r | |
33 | //\r | |
34 | // Disable some level 4 compilation warnings (same as IA32 and X64)\r | |
35 | //\r | |
36 | \r | |
37 | //\r | |
38 | // Disabling bitfield type checking warnings.\r | |
39 | //\r | |
40 | #pragma warning ( disable : 4214 )\r | |
41 | \r | |
42 | //\r | |
43 | // Disabling the unreferenced formal parameter warnings.\r | |
44 | //\r | |
45 | #pragma warning ( disable : 4100 )\r | |
46 | \r | |
47 | //\r | |
48 | // Disable slightly different base types warning as CHAR8 * can not be set\r | |
49 | // to a constant string.\r | |
50 | //\r | |
51 | #pragma warning ( disable : 4057 )\r | |
52 | \r | |
53 | //\r | |
54 | // ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning\r | |
55 | //\r | |
56 | #pragma warning ( disable : 4127 )\r | |
57 | \r | |
58 | //\r | |
59 | // This warning is caused by functions defined but not used. For precompiled header only.\r | |
60 | //\r | |
61 | #pragma warning ( disable : 4505 )\r | |
62 | \r | |
63 | //\r | |
64 | // This warning is caused by empty (after preprocessing) source file. For precompiled header only.\r | |
65 | //\r | |
66 | #pragma warning ( disable : 4206 )\r | |
67 | \r | |
68 | //\r | |
69 | // Disable 'potentially uninitialized local variable X used' warnings\r | |
70 | //\r | |
71 | #pragma warning ( disable : 4701 )\r | |
72 | \r | |
73 | //\r | |
74 | // Disable 'potentially uninitialized local pointer variable X used' warnings\r | |
75 | //\r | |
76 | #pragma warning ( disable : 4703 )\r | |
77 | \r | |
78 | #endif\r | |
79 | \r | |
82df6187 | 80 | //\r |
987363c9 | 81 | // RVCT and MSFT don't support the __builtin_unreachable() macro\r |
82df6187 | 82 | //\r |
987363c9 | 83 | #if defined(__ARMCC_VERSION) || defined(_MSC_EXTENSIONS)\r |
82df6187 AB |
84 | #define UNREACHABLE()\r |
85 | #endif\r | |
86 | \r | |
987363c9 | 87 | #if defined(_MSC_EXTENSIONS)\r |
ebd04fc2 | 88 | //\r |
00b7cc0f | 89 | // use Microsoft* C compiler dependent integer width types\r |
ebd04fc2 | 90 | //\r |
91 | typedef unsigned __int64 UINT64;\r | |
92 | typedef __int64 INT64;\r | |
93 | typedef unsigned __int32 UINT32;\r | |
94 | typedef __int32 INT32;\r | |
95 | typedef unsigned short UINT16;\r | |
96 | typedef unsigned short CHAR16;\r | |
97 | typedef short INT16;\r | |
98 | typedef unsigned char BOOLEAN;\r | |
99 | typedef unsigned char UINT8;\r | |
100 | typedef char CHAR8;\r | |
d22ebbe3 | 101 | typedef signed char INT8;\r |
ebd04fc2 | 102 | #else\r |
103 | //\r | |
987363c9 | 104 | // Assume standard ARM alignment.\r |
ebd04fc2 | 105 | // Need to check portability of long long\r |
106 | //\r | |
107 | typedef unsigned long long UINT64;\r | |
108 | typedef long long INT64;\r | |
109 | typedef unsigned int UINT32;\r | |
110 | typedef int INT32;\r | |
111 | typedef unsigned short UINT16;\r | |
112 | typedef unsigned short CHAR16;\r | |
113 | typedef short INT16;\r | |
114 | typedef unsigned char BOOLEAN;\r | |
115 | typedef unsigned char UINT8;\r | |
116 | typedef char CHAR8;\r | |
d22ebbe3 | 117 | typedef signed char INT8;\r |
ebd04fc2 | 118 | #endif\r |
119 | \r | |
4e094cba | 120 | ///\r |
121 | /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,\r | |
122 | /// 8 bytes on supported 64-bit processor instructions)\r | |
123 | ///\r | |
ebd04fc2 | 124 | typedef UINT32 UINTN;\r |
125 | \r | |
4e094cba | 126 | ///\r |
127 | /// Signed value of native width. (4 bytes on supported 32-bit processor instructions,\r | |
128 | /// 8 bytes on supported 64-bit processor instructions)\r | |
129 | ///\r | |
ebd04fc2 | 130 | typedef INT32 INTN;\r |
131 | \r | |
132 | //\r | |
133 | // Processor specific defines\r | |
134 | //\r | |
4e094cba | 135 | \r |
136 | ///\r | |
137 | /// A value of native width with the highest bit set.\r | |
138 | ///\r | |
ebd04fc2 | 139 | #define MAX_BIT 0x80000000\r |
140 | \r | |
4e094cba | 141 | ///\r |
142 | /// A value of native width with the two highest bits set.\r | |
143 | ///\r | |
ebd04fc2 | 144 | #define MAX_2_BITS 0xC0000000\r |
145 | \r | |
146 | ///\r | |
147 | /// Maximum legal ARM address\r | |
148 | ///\r | |
149 | #define MAX_ADDRESS 0xFFFFFFFF\r | |
150 | \r | |
068a82fc LG |
151 | ///\r |
152 | /// Maximum legal ARM INTN and UINTN values.\r | |
153 | ///\r | |
154 | #define MAX_INTN ((INTN)0x7FFFFFFF)\r | |
155 | #define MAX_UINTN ((UINTN)0xFFFFFFFF)\r | |
156 | \r | |
d7a09cb8 SB |
157 | ///\r |
158 | /// Minimum legal ARM INTN value.\r | |
159 | ///\r | |
160 | #define MIN_INTN (((INTN)-2147483647) - 1)\r | |
161 | \r | |
ebd04fc2 | 162 | ///\r |
163 | /// The stack alignment required for ARM\r | |
164 | ///\r | |
165 | #define CPU_STACK_ALIGNMENT sizeof(UINT64)\r | |
166 | \r | |
08855193 AB |
167 | ///\r |
168 | /// Page allocation granularity for ARM\r | |
169 | ///\r | |
170 | #define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)\r | |
171 | #define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x1000)\r | |
172 | \r | |
ebd04fc2 | 173 | //\r |
174 | // Modifier to ensure that all protocol member functions and EFI intrinsics\r | |
175 | // use the correct C calling convention. All protocol member functions and\r | |
ea3c1b3a | 176 | // EFI intrinsics are required to modify their member functions with EFIAPI.\r |
ebd04fc2 | 177 | //\r |
987363c9 | 178 | #define EFIAPI\r |
ebd04fc2 | 179 | \r |
ba0a34f1 OM |
180 | // When compiling with Clang, we still use GNU as for the assembler, so we still\r |
181 | // need to define the GCC_ASM* macros.\r | |
182 | #if defined(__GNUC__) || defined(__clang__)\r | |
ebd04fc2 | 183 | ///\r |
184 | /// For GNU assembly code, .global or .globl can declare global symbols.\r | |
185 | /// Define this macro to unify the usage.\r | |
186 | ///\r | |
187 | #define ASM_GLOBAL .globl\r | |
e7cb469e | 188 | \r |
189 | #if !defined(__APPLE__)\r | |
190 | ///\r | |
191 | /// ARM EABI defines that the linker should not manipulate call relocations\r | |
192 | /// (do bl/blx conversion) unless the target symbol has function type.\r | |
193 | /// CodeSourcery 2010.09 started requiring the .type to function properly\r | |
194 | ///\r | |
195 | #define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function\r | |
4c8a6e06 | 196 | \r |
197 | #define GCC_ASM_EXPORT(func__) \\r | |
198 | .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\\r | |
987363c9 | 199 | .type ASM_PFX(func__), %function\r |
4c8a6e06 | 200 | \r |
201 | #define GCC_ASM_IMPORT(func__) \\r | |
202 | .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)\r | |
987363c9 | 203 | \r |
e7cb469e | 204 | #else\r |
205 | //\r | |
987363c9 | 206 | // .type not supported by Apple Xcode tools\r |
e7cb469e | 207 | //\r |
987363c9 | 208 | #define INTERWORK_FUNC(func__)\r |
4c8a6e06 | 209 | \r |
210 | #define GCC_ASM_EXPORT(func__) \\r | |
211 | .globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \\r | |
987363c9 LG |
212 | \r |
213 | #define GCC_ASM_IMPORT(name)\r | |
4c8a6e06 | 214 | \r |
e7cb469e | 215 | #endif\r |
987363c9 LG |
216 | #elif defined(_MSC_EXTENSIONS)\r |
217 | //\r | |
218 | // PRESERVE8 is not supported by the MSFT assembler.\r | |
219 | //\r | |
220 | #define PRESERVE8\r | |
ebd04fc2 | 221 | #endif\r |
222 | \r | |
4e094cba | 223 | /**\r |
224 | Return the pointer to the first instruction of a function given a function pointer.\r | |
987363c9 | 225 | On ARM CPU architectures, these two pointer values are the same,\r |
4e094cba | 226 | so the implementation of this macro is very simple.\r |
987363c9 | 227 | \r |
4e094cba | 228 | @param FunctionPointer A pointer to a function.\r |
229 | \r | |
230 | @return The pointer to the first instruction of a function given a function pointer.\r | |
987363c9 | 231 | \r |
4e094cba | 232 | **/\r |
1afe0401 | 233 | #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r |
ebd04fc2 | 234 | \r |
02eef553 JJ |
235 | #ifndef __USER_LABEL_PREFIX__\r |
236 | #define __USER_LABEL_PREFIX__\r | |
237 | #endif\r | |
238 | \r | |
ebd04fc2 | 239 | #endif\r |
4c8a6e06 | 240 | \r |
241 | \r |