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