2 Processor or Compiler specific defines and types for IA-32 architecture.
4 Copyright (c) 2006 - 2011, 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__
19 /// Define the processor type so other code can make processor based choices.
24 // Make sure we are using the correct packing rules per EFI specification
26 #if !defined(__GNUC__)
30 #if defined(__INTEL_COMPILER)
32 // Disable ICC's remark #869: "Parameter" was never referenced warning.
33 // This is legal ANSI C code so we disable the remark that is turned on with -Wall
35 #pragma warning ( disable : 869 )
38 // Disable ICC's remark #1418: external function definition with no prior declaration.
39 // This is legal ANSI C code so we disable the remark that is turned on with /W4
41 #pragma warning ( disable : 1418 )
44 // Disable ICC's remark #1419: external declaration in primary source file
45 // This is legal ANSI C code so we disable the remark that is turned on with /W4
47 #pragma warning ( disable : 1419 )
50 // Disable ICC's remark #593: "Variable" was set but never used.
51 // This is legal ANSI C code so we disable the remark that is turned on with /W4
53 #pragma warning ( disable : 593 )
58 #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 // ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
84 #pragma warning ( disable : 4127 )
87 // This warning is caused by functions defined but not used. For precompiled header only.
89 #pragma warning ( disable : 4505 )
92 // This warning is caused by empty (after preprocessing) source file. For precompiled header only.
94 #pragma warning ( disable : 4206 )
99 #if defined(_MSC_EXTENSIONS)
102 // use Microsoft C complier dependent integer width types
106 /// 8-byte unsigned value.
108 typedef unsigned __int64 UINT64
;
110 /// 8-byte signed value.
112 typedef __int64 INT64
;
114 /// 4-byte unsigned value.
116 typedef unsigned __int32 UINT32
;
118 /// 4-byte signed value.
120 typedef __int32 INT32
;
122 /// 2-byte unsigned value.
124 typedef unsigned short UINT16
;
126 /// 2-byte Character. Unless otherwise specified all strings are stored in the
127 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
129 typedef unsigned short CHAR16
;
131 /// 2-byte signed value.
135 /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
136 /// values are undefined.
138 typedef unsigned char BOOLEAN
;
140 /// 1-byte unsigned value.
142 typedef unsigned char UINT8
;
144 /// 1-byte Character.
148 /// 1-byte signed value.
150 typedef signed char INT8
;
153 /// 8-byte unsigned value.
155 typedef unsigned long long UINT64
;
157 /// 8-byte signed value.
159 typedef signed long long INT64
;
161 /// 4-byte unsigned value.
163 typedef unsigned int UINT32
;
165 /// 4-byte signed value.
167 typedef signed int INT32
;
169 /// 2-byte unsigned value.
171 typedef unsigned short UINT16
;
173 /// 2-byte Character. Unless otherwise specified all strings are stored in the
174 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
176 typedef unsigned short CHAR16
;
178 /// 2-byte signed value.
180 typedef signed short INT16
;
182 /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
183 /// values are undefined.
185 typedef unsigned char BOOLEAN
;
187 /// 1-byte unsigned value.
189 typedef unsigned char UINT8
;
193 typedef signed char CHAR8
;
195 /// 1-byte signed value
197 typedef signed char INT8
;
202 /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions;
203 /// 8 bytes on supported 64-bit processor instructions.)
205 typedef UINT32 UINTN
;
207 /// Signed value of native width. (4 bytes on supported 32-bit processor instructions;
208 /// 8 bytes on supported 64-bit processor instructions.)
213 /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions;
214 /// 8 bytes on supported 64-bit processor instructions.)
216 typedef UINT64 UINTN
;
218 /// Signed value of native width. (4 bytes on supported 32-bit processor instructions;
219 /// 8 bytes on supported 64-bit processor instructions.)
225 // Processor specific defines
229 /// A value of native width with the highest bit set.
231 #define MAX_BIT 0x80000000
233 /// A value of native width with the two highest bits set.
235 #define MAX_2_BITS 0xC0000000
238 /// Maximum legal IA-32 address.
240 #define MAX_ADDRESS 0xFFFFFFFF
243 /// The stack alignment required for IA-32.
245 #define CPU_STACK_ALIGNMENT sizeof(UINTN)
248 // Modifier to ensure that all protocol member functions and EFI intrinsics
249 // use the correct C calling convention. All protocol member functions and
250 // EFI intrinsics are required to modify their member functions with EFIAPI.
254 /// If EFIAPI is already defined, then we use that definition.
256 #elif defined(_MSC_EXTENSIONS)
258 /// Microsoft* compiler specific method for EFIAPI calling convention.
260 #define EFIAPI __cdecl
261 #elif defined(__GNUC__)
263 /// GCC specific method for EFIAPI calling convention.
265 #define EFIAPI __attribute__((cdecl))
268 /// The default for a non Microsoft* or GCC compiler is to assume the EFI ABI
274 #if defined(__GNUC__)
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
283 Return the pointer to the first instruction of a function given a function pointer.
284 On IA-32 CPU architectures, these two pointer values are the same,
285 so the implementation of this macro is very simple.
287 @param FunctionPointer A pointer to a function.
289 @return The pointer to the first instruction of a function given a function pointer.
292 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)