2 Processor or Compiler specific defines and types for IA-32 architecture.
4 Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 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__
18 FILE_LICENCE ( BSD3 );
21 /// 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
28 #if !defined(__GNUC__)
32 #if defined(__INTEL_COMPILER)
34 // Disable ICC's remark #869: "Parameter" was never referenced warning.
35 // This is legal ANSI C code so we disable the remark that is turned on with -Wall
37 #pragma warning ( disable : 869 )
40 // Disable ICC's remark #1418: external function definition with no prior declaration.
41 // This is legal ANSI C code so we disable the remark that is turned on with /W4
43 #pragma warning ( disable : 1418 )
46 // Disable ICC's remark #1419: external declaration in primary source file
47 // This is legal ANSI C code so we disable the remark that is turned on with /W4
49 #pragma warning ( disable : 1419 )
52 // Disable ICC's remark #593: "Variable" was set but never used.
53 // This is legal ANSI C code so we disable the remark that is turned on with /W4
55 #pragma warning ( disable : 593 )
60 #if defined(_MSC_EXTENSIONS)
63 // Disable warning that make it impossible to compile at /W4
64 // This only works for Microsoft* tools
68 // Disabling bitfield type checking warnings.
70 #pragma warning ( disable : 4214 )
73 // Disabling the unreferenced formal parameter warnings.
75 #pragma warning ( disable : 4100 )
78 // Disable slightly different base types warning as CHAR8 * can not be set
79 // to a constant string.
81 #pragma warning ( disable : 4057 )
84 // ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
86 #pragma warning ( disable : 4127 )
89 // This warning is caused by functions defined but not used. For precompiled header only.
91 #pragma warning ( disable : 4505 )
94 // This warning is caused by empty (after preprocessing) source file. For precompiled header only.
96 #pragma warning ( disable : 4206 )
101 #if defined(_MSC_EXTENSIONS)
104 // use Microsoft C complier dependent integer width types
108 /// 8-byte unsigned value.
110 typedef unsigned __int64 UINT64;
112 /// 8-byte signed value.
114 typedef __int64 INT64;
116 /// 4-byte unsigned value.
118 typedef unsigned __int32 UINT32;
120 /// 4-byte signed value.
122 typedef __int32 INT32;
124 /// 2-byte unsigned value.
126 typedef unsigned short UINT16;
128 /// 2-byte Character. Unless otherwise specified all strings are stored in the
129 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
131 typedef unsigned short CHAR16;
133 /// 2-byte signed value.
137 /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
138 /// values are undefined.
140 typedef unsigned char BOOLEAN;
142 /// 1-byte unsigned value.
144 typedef unsigned char UINT8;
146 /// 1-byte Character.
150 /// 1-byte signed value.
152 typedef signed char INT8;
155 /// 8-byte unsigned value.
157 typedef unsigned long long UINT64;
159 /// 8-byte signed value.
161 typedef long long INT64;
163 /// 4-byte unsigned value.
165 typedef unsigned int UINT32;
167 /// 4-byte signed value.
171 /// 2-byte unsigned value.
173 typedef unsigned short UINT16;
175 /// 2-byte Character. Unless otherwise specified all strings are stored in the
176 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
178 typedef unsigned short CHAR16;
180 /// 2-byte signed value.
184 /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
185 /// values are undefined.
187 typedef unsigned char BOOLEAN;
189 /// 1-byte unsigned value.
191 typedef unsigned char UINT8;
197 /// 1-byte signed value
199 typedef signed char INT8;
203 /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions;
204 /// 8 bytes on supported 64-bit processor instructions.)
206 typedef UINT32 UINTN;
208 /// Signed value of native width. (4 bytes on supported 32-bit processor instructions;
209 /// 8 bytes on supported 64-bit processor instructions.)
214 // Processor specific defines
218 /// A value of native width with the highest bit set.
220 #define MAX_BIT 0x80000000
222 /// A value of native width with the two highest bits set.
224 #define MAX_2_BITS 0xC0000000
227 /// Maximum legal IA-32 address.
229 #define MAX_ADDRESS 0xFFFFFFFF
232 /// Maximum legal IA-32 INTN and UINTN values.
234 #define MAX_INTN ((INTN)0x7FFFFFFF)
235 #define MAX_UINTN ((UINTN)0xFFFFFFFF)
238 /// The stack alignment required for IA-32.
240 #define CPU_STACK_ALIGNMENT sizeof(UINTN)
243 // Modifier to ensure that all protocol member functions and EFI intrinsics
244 // use the correct C calling convention. All protocol member functions and
245 // EFI intrinsics are required to modify their member functions with EFIAPI.
249 /// If EFIAPI is already defined, then we use that definition.
251 #elif defined(_MSC_EXTENSIONS)
253 /// Microsoft* compiler specific method for EFIAPI calling convention.
255 #define EFIAPI __cdecl
256 #elif defined(__GNUC__)
258 /// GCC specific method for EFIAPI calling convention.
260 #define EFIAPI __attribute__((cdecl))
263 /// The default for a non Microsoft* or GCC compiler is to assume the EFI ABI
269 #if defined(__GNUC__)
271 /// For GNU assembly code, .global or .globl can declare global symbols.
272 /// Define this macro to unify the usage.
274 #define ASM_GLOBAL .globl
278 Return the pointer to the first instruction of a function given a function pointer.
279 On IA-32 CPU architectures, these two pointer values are the same,
280 so the implementation of this macro is very simple.
282 @param FunctionPointer A pointer to a function.
284 @return The pointer to the first instruction of a function given a function pointer.
287 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
289 #ifndef __USER_LABEL_PREFIX__
290 #define __USER_LABEL_PREFIX__ _