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