]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Ia32/ProcessorBind.h
2 Processor or Compiler specific defines and types for IA-32 architecture.
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef __PROCESSOR_BIND_H__
10 #define __PROCESSOR_BIND_H__
13 /// Define the processor type so other code can make processor based choices.
18 // Make sure we are using the correct packing rules per EFI specification
20 #if !defined(__GNUC__)
24 #if defined(__INTEL_COMPILER)
26 // Disable ICC's remark #869: "Parameter" was never referenced warning.
27 // This is legal ANSI C code so we disable the remark that is turned on with -Wall
29 #pragma warning ( disable : 869 )
32 // Disable ICC's remark #1418: external function definition with no prior declaration.
33 // This is legal ANSI C code so we disable the remark that is turned on with /W4
35 #pragma warning ( disable : 1418 )
38 // Disable ICC's remark #1419: external declaration in primary source file
39 // This is legal ANSI C code so we disable the remark that is turned on with /W4
41 #pragma warning ( disable : 1419 )
44 // Disable ICC's remark #593: "Variable" was set but never used.
45 // This is legal ANSI C code so we disable the remark that is turned on with /W4
47 #pragma warning ( disable : 593 )
52 #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 // ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
78 #pragma warning ( disable : 4127 )
81 // This warning is caused by functions defined but not used. For precompiled header only.
83 #pragma warning ( disable : 4505 )
86 // This warning is caused by empty (after preprocessing) source file. For precompiled header only.
88 #pragma warning ( disable : 4206 )
90 #if defined(_MSC_VER) && _MSC_VER >= 1800
93 // Disable these warnings for VS2013.
97 // This warning is for potentially uninitialized local variable, and it may cause false
98 // positive issues in VS2013 and VS2015 build
100 #pragma warning ( disable : 4701 )
103 // This warning is for potentially uninitialized local pointer variable, and it may cause
104 // false positive issues in VS2013 and VS2015 build
106 #pragma warning ( disable : 4703 )
113 #if defined(_MSC_EXTENSIONS)
116 // use Microsoft C compiler dependent integer width types
120 /// 8-byte unsigned value.
122 typedef unsigned __int64 UINT64
;
124 /// 8-byte signed value.
126 typedef __int64 INT64
;
128 /// 4-byte unsigned value.
130 typedef unsigned __int32 UINT32
;
132 /// 4-byte signed value.
134 typedef __int32 INT32
;
136 /// 2-byte unsigned value.
138 typedef unsigned short UINT16
;
140 /// 2-byte Character. Unless otherwise specified all strings are stored in the
141 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
143 typedef unsigned short CHAR16
;
145 /// 2-byte signed value.
149 /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
150 /// values are undefined.
152 typedef unsigned char BOOLEAN
;
154 /// 1-byte unsigned value.
156 typedef unsigned char UINT8
;
158 /// 1-byte Character.
162 /// 1-byte signed value.
164 typedef signed char INT8
;
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 unsigned value.
185 typedef unsigned short UINT16
;
187 /// 2-byte Character. Unless otherwise specified all strings are stored in the
188 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
190 typedef unsigned short CHAR16
;
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
211 typedef signed char INT8
;
215 /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions;
216 /// 8 bytes on supported 64-bit processor instructions.)
218 typedef UINT32 UINTN
;
220 /// Signed value of native width. (4 bytes on supported 32-bit processor instructions;
221 /// 8 bytes on supported 64-bit processor instructions.)
226 // Processor specific defines
230 /// A value of native width with the highest bit set.
232 #define MAX_BIT 0x80000000
234 /// A value of native width with the two highest bits set.
236 #define MAX_2_BITS 0xC0000000
239 /// Maximum legal IA-32 address.
241 #define MAX_ADDRESS 0xFFFFFFFF
244 /// Maximum usable address at boot time
246 #define MAX_ALLOC_ADDRESS MAX_ADDRESS
249 /// Maximum legal IA-32 INTN and UINTN values.
251 #define MAX_INTN ((INTN)0x7FFFFFFF)
252 #define MAX_UINTN ((UINTN)0xFFFFFFFF)
255 /// Minimum legal IA-32 INTN value.
257 #define MIN_INTN (((INTN)-2147483647) - 1)
260 /// The stack alignment required for IA-32.
262 #define CPU_STACK_ALIGNMENT sizeof(UINTN)
265 /// Page allocation granularity for IA-32.
267 #define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)
268 #define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x1000)
271 // Modifier to ensure that all protocol member functions and EFI intrinsics
272 // use the correct C calling convention. All protocol member functions and
273 // EFI intrinsics are required to modify their member functions with EFIAPI.
277 /// If EFIAPI is already defined, then we use that definition.
279 #elif defined(_MSC_EXTENSIONS)
281 /// Microsoft* compiler specific method for EFIAPI calling convention.
283 #define EFIAPI __cdecl
284 #elif defined(__GNUC__) || defined(__clang__)
286 /// GCC specific method for EFIAPI calling convention.
288 #define EFIAPI __attribute__((cdecl))
291 /// The default for a non Microsoft* or GCC compiler is to assume the EFI ABI
297 #if defined(__GNUC__) || defined(__clang__)
299 /// For GNU assembly code, .global or .globl can declare global symbols.
300 /// Define this macro to unify the usage.
302 #define ASM_GLOBAL .globl
306 Return the pointer to the first instruction of a function given a function pointer.
307 On IA-32 CPU architectures, these two pointer values are the same,
308 so the implementation of this macro is very simple.
310 @param FunctionPointer A pointer to a function.
312 @return The pointer to the first instruction of a function given a function pointer.
315 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
317 #ifndef __USER_LABEL_PREFIX__
318 #define __USER_LABEL_PREFIX__ _