]>
git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Include/Ia32/EfiBind.h
3 Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Processor or Compiler specific defines and types for IA-32.
19 We are using the ANSI C 2000 _t type definitions for basic types.
20 This it technically a violation of the coding standard, but they
21 are used to make EfiTypes.h portable. Code other than EfiTypes.h
22 should never use any ANSI C 2000 _t integer types.
31 #ifdef EFI_NT_EMULATOR
33 #define EFI_DRIVER_ENTRY_POINT(InitFunction) \
37 EFI_HANDLE ImageHandle, \
38 EFI_SYSTEM_TABLE *SystemTable \
43 _DllMainCRTStartup ( \
45 UINTN reason_for_call, \
53 __declspec( dllexport ) \
56 EFI_HANDLE ImageHandle, \
57 EFI_SYSTEM_TABLE *SystemTable \
60 return InitFunction(ImageHandle, SystemTable); \
63 #define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT
67 #define EFI_DRIVER_ENTRY_POINT(InitFunction)
68 #define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT
74 #define EFI_DRIVER_ENTRY_POINT(InitFunction)
75 #define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT
84 // Make sure we are useing the correct packing rules per EFI specification
92 // Disable ICC's warning: trailing comma is nonstandard
94 //#pragma warning ( disable : 271 )
97 // Disable ICC's warning: extra ";" ignored
99 #pragma warning ( disable : 424 )
102 // Disable ICC's warning: : variable "foo" was set but never used
104 #pragma warning ( disable : 593 )
107 // Disable ICC's remark #1418: external function definition with no prior declaration.
108 // This is legal ANSI C code so we disable the remark that is turned on with /W4
110 #pragma warning ( disable : 1418 )
114 // Disable ICC's remark #1419: external declaration in primary source file
115 // This is legal ANSI C code so we disable the remark that is turned on with /W4
117 #pragma warning ( disable : 1419 )
120 // Disable ICC's remark #869: "Parameter" was never referenced warning.
121 // This is legal ANSI C code so we disable the remark that is turned on with -Wall
123 #pragma warning ( disable : 869 )
131 // Disable warning that make it impossible to compile at /W4
132 // This only works for Microsoft* tools
136 // Disabling bitfield type checking warnings.
138 #pragma warning ( disable : 4214 )
141 // Disabling the unreferenced formal parameter warnings.
143 #pragma warning ( disable : 4100 )
146 // Disable slightly different base types warning as CHAR8 * can not be set
147 // to a constant string.
149 #pragma warning ( disable : 4057 )
152 // ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
154 #pragma warning ( disable : 4127 )
157 // Int64ShllMod32 unreferenced inline function
159 #pragma warning ( disable : 4514 )
162 // Unreferenced formal parameter - We are object oriented, so we pass This even
163 // if we don't need them.
165 #pragma warning ( disable : 4100 )
168 // This warning is caused by empty (after preprocessing) souce file.
170 #pragma warning ( disable : 4206 )
176 #if defined(_MSC_EXTENSIONS)
179 // use Microsoft C complier dependent integer width types
182 typedef unsigned __int64
uint64_t;
183 typedef __int64
int64_t;
184 typedef unsigned __int32
uint32_t;
185 typedef __int32
int32_t;
186 typedef unsigned short uint16_t;
187 typedef short int16_t;
188 typedef unsigned char uint8_t;
189 typedef signed char int8_t;
191 typedef unsigned long long uint64_t;
192 typedef long long int64_t;
193 typedef unsigned int uint32_t;
195 typedef unsigned short uint16_t;
196 typedef short int16_t;
197 typedef unsigned char uint8_t;
198 typedef signed char int8_t;
202 // Native integer size in stdint.h
204 typedef uint32_t uintn_t
;
205 typedef int32_t intn_t
;
208 // Processor specific defines
210 #define EFI_MAX_BIT 0x80000000
211 #define MAX_2_BITS 0xC0000000
214 // Maximum legal IA-32 address
216 #define EFI_MAX_ADDRESS 0xFFFFFFFF
219 // Bad pointer value to use in check builds.
220 // if you see this value you are using uninitialized or free'ed data
222 #define EFI_BAD_POINTER 0xAFAFAFAF
223 #define EFI_BAD_POINTER_AS_BYTE 0xAF
226 // Inject a break point in the code to assist debugging for NT Emulation Environment
227 // For real hardware, just put in a halt loop. Don't do a while(1) because the
228 // compiler will optimize away the rest of the function following, so that you run out in
229 // the weeds if you skip over it with a debugger.
231 #ifdef _MSC_EXTENSIONS
232 #define EFI_BREAKPOINT() __asm { int 3 }
234 #define EFI_BREAKPOINT() asm(" int $3");
237 #define EFI_DEADLOOP() { volatile UINTN __iii; __iii = 1; while (__iii); }
240 // Memory Fence forces serialization, and is needed to support out of order
241 // memory transactions. The Memory Fence is mainly used to make sure IO
242 // transactions complete in a deterministic sequence, and to syncronize locks
243 // an other MP code. Currently no memory fencing is required.
245 #define MEMORY_FENCE()
248 // Some compilers don't support the forward reference construct:
249 // typedef struct XXXXX. The forward reference is required for
250 // ANSI compatibility.
252 // The following macro provide a workaround for such cases.
256 #ifdef EFI_NO_INTERFACE_DECL
257 #define EFI_FORWARD_DECLARATION(x)
259 #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x
264 // Some C compilers optimize the calling conventions to increase performance.
265 // _EFIAPI is used to make all public APIs follow the standard C calling
270 // Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C.
273 #define _EFIAPI __cdecl
281 #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \
282 warning ( disable : 4142 )
284 #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \
285 warning ( default : 4142 )
288 #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \
289 warning ( disable : 4068 )
291 #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \
292 warning ( default : 4068 )
297 // For symbol name in GNU assembly code, an extra "_" is necessary
299 #if defined(__GNUC__)
301 /// Private worker functions for ASM_PFX()
303 #define _CONCATENATE(a, b) __CONCATENATE(a, b)
304 #define __CONCATENATE(a, b) a ## b
307 /// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix
308 /// on symbols in assembly language.
310 #define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name)