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