2
Processor or Compiler specific defines and types for IA-32 architecture.
4
Copyright (c) 2006 - 2015, 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 constructs so suppress 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 )
98
#if _MSC_VER == 1800 || _MSC_VER == 1900
101
// Disable these warnings for VS2013.
105
// This warning is for potentially uninitialized local variable, and it may cause false
106
// positive issues in VS2013 and VS2015 build
108
#pragma warning ( disable : 4701 )
111
// This warning is for potentially uninitialized local pointer variable, and it may cause
112
// false positive issues in VS2013 and VS2015 build
114
#pragma warning ( disable : 4703 )
121
#if defined(_MSC_EXTENSIONS)
124
// use Microsoft C compiler dependent integer width types
128
/// 8-byte unsigned value.
130
typedef unsigned __int64 UINT64;
132
/// 8-byte signed value.
134
typedef __int64 INT64;
136
/// 4-byte unsigned value.
138
typedef unsigned __int32 UINT32;
140
/// 4-byte signed value.
142
typedef __int32 INT32;
144
/// 2-byte unsigned value.
146
typedef unsigned short UINT16;
148
/// 2-byte Character. Unless otherwise specified all strings are stored in the
149
/// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
151
typedef unsigned short CHAR16;
153
/// 2-byte signed value.
157
/// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
158
/// values are undefined.
160
typedef unsigned char BOOLEAN;
162
/// 1-byte unsigned value.
164
typedef unsigned char UINT8;
166
/// 1-byte Character.
170
/// 1-byte signed value.
172
typedef signed char INT8;
175
/// 8-byte unsigned value.
177
typedef unsigned long long UINT64;
179
/// 8-byte signed value.
181
typedef long long INT64;
183
/// 4-byte unsigned value.
185
typedef unsigned int UINT32;
187
/// 4-byte signed value.
191
/// 2-byte unsigned value.
193
typedef unsigned short UINT16;
195
/// 2-byte Character. Unless otherwise specified all strings are stored in the
196
/// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
198
typedef unsigned short CHAR16;
200
/// 2-byte signed value.
204
/// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
205
/// values are undefined.
207
typedef unsigned char BOOLEAN;
209
/// 1-byte unsigned value.
211
typedef unsigned char UINT8;
217
/// 1-byte signed value
219
typedef signed char INT8;
223
/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions;
224
/// 8 bytes on supported 64-bit processor instructions.)
226
typedef UINT32 UINTN;
228
/// Signed value of native width. (4 bytes on supported 32-bit processor instructions;
229
/// 8 bytes on supported 64-bit processor instructions.)
234
// Processor specific defines
238
/// A value of native width with the highest bit set.
240
#define MAX_BIT 0x80000000
242
/// A value of native width with the two highest bits set.
244
#define MAX_2_BITS 0xC0000000
247
/// Maximum legal IA-32 address.
249
#define MAX_ADDRESS 0xFFFFFFFF
252
/// Maximum legal IA-32 INTN and UINTN values.
254
#define MAX_INTN ((INTN)0x7FFFFFFF)
255
#define MAX_UINTN ((UINTN)0xFFFFFFFF)
258
/// The stack alignment required for IA-32.
260
#define CPU_STACK_ALIGNMENT sizeof(UINTN)
263
// Modifier to ensure that all protocol member functions and EFI intrinsics
264
// use the correct C calling convention. All protocol member functions and
265
// EFI intrinsics are required to modify their member functions with EFIAPI.
269
/// If EFIAPI is already defined, then we use that definition.
271
#elif defined(_MSC_EXTENSIONS)
273
/// Microsoft* compiler specific method for EFIAPI calling convention.
275
#define EFIAPI __cdecl
276
#elif defined(__GNUC__)
278
/// GCC specific method for EFIAPI calling convention.
280
#define EFIAPI __attribute__((cdecl))
283
/// The default for a non Microsoft* or GCC compiler is to assume the EFI ABI
289
#if defined(__GNUC__)
291
/// For GNU assembly code, .global or .globl can declare global symbols.
292
/// Define this macro to unify the usage.
294
#define ASM_GLOBAL .globl
298
Return the pointer to the first instruction of a function given a function pointer.
299
On IA-32 CPU architectures, these two pointer values are the same,
300
so the implementation of this macro is very simple.
302
@param FunctionPointer A pointer to a function.
304
@return The pointer to the first instruction of a function given a function pointer.
307
#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
309
#ifndef __USER_LABEL_PREFIX__
310
#define __USER_LABEL_PREFIX__ _