]>
Commit | Line | Data |
---|---|---|
959ccb23 | 1 | /** @file\r |
2 | Processor or Compiler specific defines and types for Intel Itanium(TM).\r | |
3 | \r | |
373ade0e | 4 | Copyright (c) 2006 - 2008, Intel Corporation<BR>\r |
bf3179d8 | 5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
959ccb23 | 9 | \r |
bf3179d8 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
959ccb23 | 12 | \r |
959ccb23 | 13 | **/\r |
14 | \r | |
15 | #ifndef __PROCESSOR_BIND_H__\r | |
16 | #define __PROCESSOR_BIND_H__\r | |
17 | \r | |
18 | \r | |
fb5148a0 | 19 | ///\r |
20 | /// Define the processor type so other code can make processor based choices\r | |
21 | ///\r | |
959ccb23 | 22 | #define MDE_CPU_IPF\r |
23 | \r | |
24 | \r | |
25 | //\r | |
3963c4bf | 26 | // Make sure we are using the correct packing rules per EFI specification\r |
959ccb23 | 27 | //\r |
28 | #pragma pack()\r | |
29 | \r | |
30 | \r | |
5cfbd055 | 31 | #if defined(__INTEL_COMPILER)\r |
1fb24cc4 | 32 | //\r |
33 | // Disable ICC's remark #869: "Parameter" was never referenced warning.\r | |
34 | // This is legal ANSI C code so we disable the remark that is turned on with -Wall\r | |
35 | //\r | |
36 | #pragma warning ( disable : 869 )\r | |
37 | \r | |
46913d4d | 38 | //\r |
b483e395 A |
39 | // Disable ICC's remark #1418: external function definition with no prior declaration.\r |
40 | // This is legal ANSI C code so we disable the remark that is turned on with /W4\r | |
46913d4d | 41 | //\r |
42 | #pragma warning ( disable : 1418 )\r | |
43 | \r | |
46913d4d | 44 | //\r |
b483e395 A |
45 | // Disable ICC's remark #1419: external declaration in primary source file\r |
46 | // This is legal ANSI C code so we disable the remark that is turned on with /W4\r | |
46913d4d | 47 | //\r |
48 | #pragma warning ( disable : 1419 )\r | |
49 | \r | |
50 | #endif\r | |
51 | \r | |
b483e395 | 52 | \r |
5cfbd055 | 53 | #if defined(_MSC_EXTENSIONS)\r |
b483e395 A |
54 | //\r |
55 | // Disable warning that make it impossible to compile at /W4\r | |
f4ec40ab | 56 | // This only works for Microsoft* tools\r |
b483e395 A |
57 | //\r |
58 | \r | |
959ccb23 | 59 | //\r |
60 | // Disabling bitfield type checking warnings.\r | |
61 | //\r | |
62 | #pragma warning ( disable : 4214 )\r | |
63 | \r | |
f4ec40ab | 64 | //\r |
959ccb23 | 65 | // Disabling the unreferenced formal parameter warnings.\r |
66 | //\r | |
67 | #pragma warning ( disable : 4100 )\r | |
68 | \r | |
69 | //\r | |
70 | // Disable slightly different base types warning as CHAR8 * can not be set\r | |
71 | // to a constant string.\r | |
72 | //\r | |
73 | #pragma warning ( disable : 4057 )\r | |
74 | \r | |
75 | //\r | |
76 | // Disable warning on conversion from function pointer to a data pointer\r | |
77 | //\r | |
78 | #pragma warning ( disable : 4054 )\r | |
79 | \r | |
80 | //\r | |
81 | // ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning\r | |
82 | //\r | |
83 | #pragma warning ( disable : 4127 )\r | |
84 | \r | |
85 | //\r | |
bf3179d8 | 86 | // Can not cast a function pointer to a data pointer. We need to do this on\r |
959ccb23 | 87 | // IPF to get access to the PLABEL.\r |
88 | //\r | |
89 | #pragma warning ( disable : 4514 )\r | |
90 | \r | |
91 | //\r | |
92 | // This warning is caused by functions defined but not used. For precompiled header only.\r | |
93 | //\r | |
94 | #pragma warning ( disable : 4505 )\r | |
95 | \r | |
96 | //\r | |
3963c4bf | 97 | // This warning is caused by empty (after preprocessing) source file. For precompiled header only.\r |
959ccb23 | 98 | //\r |
99 | #pragma warning ( disable : 4206 )\r | |
100 | \r | |
101 | #endif\r | |
102 | \r | |
103 | \r | |
39f35bb5 | 104 | #if !defined (__STDC_VERSION__) || (__STDC_VERSION__) < 199901L\r |
959ccb23 | 105 | //\r |
106 | // No ANSI C 2000 stdint.h integer width declarations, so define equivalents\r | |
107 | //\r | |
bf3179d8 | 108 | \r |
5cfbd055 | 109 | #if defined(_MSC_EXTENSIONS)\r |
959ccb23 | 110 | //\r |
3963c4bf | 111 | // use Microsoft C complier dependent integer width types\r |
959ccb23 | 112 | //\r |
f4ec40ab | 113 | \r |
114 | ///\r | |
115 | /// 8-byte unsigned value\r | |
116 | ///\r | |
959ccb23 | 117 | typedef unsigned __int64 UINT64;\r |
f4ec40ab | 118 | ///\r |
119 | /// 8-byte signed value\r | |
120 | ///\r | |
959ccb23 | 121 | typedef __int64 INT64;\r |
f4ec40ab | 122 | ///\r |
123 | /// 4-byte unsigned value\r | |
124 | ///\r | |
959ccb23 | 125 | typedef unsigned __int32 UINT32;\r |
f4ec40ab | 126 | ///\r |
127 | /// 4-byte signed value\r | |
128 | ///\r | |
959ccb23 | 129 | typedef __int32 INT32;\r |
f4ec40ab | 130 | ///\r |
131 | /// 2-byte unsigned value\r | |
132 | ///\r | |
959ccb23 | 133 | typedef unsigned short UINT16;\r |
f4ec40ab | 134 | ///\r |
135 | /// 2-byte Character. Unless otherwise specified all strings are stored in the\r | |
136 | /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.\r | |
137 | ///\r | |
959ccb23 | 138 | typedef unsigned short CHAR16;\r |
f4ec40ab | 139 | ///\r |
140 | /// 2-byte signed value\r | |
141 | ///\r | |
959ccb23 | 142 | typedef short INT16;\r |
f4ec40ab | 143 | ///\r |
144 | /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other\r | |
145 | /// values are undefined.\r | |
146 | ///\r | |
959ccb23 | 147 | typedef unsigned char BOOLEAN;\r |
f4ec40ab | 148 | ///\r |
149 | /// 1-byte unsigned value\r | |
150 | ///\r | |
959ccb23 | 151 | typedef unsigned char UINT8;\r |
f4ec40ab | 152 | ///\r |
153 | /// 1-byte Character\r | |
154 | ///\r | |
959ccb23 | 155 | typedef char CHAR8;\r |
f4ec40ab | 156 | ///\r |
157 | /// 1-byte signed value\r | |
158 | ///\r | |
959ccb23 | 159 | typedef char INT8;\r |
160 | #else\r | |
5cfbd055 | 161 | #if defined(_EFI_P64)\r |
959ccb23 | 162 | //\r |
9510db65 | 163 | // P64 - pointers being 64-bit and longs and ints are 32-bits.\r |
959ccb23 | 164 | //\r |
f4ec40ab | 165 | \r |
166 | ///\r | |
167 | /// 8-byte unsigned value\r | |
168 | ///\r | |
959ccb23 | 169 | typedef unsigned long long UINT64;\r |
f4ec40ab | 170 | ///\r |
171 | /// 8-byte signed value\r | |
172 | ///\r | |
959ccb23 | 173 | typedef long long INT64;\r |
f4ec40ab | 174 | ///\r |
175 | /// 4-byte unsigned value\r | |
176 | ///\r | |
959ccb23 | 177 | typedef unsigned int UINT32;\r |
f4ec40ab | 178 | ///\r |
179 | /// 4-byte signed value\r | |
180 | ///\r | |
959ccb23 | 181 | typedef int INT32;\r |
f4ec40ab | 182 | ///\r |
183 | /// 2-byte Character. Unless otherwise specified all strings are stored in the\r | |
184 | /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.\r | |
185 | ///\r | |
959ccb23 | 186 | typedef unsigned short CHAR16;\r |
f4ec40ab | 187 | ///\r |
188 | /// 2-byte unsigned value\r | |
189 | ///\r | |
959ccb23 | 190 | typedef unsigned short UINT16;\r |
f4ec40ab | 191 | ///\r |
192 | /// 2-byte signed value\r | |
193 | ///\r | |
959ccb23 | 194 | typedef short INT16;\r |
f4ec40ab | 195 | ///\r |
196 | /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other\r | |
197 | /// values are undefined.\r | |
198 | ///\r | |
959ccb23 | 199 | typedef unsigned char BOOLEAN;\r |
f4ec40ab | 200 | ///\r |
201 | /// 1-byte unsigned value\r | |
202 | ///\r | |
959ccb23 | 203 | typedef unsigned char UINT8;\r |
f4ec40ab | 204 | ///\r |
205 | /// 1-byte Character\r | |
206 | ///\r | |
959ccb23 | 207 | typedef char CHAR8;\r |
f4ec40ab | 208 | ///\r |
209 | /// 1-byte signed value\r | |
210 | ///\r | |
959ccb23 | 211 | typedef char INT8;\r |
212 | #else\r | |
213 | //\r | |
214 | // Assume LP64 - longs and pointers are 64-bit. Ints are 32-bit.\r | |
215 | //\r | |
f4ec40ab | 216 | \r |
217 | ///\r | |
218 | /// 8-byte unsigned value\r | |
219 | ///\r | |
959ccb23 | 220 | typedef unsigned long UINT64;\r |
f4ec40ab | 221 | ///\r |
222 | /// 8-byte signed value\r | |
223 | ///\r | |
959ccb23 | 224 | typedef long INT64;\r |
f4ec40ab | 225 | ///\r |
226 | /// 4-byte unsigned value\r | |
227 | ///\r | |
959ccb23 | 228 | typedef unsigned int UINT32;\r |
f4ec40ab | 229 | ///\r |
230 | /// 4-byte signed value\r | |
231 | ///\r | |
959ccb23 | 232 | typedef int INT32;\r |
f4ec40ab | 233 | ///\r |
234 | /// 2-byte unsigned value\r | |
235 | ///\r | |
959ccb23 | 236 | typedef unsigned short UINT16;\r |
f4ec40ab | 237 | ///\r |
238 | /// 2-byte Character. Unless otherwise specified all strings are stored in the\r | |
239 | /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.\r | |
240 | ///\r | |
959ccb23 | 241 | typedef unsigned short CHAR16;\r |
f4ec40ab | 242 | ///\r |
243 | /// 2-byte signed value\r | |
244 | ///\r | |
959ccb23 | 245 | typedef short INT16;\r |
f4ec40ab | 246 | ///\r |
247 | /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other\r | |
248 | /// values are undefined.\r | |
249 | ///\r | |
959ccb23 | 250 | typedef unsigned char BOOLEAN;\r |
f4ec40ab | 251 | ///\r |
252 | /// 1-byte unsigned value\r | |
253 | ///\r | |
959ccb23 | 254 | typedef unsigned char UINT8;\r |
f4ec40ab | 255 | ///\r |
256 | /// 1-byte Character\r | |
257 | ///\r | |
959ccb23 | 258 | typedef char CHAR8;\r |
f4ec40ab | 259 | ///\r |
260 | /// 1-byte signed value\r | |
261 | ///\r | |
959ccb23 | 262 | typedef char INT8;\r |
263 | #endif\r | |
264 | #endif\r | |
959ccb23 | 265 | #else\r |
266 | //\r | |
267 | // Use ANSI C 2000 stdint.h integer width declarations\r | |
268 | //\r | |
269 | #include <stdint.h>\r | |
f4ec40ab | 270 | \r |
271 | ///\r | |
272 | /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other\r | |
273 | /// values are undefined.\r | |
274 | ///\r | |
959ccb23 | 275 | typedef uint8_t BOOLEAN;\r |
f4ec40ab | 276 | ///\r |
277 | /// 1-byte signed value\r | |
278 | ///\r | |
959ccb23 | 279 | typedef int8_t INT8;\r |
f4ec40ab | 280 | ///\r |
281 | /// 1-byte unsigned value\r | |
282 | ///\r | |
959ccb23 | 283 | typedef uint8_t UINT8;\r |
f4ec40ab | 284 | ///\r |
285 | /// 2-byte signed value\r | |
286 | ///\r | |
959ccb23 | 287 | typedef int16_t INT16;\r |
f4ec40ab | 288 | ///\r |
289 | /// 2-byte unsigned value\r | |
290 | ///\r | |
959ccb23 | 291 | typedef uint16_t UINT16;\r |
f4ec40ab | 292 | ///\r |
293 | /// 4-byte signed value\r | |
294 | ///\r | |
959ccb23 | 295 | typedef int32_t INT32;\r |
f4ec40ab | 296 | ///\r |
297 | /// 4-byte unsigned value\r | |
298 | ///\r | |
959ccb23 | 299 | typedef uint32_t UINT32;\r |
f4ec40ab | 300 | ///\r |
301 | /// 8-byte signed value\r | |
302 | ///\r | |
959ccb23 | 303 | typedef int64_t INT64;\r |
f4ec40ab | 304 | ///\r |
305 | /// 8-byte unsigned value\r | |
306 | ///\r | |
959ccb23 | 307 | typedef uint64_t UINT64;\r |
f4ec40ab | 308 | ///\r |
309 | /// 1-byte Character\r | |
310 | ///\r | |
959ccb23 | 311 | typedef char CHAR8;\r |
f4ec40ab | 312 | ///\r |
313 | /// 2-byte Character. Unless otherwise specified all strings are stored in the\r | |
314 | /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.\r | |
315 | ///\r | |
959ccb23 | 316 | typedef uint16_t CHAR16;\r |
317 | \r | |
318 | #endif\r | |
319 | \r | |
f4ec40ab | 320 | ///\r |
321 | /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,\r | |
322 | /// 8 bytes on supported 64-bit processor instructions)\r | |
323 | ///\r | |
959ccb23 | 324 | typedef UINT64 UINTN;\r |
f4ec40ab | 325 | ///\r |
326 | /// Signed value of native width. (4 bytes on supported 32-bit processor instructions,\r | |
327 | /// 8 bytes on supported 64-bit processor instructions)\r | |
328 | ///\r | |
959ccb23 | 329 | typedef INT64 INTN;\r |
330 | \r | |
331 | \r | |
332 | //\r | |
333 | // Processor specific defines\r | |
334 | //\r | |
f4ec40ab | 335 | \r |
336 | ///\r | |
337 | /// A value of native width with the highest bit set.\r | |
338 | ///\r | |
959ccb23 | 339 | #define MAX_BIT 0x8000000000000000ULL\r |
f4ec40ab | 340 | ///\r |
341 | /// A value of native width with the two highest bits set.\r | |
342 | ///\r | |
959ccb23 | 343 | #define MAX_2_BITS 0xC000000000000000ULL\r |
344 | \r | |
f4ec40ab | 345 | ///\r |
346 | /// Maximum legal Itanium-based address\r | |
347 | ///\r | |
959ccb23 | 348 | #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL\r |
349 | \r | |
f4ec40ab | 350 | ///\r |
351 | /// Per the Itanium Software Conventions and Runtime Architecture Guide,\r | |
352 | /// section 3.3.4, IPF stack must always be 16-byte aligned.\r | |
353 | ///\r | |
959ccb23 | 354 | #define CPU_STACK_ALIGNMENT 16\r |
355 | \r | |
356 | //\r | |
357 | // Modifier to ensure that all protocol member functions and EFI intrinsics\r | |
358 | // use the correct C calling convention. All protocol member functions and\r | |
3963c4bf | 359 | // EFI intrinsics are required to modify their member functions with EFIAPI.\r |
959ccb23 | 360 | //\r |
5cfbd055 | 361 | #if defined(_MSC_EXTENSIONS)\r |
f4ec40ab | 362 | ///\r |
363 | /// Microsoft* compiler specific method for EFIAPI calling convension\r | |
364 | /// \r | |
bf3179d8 | 365 | #define EFIAPI __cdecl\r |
959ccb23 | 366 | #else\r |
bf3179d8 | 367 | #define EFIAPI\r |
959ccb23 | 368 | #endif\r |
369 | \r | |
370 | //\r | |
371 | // The Microsoft* C compiler can removed references to unreferenced data items\r | |
bf3179d8 | 372 | // if the /OPT:REF linker option is used. We defined a macro as this is a\r |
959ccb23 | 373 | // a non standard extension\r |
374 | //\r | |
5cfbd055 | 375 | #if defined(_MSC_EXTENSIONS)\r |
f4ec40ab | 376 | ///\r |
377 | /// Remove global variable from the linked image if there are no references to \r | |
378 | /// it after all compiler and linker optimizations have been performed.\r | |
379 | ///\r | |
380 | ///\r | |
959ccb23 | 381 | #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)\r |
382 | #else\r | |
f4ec40ab | 383 | ///\r |
384 | /// Remove global variable from the linked image if there are no references to \r | |
385 | /// it after all compiler and linker optimizations have been performed.\r | |
386 | ///\r | |
387 | ///\r | |
959ccb23 | 388 | #define GLOBAL_REMOVE_IF_UNREFERENCED\r |
389 | #endif\r | |
390 | \r | |
fb5148a0 | 391 | ///\r |
392 | /// A pointer to a function in IPF points to a plabel.\r | |
393 | ///\r | |
959ccb23 | 394 | typedef struct {\r |
395 | UINT64 EntryPoint;\r | |
396 | UINT64 GP;\r | |
397 | } EFI_PLABEL;\r | |
398 | \r | |
f4ec40ab | 399 | ///\r |
400 | /// PAL Call return structure.\r | |
401 | ///\r | |
842f5579 A |
402 | typedef struct {\r |
403 | UINT64 Status;\r | |
404 | UINT64 r9;\r | |
405 | UINT64 r10;\r | |
406 | UINT64 r11;\r | |
407 | } PAL_CALL_RETURN;\r | |
408 | \r | |
14996c96 LG |
409 | /**\r |
410 | Return the pointer to the first instruction of a function given a function pointer.\r | |
411 | For Itanium CPUs, all function calls are made through a PLABEL, so a pointer to a function \r | |
412 | is actually a pointer to a PLABEL. The pointer to the first instruction of the function \r | |
413 | is contained within the PLABEL. This macro may be used to retrieve a pointer to the first \r | |
414 | instruction of a function independent of the CPU architecture being used. This is very \r | |
415 | useful when printing function addresses through DEBUG() macros.\r | |
416 | \r | |
3963c4bf | 417 | @param FunctionPointer A pointer to a function.\r |
14996c96 LG |
418 | \r |
419 | @return The pointer to the first instruction of a function given a function pointer.\r | |
3963c4bf | 420 | \r |
14996c96 | 421 | **/\r |
9a1d00cb | 422 | #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(((EFI_PLABEL *)(FunctionPointer))->EntryPoint)\r |
24a7505c | 423 | \r |
959ccb23 | 424 | #endif\r |
425 | \r |