]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Ipf/ProcessorBind.h
2 Processor or Compiler specific defines and types for Intel Itanium(TM) processors.
4 Copyright (c) 2006 - 2009, 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
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.
15 #ifndef __PROCESSOR_BIND_H__
16 #define __PROCESSOR_BIND_H__
20 /// Define the processor type so other code can make processor-based choices
26 // Make sure we are using the correct packing rules per EFI specification
31 #if defined(__INTEL_COMPILER)
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
36 #pragma warning ( disable : 869 )
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
42 #pragma warning ( disable : 1418 )
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
48 #pragma warning ( disable : 1419 )
53 #if defined(_MSC_EXTENSIONS)
55 // Disable warning that make it impossible to compile at /W4
56 // This only works for Microsoft* tools
60 // Disabling bitfield type checking warnings.
62 #pragma warning ( disable : 4214 )
65 // Disabling the unreferenced formal parameter warnings.
67 #pragma warning ( disable : 4100 )
70 // Disable slightly different base types warning as CHAR8 * can not be set
71 // to a constant string.
73 #pragma warning ( disable : 4057 )
76 // Disable warning on conversion from function pointer to a data pointer
78 #pragma warning ( disable : 4054 )
81 // ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
83 #pragma warning ( disable : 4127 )
86 // Can not cast a function pointer to a data pointer. We need to do this on
87 // Itanium processors to get access to the PLABEL.
89 #pragma warning ( disable : 4514 )
92 // This warning is caused by functions defined but not used. For precompiled header only.
94 #pragma warning ( disable : 4505 )
97 // This warning is caused by empty (after preprocessing) source file. For precompiled header only.
99 #pragma warning ( disable : 4206 )
104 #if !defined (__STDC_VERSION__) || (__STDC_VERSION__) < 199901L
106 // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
109 #if defined(_MSC_EXTENSIONS)
111 // use Microsoft C compiler dependent integer width types
115 /// 8-byte unsigned value
117 typedef unsigned __int64 UINT64
;
119 /// 8-byte signed value
121 typedef __int64 INT64
;
123 /// 4-byte unsigned value
125 typedef unsigned __int32 UINT32
;
127 /// 4-byte signed value
129 typedef __int32 INT32
;
131 /// 2-byte unsigned value
133 typedef unsigned short UINT16
;
135 /// 2-byte Character. Unless otherwise specified all strings are stored in the
136 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
138 typedef unsigned short CHAR16
;
140 /// 2-byte signed value
144 /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
145 /// values are undefined.
147 typedef unsigned char BOOLEAN
;
149 /// 1-byte unsigned value
151 typedef unsigned char UINT8
;
157 /// 1-byte signed value
161 #if defined(_EFI_P64)
163 // P64 - pointers being 64-bit and longs and ints are 32-bits.
167 /// 8-byte unsigned value
169 typedef unsigned long long UINT64
;
171 /// 8-byte signed value
173 typedef long long INT64
;
175 /// 4-byte unsigned value
177 typedef unsigned int UINT32
;
179 /// 4-byte signed value
183 /// 2-byte Character. Unless otherwise specified all strings are stored in the
184 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
186 typedef unsigned short CHAR16
;
188 /// 2-byte unsigned value
190 typedef unsigned short UINT16
;
192 /// 2-byte signed value
196 /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
197 /// values are undefined.
199 typedef unsigned char BOOLEAN
;
201 /// 1-byte unsigned value
203 typedef unsigned char UINT8
;
209 /// 1-byte signed value
214 // Assume LP64 - longs and pointers are 64-bit. Ints are 32-bit.
218 /// 8-byte unsigned value
220 typedef unsigned long UINT64
;
222 /// 8-byte signed value
226 /// 4-byte unsigned value
228 typedef unsigned int UINT32
;
230 /// 4-byte signed value
234 /// 2-byte unsigned value
236 typedef unsigned short UINT16
;
238 /// 2-byte Character. Unless otherwise specified all strings are stored in the
239 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
241 typedef unsigned short CHAR16
;
243 /// 2-byte signed value
247 /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
248 /// values are undefined.
250 typedef unsigned char BOOLEAN
;
252 /// 1-byte unsigned value
254 typedef unsigned char UINT8
;
260 /// 1-byte signed value
267 // Use ANSI C 2000 stdint.h integer width declarations
272 /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
273 /// values are undefined.
275 typedef uint8_t BOOLEAN
;
277 /// 1-byte signed value
281 /// 1-byte unsigned value
283 typedef uint8_t UINT8
;
285 /// 2-byte signed value
287 typedef int16_t INT16
;
289 /// 2-byte unsigned value
291 typedef uint16_t UINT16
;
293 /// 4-byte signed value
295 typedef int32_t INT32
;
297 /// 4-byte unsigned value
299 typedef uint32_t UINT32
;
301 /// 8-byte signed value
303 typedef int64_t INT64
;
305 /// 8-byte unsigned value
307 typedef uint64_t UINT64
;
313 /// 2-byte Character. Unless otherwise specified all strings are stored in the
314 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
316 typedef uint16_t CHAR16
;
321 /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
322 /// 8 bytes on supported 64-bit processor instructions)
324 typedef UINT64 UINTN
;
326 /// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
327 /// 8 bytes on supported 64-bit processor instructions)
333 // Processor specific defines
337 /// A value of native width with the highest bit set.
339 #define MAX_BIT 0x8000000000000000ULL
341 /// A value of native width with the two highest bits set.
343 #define MAX_2_BITS 0xC000000000000000ULL
346 /// Maximum legal Itanium-based address
348 #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL
351 /// Per the Itanium Software Conventions and Runtime Architecture Guide,
352 /// section 3.3.4, IPF stack must always be 16-byte aligned.
354 #define CPU_STACK_ALIGNMENT 16
357 // Modifier to ensure that all protocol member functions and EFI intrinsics
358 // use the correct C calling convention. All protocol member functions and
359 // EFI intrinsics are required to modify their member functions with EFIAPI.
363 /// If EFIAPI is already defined, then we use that definition.
365 #elif defined(_MSC_EXTENSIONS)
367 /// Microsoft* compiler specific method for EFIAPI calling convension
369 #define EFIAPI __cdecl
375 /// For GNU assembly code, .global or .globl can declare global symbols.
376 /// Define this macro to unify the usage.
378 #define ASM_GLOBAL .globl
381 /// A pointer to a function in IPF points to a plabel.
389 /// PAL Call return structure.
399 Return the pointer to the first instruction of a function given a function pointer.
400 For Itanium processors, all function calls are made through a PLABEL, so a pointer to a function
401 is actually a pointer to a PLABEL. The pointer to the first instruction of the function
402 is contained within the PLABEL. This macro may be used to retrieve a pointer to the first
403 instruction of a function independent of the CPU architecture being used. This is very
404 useful when printing function addresses through DEBUG() macros.
406 @param FunctionPointer A pointer to a function.
408 @return The pointer to the first instruction of a function given a function pointer.
411 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(((EFI_PLABEL *)(FunctionPointer))->EntryPoint)