]>
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 - 2013, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available
6 under the terms and conditions of the BSD License which accompanies this
7 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 )
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
54 #pragma warning ( disable : 593 )
59 #if defined(_MSC_EXTENSIONS)
61 // Disable warning that make it impossible to compile at /W4
62 // This only works for Microsoft* tools
66 // Disabling bitfield type checking warnings.
68 #pragma warning ( disable : 4214 )
71 // Disabling the unreferenced formal parameter warnings.
73 #pragma warning ( disable : 4100 )
76 // Disable slightly different base types warning as CHAR8 * can not be set
77 // to a constant string.
79 #pragma warning ( disable : 4057 )
82 // Disable warning on conversion from function pointer to a data pointer
84 #pragma warning ( disable : 4054 )
87 // ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
89 #pragma warning ( disable : 4127 )
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.
95 #pragma warning ( disable : 4514 )
98 // This warning is caused by functions defined but not used. For precompiled header only.
100 #pragma warning ( disable : 4505 )
103 // This warning is caused by empty (after preprocessing) source file. For precompiled header only.
105 #pragma warning ( disable : 4206 )
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
;
153 /// 1-byte Character.
157 /// 1-byte signed value.
159 typedef signed char INT8
;
162 /// 8-byte unsigned value.
164 typedef unsigned long long UINT64
;
166 /// 8-byte signed value.
168 typedef long long INT64
;
170 /// 4-byte unsigned value.
172 typedef unsigned int UINT32
;
174 /// 4-byte signed value.
178 /// 2-byte unsigned value.
180 typedef unsigned short UINT16
;
182 /// 2-byte Character. Unless otherwise specified all strings are stored in the
183 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
185 typedef unsigned short CHAR16
;
187 /// 2-byte signed value.
191 /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
192 /// values are undefined.
194 typedef unsigned char BOOLEAN
;
196 /// 1-byte unsigned value.
198 typedef unsigned char UINT8
;
200 /// 1-byte Character.
204 /// 1-byte signed value.
206 typedef signed char INT8
;
210 /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions;
211 /// 8 bytes on supported 64-bit processor instructions.)
213 typedef UINT64 UINTN
;
215 /// Signed value of native width. (4 bytes on supported 32-bit processor instructions;
216 /// 8 bytes on supported 64-bit processor instructions.)
222 // Processor specific defines
226 /// A value of native width with the highest bit set.
228 #define MAX_BIT 0x8000000000000000ULL
230 /// A value of native width with the two highest bits set.
232 #define MAX_2_BITS 0xC000000000000000ULL
235 /// The maximum legal Itanium-based address
237 #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL
240 /// Maximum legal Itanium-based INTN and UINTN values.
242 #define MAX_INTN ((INTN)0x7FFFFFFFFFFFFFFFULL)
243 #define MAX_UINTN ((UINTN)0xFFFFFFFFFFFFFFFFULL)
246 /// Per the Itanium Software Conventions and Runtime Architecture Guide,
247 /// section 3.3.4, IPF stack must always be 16-byte aligned.
249 #define CPU_STACK_ALIGNMENT 16
252 /// Page allocation granularity for Itanium
254 #define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)
255 #define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x2000)
258 // Modifier to ensure that all protocol member functions and EFI intrinsics
259 // use the correct C calling convention. All protocol member functions and
260 // EFI intrinsics are required to modify their member functions with EFIAPI.
264 /// If EFIAPI is already defined, then we use that definition.
266 #elif defined(_MSC_EXTENSIONS)
268 /// Microsoft* compiler-specific method for EFIAPI calling convention.
270 #define EFIAPI __cdecl
276 /// For GNU assembly code, .global or .globl can declare global symbols.
277 /// Define this macro to unify the usage.
279 #define ASM_GLOBAL .globl
282 /// A pointer to a function in IPF points to a plabel.
290 /// PAL Call return structure.
300 Return the pointer to the first instruction of a function given a function pointer.
301 For Itanium processors, all function calls are made through a PLABEL, so a pointer to a function
302 is actually a pointer to a PLABEL. The pointer to the first instruction of the function
303 is contained within the PLABEL. This macro may be used to retrieve a pointer to the first
304 instruction of a function independent of the CPU architecture being used. This is very
305 useful when printing function addresses through DEBUG() macros.
307 @param FunctionPointer A pointer to a function.
309 @return The pointer to the first instruction of a function given a function pointer.
312 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(((EFI_PLABEL *)(FunctionPointer))->EntryPoint)
314 #ifndef __USER_LABEL_PREFIX__
315 #define __USER_LABEL_PREFIX__