]>
Commit | Line | Data |
---|---|---|
959ccb23 | 1 | /** @file\r |
1a2f870c | 2 | Processor or Compiler specific defines and types for IA-32 architecture.\r |
959ccb23 | 3 | \r |
9095d37b | 4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
959ccb23 | 6 | \r |
959ccb23 | 7 | **/\r |
8 | \r | |
9 | #ifndef __PROCESSOR_BIND_H__\r | |
10 | #define __PROCESSOR_BIND_H__\r | |
11 | \r | |
3566565a | 12 | ///\r |
8c18db27 | 13 | /// Define the processor type so other code can make processor based choices.\r |
3566565a | 14 | ///\r |
959ccb23 | 15 | #define MDE_CPU_IA32\r |
16 | \r | |
17 | //\r | |
3963c4bf | 18 | // Make sure we are using the correct packing rules per EFI specification\r |
959ccb23 | 19 | //\r |
2f88bd3a MK |
20 | #if !defined (__GNUC__)\r |
21 | #pragma pack()\r | |
959ccb23 | 22 | #endif\r |
23 | \r | |
2f88bd3a | 24 | #if defined (__INTEL_COMPILER)\r |
ed300ce2 | 25 | //\r |
26 | // Disable ICC's remark #869: "Parameter" was never referenced warning.\r | |
27 | // This is legal ANSI C code so we disable the remark that is turned on with -Wall\r | |
28 | //\r | |
2f88bd3a | 29 | #pragma warning ( disable : 869 )\r |
ed300ce2 | 30 | \r |
b483e395 A |
31 | //\r |
32 | // Disable ICC's remark #1418: external function definition with no prior declaration.\r | |
33 | // This is legal ANSI C code so we disable the remark that is turned on with /W4\r | |
34 | //\r | |
2f88bd3a | 35 | #pragma warning ( disable : 1418 )\r |
b483e395 | 36 | \r |
b483e395 A |
37 | //\r |
38 | // Disable ICC's remark #1419: external declaration in primary source file\r | |
39 | // This is legal ANSI C code so we disable the remark that is turned on with /W4\r | |
40 | //\r | |
2f88bd3a | 41 | #pragma warning ( disable : 1419 )\r |
b483e395 | 42 | \r |
8fe69f13 | 43 | //\r |
44 | // Disable ICC's remark #593: "Variable" was set but never used.\r | |
45 | // This is legal ANSI C code so we disable the remark that is turned on with /W4\r | |
46 | //\r | |
2f88bd3a | 47 | #pragma warning ( disable : 593 )\r |
8fe69f13 | 48 | \r |
b483e395 A |
49 | #endif\r |
50 | \r | |
2f88bd3a | 51 | #if defined (_MSC_EXTENSIONS)\r |
959ccb23 | 52 | \r |
53 | //\r | |
54 | // Disable warning that make it impossible to compile at /W4\r | |
55 | // This only works for Microsoft* tools\r | |
56 | //\r | |
57 | \r | |
58 | //\r | |
59 | // Disabling bitfield type checking warnings.\r | |
60 | //\r | |
2f88bd3a | 61 | #pragma warning ( disable : 4214 )\r |
959ccb23 | 62 | \r |
63 | //\r | |
64 | // Disabling the unreferenced formal parameter warnings.\r | |
65 | //\r | |
2f88bd3a | 66 | #pragma warning ( disable : 4100 )\r |
959ccb23 | 67 | \r |
68 | //\r | |
69 | // Disable slightly different base types warning as CHAR8 * can not be set\r | |
70 | // to a constant string.\r | |
71 | //\r | |
2f88bd3a | 72 | #pragma warning ( disable : 4057 )\r |
959ccb23 | 73 | \r |
74 | //\r | |
00b7cc0f | 75 | // ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning\r |
959ccb23 | 76 | //\r |
2f88bd3a | 77 | #pragma warning ( disable : 4127 )\r |
959ccb23 | 78 | \r |
79 | //\r | |
80 | // This warning is caused by functions defined but not used. For precompiled header only.\r | |
81 | //\r | |
2f88bd3a | 82 | #pragma warning ( disable : 4505 )\r |
959ccb23 | 83 | \r |
84 | //\r | |
3963c4bf | 85 | // This warning is caused by empty (after preprocessing) source file. For precompiled header only.\r |
959ccb23 | 86 | //\r |
2f88bd3a | 87 | #pragma warning ( disable : 4206 )\r |
959ccb23 | 88 | \r |
2f88bd3a | 89 | #if defined (_MSC_VER) && _MSC_VER >= 1800\r |
a5077fd0 SQ |
90 | \r |
91 | //\r | |
92 | // Disable these warnings for VS2013.\r | |
93 | //\r | |
94 | \r | |
95 | //\r | |
9095d37b | 96 | // This warning is for potentially uninitialized local variable, and it may cause false\r |
592a3790 | 97 | // positive issues in VS2013 and VS2015 build\r |
a5077fd0 | 98 | //\r |
2f88bd3a | 99 | #pragma warning ( disable : 4701 )\r |
9095d37b | 100 | \r |
a5077fd0 | 101 | //\r |
9095d37b | 102 | // This warning is for potentially uninitialized local pointer variable, and it may cause\r |
592a3790 | 103 | // false positive issues in VS2013 and VS2015 build\r |
a5077fd0 | 104 | //\r |
2f88bd3a | 105 | #pragma warning ( disable : 4703 )\r |
9095d37b | 106 | \r |
2f88bd3a | 107 | #endif\r |
a5077fd0 | 108 | \r |
959ccb23 | 109 | #endif\r |
110 | \r | |
2f88bd3a MK |
111 | #if defined (_MSC_EXTENSIONS)\r |
112 | \r | |
113 | //\r | |
114 | // use Microsoft C compiler dependent integer width types\r | |
115 | //\r | |
959ccb23 | 116 | \r |
2f88bd3a MK |
117 | ///\r |
118 | /// 8-byte unsigned value.\r | |
119 | ///\r | |
120 | typedef unsigned __int64 UINT64;\r | |
121 | ///\r | |
122 | /// 8-byte signed value.\r | |
123 | ///\r | |
124 | typedef __int64 INT64;\r | |
125 | ///\r | |
126 | /// 4-byte unsigned value.\r | |
127 | ///\r | |
128 | typedef unsigned __int32 UINT32;\r | |
129 | ///\r | |
130 | /// 4-byte signed value.\r | |
131 | ///\r | |
132 | typedef __int32 INT32;\r | |
133 | ///\r | |
134 | /// 2-byte unsigned value.\r | |
135 | ///\r | |
136 | typedef unsigned short UINT16;\r | |
137 | ///\r | |
138 | /// 2-byte Character. Unless otherwise specified all strings are stored in the\r | |
139 | /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.\r | |
140 | ///\r | |
141 | typedef unsigned short CHAR16;\r | |
142 | ///\r | |
143 | /// 2-byte signed value.\r | |
144 | ///\r | |
145 | typedef short INT16;\r | |
146 | ///\r | |
147 | /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other\r | |
148 | /// values are undefined.\r | |
149 | ///\r | |
150 | typedef unsigned char BOOLEAN;\r | |
151 | ///\r | |
152 | /// 1-byte unsigned value.\r | |
153 | ///\r | |
154 | typedef unsigned char UINT8;\r | |
155 | ///\r | |
156 | /// 1-byte Character.\r | |
157 | ///\r | |
158 | typedef char CHAR8;\r | |
159 | ///\r | |
160 | /// 1-byte signed value.\r | |
161 | ///\r | |
162 | typedef signed char INT8;\r | |
9095d37b | 163 | #else\r |
2f88bd3a MK |
164 | ///\r |
165 | /// 8-byte unsigned value.\r | |
166 | ///\r | |
167 | typedef unsigned long long UINT64;\r | |
168 | ///\r | |
169 | /// 8-byte signed value.\r | |
170 | ///\r | |
171 | typedef long long INT64;\r | |
172 | ///\r | |
173 | /// 4-byte unsigned value.\r | |
174 | ///\r | |
175 | typedef unsigned int UINT32;\r | |
176 | ///\r | |
177 | /// 4-byte signed value.\r | |
178 | ///\r | |
179 | typedef int INT32;\r | |
180 | ///\r | |
181 | /// 2-byte unsigned value.\r | |
182 | ///\r | |
183 | typedef unsigned short UINT16;\r | |
184 | ///\r | |
185 | /// 2-byte Character. Unless otherwise specified all strings are stored in the\r | |
186 | /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.\r | |
187 | ///\r | |
188 | typedef unsigned short CHAR16;\r | |
189 | ///\r | |
190 | /// 2-byte signed value.\r | |
191 | ///\r | |
192 | typedef short INT16;\r | |
193 | ///\r | |
194 | /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other\r | |
195 | /// values are undefined.\r | |
196 | ///\r | |
197 | typedef unsigned char BOOLEAN;\r | |
198 | ///\r | |
199 | /// 1-byte unsigned value.\r | |
200 | ///\r | |
201 | typedef unsigned char UINT8;\r | |
202 | ///\r | |
203 | /// 1-byte Character\r | |
204 | ///\r | |
205 | typedef char CHAR8;\r | |
206 | ///\r | |
207 | /// 1-byte signed value\r | |
208 | ///\r | |
209 | typedef signed char INT8;\r | |
959ccb23 | 210 | #endif\r |
211 | \r | |
f4ec40ab | 212 | ///\r |
8c18db27 | 213 | /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions;\r |
214 | /// 8 bytes on supported 64-bit processor instructions.)\r | |
f4ec40ab | 215 | ///\r |
2f88bd3a | 216 | typedef UINT32 UINTN;\r |
f4ec40ab | 217 | ///\r |
8c18db27 | 218 | /// Signed value of native width. (4 bytes on supported 32-bit processor instructions;\r |
219 | /// 8 bytes on supported 64-bit processor instructions.)\r | |
f4ec40ab | 220 | ///\r |
2f88bd3a | 221 | typedef INT32 INTN;\r |
959ccb23 | 222 | \r |
f4ec40ab | 223 | //\r |
224 | // Processor specific defines\r | |
225 | //\r | |
959ccb23 | 226 | \r |
3566565a | 227 | ///\r |
f4ec40ab | 228 | /// A value of native width with the highest bit set.\r |
3566565a | 229 | ///\r |
2f88bd3a | 230 | #define MAX_BIT 0x80000000\r |
f4ec40ab | 231 | ///\r |
232 | /// A value of native width with the two highest bits set.\r | |
233 | ///\r | |
959ccb23 | 234 | #define MAX_2_BITS 0xC0000000\r |
235 | \r | |
3566565a | 236 | ///\r |
8c18db27 | 237 | /// Maximum legal IA-32 address.\r |
3566565a | 238 | ///\r |
2f88bd3a | 239 | #define MAX_ADDRESS 0xFFFFFFFF\r |
959ccb23 | 240 | \r |
67b8f806 AB |
241 | ///\r |
242 | /// Maximum usable address at boot time\r | |
243 | ///\r | |
2f88bd3a | 244 | #define MAX_ALLOC_ADDRESS MAX_ADDRESS\r |
67b8f806 | 245 | \r |
068a82fc LG |
246 | ///\r |
247 | /// Maximum legal IA-32 INTN and UINTN values.\r | |
248 | ///\r | |
249 | #define MAX_INTN ((INTN)0x7FFFFFFF)\r | |
250 | #define MAX_UINTN ((UINTN)0xFFFFFFFF)\r | |
251 | \r | |
d7a09cb8 SB |
252 | ///\r |
253 | /// Minimum legal IA-32 INTN value.\r | |
254 | ///\r | |
2f88bd3a | 255 | #define MIN_INTN (((INTN)-2147483647) - 1)\r |
d7a09cb8 | 256 | \r |
3566565a | 257 | ///\r |
8c18db27 | 258 | /// The stack alignment required for IA-32.\r |
3566565a | 259 | ///\r |
2f88bd3a | 260 | #define CPU_STACK_ALIGNMENT sizeof(UINTN)\r |
959ccb23 | 261 | \r |
08855193 AB |
262 | ///\r |
263 | /// Page allocation granularity for IA-32.\r | |
264 | ///\r | |
2f88bd3a MK |
265 | #define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)\r |
266 | #define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x1000)\r | |
08855193 | 267 | \r |
959ccb23 | 268 | //\r |
269 | // Modifier to ensure that all protocol member functions and EFI intrinsics\r | |
270 | // use the correct C calling convention. All protocol member functions and\r | |
3963c4bf | 271 | // EFI intrinsics are required to modify their member functions with EFIAPI.\r |
959ccb23 | 272 | //\r |
6149e6bb | 273 | #ifdef EFIAPI\r |
2f88bd3a MK |
274 | ///\r |
275 | /// If EFIAPI is already defined, then we use that definition.\r | |
276 | ///\r | |
277 | #elif defined (_MSC_EXTENSIONS)\r | |
278 | ///\r | |
279 | /// Microsoft* compiler specific method for EFIAPI calling convention.\r | |
280 | ///\r | |
281 | #define EFIAPI __cdecl\r | |
282 | #elif defined (__GNUC__) || defined (__clang__)\r | |
283 | ///\r | |
284 | /// GCC specific method for EFIAPI calling convention.\r | |
285 | ///\r | |
286 | #define EFIAPI __attribute__((cdecl))\r | |
86b2b825 | 287 | #else\r |
2f88bd3a MK |
288 | ///\r |
289 | /// The default for a non Microsoft* or GCC compiler is to assume the EFI ABI\r | |
290 | /// is the standard.\r | |
291 | ///\r | |
292 | #define EFIAPI\r | |
959ccb23 | 293 | #endif\r |
294 | \r | |
2f88bd3a MK |
295 | #if defined (__GNUC__) || defined (__clang__)\r |
296 | ///\r | |
297 | /// For GNU assembly code, .global or .globl can declare global symbols.\r | |
298 | /// Define this macro to unify the usage.\r | |
299 | ///\r | |
300 | #define ASM_GLOBAL .globl\r | |
27af6b87 | 301 | #endif\r |
302 | \r | |
14996c96 LG |
303 | /**\r |
304 | Return the pointer to the first instruction of a function given a function pointer.\r | |
9095d37b | 305 | On IA-32 CPU architectures, these two pointer values are the same,\r |
14996c96 | 306 | so the implementation of this macro is very simple.\r |
9095d37b | 307 | \r |
3963c4bf | 308 | @param FunctionPointer A pointer to a function.\r |
14996c96 LG |
309 | \r |
310 | @return The pointer to the first instruction of a function given a function pointer.\r | |
9095d37b | 311 | \r |
14996c96 | 312 | **/\r |
2f88bd3a | 313 | #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r |
24a7505c | 314 | \r |
02eef553 | 315 | #ifndef __USER_LABEL_PREFIX__\r |
2f88bd3a | 316 | #define __USER_LABEL_PREFIX__ _\r |
02eef553 JJ |
317 | #endif\r |
318 | \r | |
959ccb23 | 319 | #endif\r |