]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Include/X64/EfiBind.h
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Include / X64 / EfiBind.h
CommitLineData
3eb9473e 1/*++\r
2\r
f57387d5
HT
3Copyright (c) 2005 - 2008, Intel Corporation. All rights reserved.<BR>\r
4This program and the accompanying materials \r
3eb9473e 5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 EfiBind.h\r
15\r
16Abstract:\r
17\r
18 Processor or Compiler specific defines and types for x64.\r
19 We are using the ANSI C 2000 _t type definitions for basic types.\r
20 This it technically a violation of the coding standard, but they\r
21 are used to make EfiTypes.h portable. Code other than EfiTypes.h\r
22 should never use any ANSI C 2000 _t integer types.\r
23\r
24--*/\r
25\r
26#ifndef _EFI_BIND_H_\r
27#define _EFI_BIND_H_\r
28\r
29\r
30#define EFI_DRIVER_ENTRY_POINT(InitFunction) \r
31#define EFI_APPLICATION_ENTRY_POINT EFI_DRIVER_ENTRY_POINT\r
32\r
33\r
34\r
35//\r
36// Make sure we are useing the correct packing rules per EFI specification\r
37//\r
e8de4680 38#ifndef __GNUC__\r
3eb9473e 39#pragma pack()\r
e8de4680 40#endif\r
3eb9473e 41\r
4cb43192 42#if __INTEL_COMPILER\r
43//\r
44// Disable ICC's warning: trailing comma is nonstandard\r
45//\r
46//#pragma warning ( disable : 271 )\r
47\r
48//\r
49// Disable ICC's warning: extra ";" ignored\r
50//\r
51#pragma warning ( disable : 424 )\r
52\r
53//\r
54// Disable ICC's warning: : variable "foo" was set but never used\r
55//\r
56#pragma warning ( disable : 593 )\r
57\r
58//\r
59// Disable ICC's remark #1418: external function definition with no prior declaration.\r
60// This is legal ANSI C code so we disable the remark that is turned on with /W4\r
61//\r
62#pragma warning ( disable : 1418 )\r
63\r
64\r
65//\r
66// Disable ICC's remark #1419: external declaration in primary source file\r
67// This is legal ANSI C code so we disable the remark that is turned on with /W4\r
68//\r
69#pragma warning ( disable : 1419 )\r
70\r
59a7e4f4 71//\r
72// Disable ICC's remark #869: "Parameter" was never referenced warning.\r
73// This is legal ANSI C code so we disable the remark that is turned on with -Wall\r
74//\r
75#pragma warning ( disable : 869 )\r
76\r
4cb43192 77#endif\r
78\r
79\r
3eb9473e 80#if _MSC_EXTENSIONS\r
81\r
82//\r
83// Disable warning that make it impossible to compile at /W4\r
84// This only works for Microsoft* tools\r
85//\r
86\r
87//\r
88// Disabling bitfield type checking warnings.\r
89//\r
90#pragma warning ( disable : 4214 )\r
91\r
92//\r
93// Disabling the unreferenced formal parameter warnings.\r
94//\r
95#pragma warning ( disable : 4100 )\r
96\r
97//\r
98// Disable slightly different base types warning as CHAR8 * can not be set\r
99// to a constant string.\r
100//\r
101#pragma warning ( disable : 4057 )\r
102\r
103//\r
104// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning\r
105//\r
106#pragma warning ( disable : 4127 )\r
107\r
108//\r
109// Int64ShllMod32 unreferenced inline function\r
110//\r
111#pragma warning ( disable : 4514 )\r
112\r
113//\r
114// Unreferenced formal parameter - We are object oriented, so we pass This even\r
115// if we don't need them.\r
116//\r
117#pragma warning ( disable : 4100 )\r
118\r
119//\r
120// This warning is caused by empty (after preprocessing) souce file.\r
121//\r
122#pragma warning ( disable : 4206 )\r
123\r
124//\r
125// Warning: The result of the unary '&' operator may be unaligned. Ignore it.\r
126//\r
127#pragma warning ( disable : 4366 )\r
128\r
129#endif\r
130\r
131\r
4cb43192 132#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)\r
3eb9473e 133 //\r
134 // No ANSI C 2000 stdint.h integer width declarations, so define equivalents\r
135 //\r
136 \r
137 #if _MSC_EXTENSIONS \r
138 \r
139 //\r
140 // use Microsoft* C complier dependent interger width types \r
141 //\r
142 typedef unsigned __int64 uint64_t;\r
143 typedef __int64 int64_t;\r
144 typedef unsigned __int32 uint32_t;\r
145 typedef __int32 int32_t;\r
146 typedef unsigned short uint16_t;\r
147 typedef short int16_t;\r
148 typedef unsigned char uint8_t;\r
149 typedef char int8_t;\r
150 #else\r
151\r
152 //\r
153 // Assume standard IA-32 alignment. \r
154 // BugBug: Need to check portability of long long\r
155 //\r
156 typedef unsigned long long uint64_t;\r
157 typedef long long int64_t;\r
158 typedef unsigned int uint32_t;\r
159 typedef int int32_t;\r
160 typedef unsigned short uint16_t;\r
161 typedef short int16_t;\r
162 typedef unsigned char uint8_t;\r
163 typedef char int8_t;\r
164 #endif\r
165#else\r
166 //\r
167 // Use ANSI C 2000 stdint.h integer width declarations\r
168 //\r
169 #include "stdint.h"\r
170#endif\r
171\r
172//\r
173// Native integer size in stdint.h\r
174//\r
175typedef uint64_t uintn_t;\r
176typedef int64_t intn_t;\r
177\r
178//\r
179// Processor specific defines\r
180//\r
96703427 181#define EFI_MAX_BIT 0x8000000000000000ULL\r
182#define MAX_2_BITS 0xC000000000000000ULL\r
3eb9473e 183\r
184//\r
185// Maximum legal IA-32 address\r
186//\r
96703427 187#define EFI_MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL\r
3eb9473e 188\r
189//\r
190// Bad pointer value to use in check builds.\r
191// if you see this value you are using uninitialized or free'ed data\r
192//\r
96703427 193#define EFI_BAD_POINTER 0xAFAFAFAFAFAFAFAFULL\r
3eb9473e 194#define EFI_BAD_POINTER_AS_BYTE 0xAF\r
195\r
196//\r
197// Inject a break point in the code to assist debugging.\r
198//\r
199#define EFI_DEADLOOP() { volatile int __iii; __iii = 1; while (__iii); }\r
88b6bcec 200#if _MSC_EXTENSIONS \r
201 #define EFI_BREAKPOINT() __debugbreak()\r
202#elif __GNUC__\r
203 #define EFI_BREAKPOINT() asm(" int $3");\r
204#endif\r
3eb9473e 205\r
206//\r
207// Memory Fence forces serialization, and is needed to support out of order\r
208// memory transactions. The Memory Fence is mainly used to make sure IO\r
209// transactions complete in a deterministic sequence, and to syncronize locks\r
210// an other MP code. Currently no memory fencing is required.\r
211//\r
212#define MEMORY_FENCE()\r
213\r
214//\r
215// Some compilers don't support the forward reference construct:\r
216// typedef struct XXXXX. The forward reference is required for \r
217// ANSI compatibility.\r
218//\r
219// The following macro provide a workaround for such cases.\r
220//\r
221\r
222\r
223#ifdef EFI_NO_INTERFACE_DECL\r
224 #define EFI_FORWARD_DECLARATION(x)\r
225#else\r
226 #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x\r
227#endif\r
228\r
229\r
230//\r
231// Some C compilers optimize the calling conventions to increase performance.\r
232// _EFIAPI is used to make all public APIs follow the standard C calling \r
233// convention.\r
234//\r
235#if _MSC_EXTENSIONS\r
236 //\r
237 // Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C.\r
238 // \r
239\r
240 #define _EFIAPI __cdecl \r
241#else\r
242 #define _EFIAPI \r
243#endif\r
244\r
245\r
246#ifdef _EFI_WINNT\r
247\r
248 #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r
249 warning ( disable : 4142 )\r
250\r
251 #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r
252 warning ( default : 4142 )\r
253#else\r
254\r
255 #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r
256 warning ( disable : 4068 )\r
257\r
258 #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r
259 warning ( default : 4068 )\r
260\r
261#endif\r
262\r
297c148b 263//\r
264// For symbol name in GNU assembly code, an extra "_" is necessary\r
265//\r
78709ef8 266#if defined(__GNUC__)\r
c113cd32 267 ///\r
268 /// Private worker functions for ASM_PFX()\r
269 ///\r
270 #define _CONCATENATE(a, b) __CONCATENATE(a, b)\r
271 #define __CONCATENATE(a, b) a ## b\r
272\r
273 ///\r
274 /// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix\r
275 /// on symbols in assembly language.\r
276 ///\r
277 #define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name)\r
278\r
297c148b 279#endif\r
3eb9473e 280\r
281#endif\r
282\r