]>
Commit | Line | Data |
---|---|---|
3eb9473e | 1 | /*++\r |
2 | \r | |
f57387d5 HT |
3 | Copyright (c) 2005 - 2008, Intel Corporation. All rights reserved.<BR>\r |
4 | This program and the accompanying materials \r | |
3eb9473e | 5 | are licensed and made available under the terms and conditions of the BSD License \r |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | EfiBind.h\r | |
15 | \r | |
16 | Abstract:\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 | |
5a2bc714 | 131 | #if defined(_MSC_EXTENSIONS)\r |
3eb9473e | 132 | //\r |
5a2bc714 | 133 | // use Microsoft C complier dependent integer width types \r |
3eb9473e | 134 | //\r |
5a2bc714 | 135 | typedef unsigned __int64 uint64_t;\r |
136 | typedef __int64 int64_t;\r | |
137 | typedef unsigned __int32 uint32_t;\r | |
138 | typedef __int32 int32_t;\r | |
139 | typedef unsigned short uint16_t;\r | |
140 | typedef short int16_t;\r | |
141 | typedef unsigned char uint8_t;\r | |
142 | typedef char int8_t;\r | |
3eb9473e | 143 | #else\r |
5a2bc714 | 144 | typedef unsigned long long uint64_t;\r |
145 | typedef long long int64_t;\r | |
146 | typedef unsigned int uint32_t;\r | |
147 | typedef int int32_t;\r | |
148 | typedef unsigned short uint16_t;\r | |
149 | typedef short int16_t;\r | |
150 | typedef unsigned char uint8_t;\r | |
151 | typedef char int8_t;\r | |
3eb9473e | 152 | #endif\r |
153 | \r | |
154 | //\r | |
155 | // Native integer size in stdint.h\r | |
156 | //\r | |
157 | typedef uint64_t uintn_t;\r | |
158 | typedef int64_t intn_t;\r | |
159 | \r | |
160 | //\r | |
161 | // Processor specific defines\r | |
162 | //\r | |
96703427 | 163 | #define EFI_MAX_BIT 0x8000000000000000ULL\r |
164 | #define MAX_2_BITS 0xC000000000000000ULL\r | |
3eb9473e | 165 | \r |
166 | //\r | |
167 | // Maximum legal IA-32 address\r | |
168 | //\r | |
96703427 | 169 | #define EFI_MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL\r |
3eb9473e | 170 | \r |
171 | //\r | |
172 | // Bad pointer value to use in check builds.\r | |
173 | // if you see this value you are using uninitialized or free'ed data\r | |
174 | //\r | |
96703427 | 175 | #define EFI_BAD_POINTER 0xAFAFAFAFAFAFAFAFULL\r |
3eb9473e | 176 | #define EFI_BAD_POINTER_AS_BYTE 0xAF\r |
177 | \r | |
178 | //\r | |
179 | // Inject a break point in the code to assist debugging.\r | |
180 | //\r | |
181 | #define EFI_DEADLOOP() { volatile int __iii; __iii = 1; while (__iii); }\r | |
88b6bcec | 182 | #if _MSC_EXTENSIONS \r |
183 | #define EFI_BREAKPOINT() __debugbreak()\r | |
184 | #elif __GNUC__\r | |
185 | #define EFI_BREAKPOINT() asm(" int $3");\r | |
186 | #endif\r | |
3eb9473e | 187 | \r |
188 | //\r | |
189 | // Memory Fence forces serialization, and is needed to support out of order\r | |
190 | // memory transactions. The Memory Fence is mainly used to make sure IO\r | |
191 | // transactions complete in a deterministic sequence, and to syncronize locks\r | |
192 | // an other MP code. Currently no memory fencing is required.\r | |
193 | //\r | |
194 | #define MEMORY_FENCE()\r | |
195 | \r | |
196 | //\r | |
197 | // Some compilers don't support the forward reference construct:\r | |
198 | // typedef struct XXXXX. The forward reference is required for \r | |
199 | // ANSI compatibility.\r | |
200 | //\r | |
201 | // The following macro provide a workaround for such cases.\r | |
202 | //\r | |
203 | \r | |
204 | \r | |
205 | #ifdef EFI_NO_INTERFACE_DECL\r | |
206 | #define EFI_FORWARD_DECLARATION(x)\r | |
207 | #else\r | |
208 | #define EFI_FORWARD_DECLARATION(x) typedef struct _##x x\r | |
209 | #endif\r | |
210 | \r | |
211 | \r | |
212 | //\r | |
213 | // Some C compilers optimize the calling conventions to increase performance.\r | |
214 | // _EFIAPI is used to make all public APIs follow the standard C calling \r | |
215 | // convention.\r | |
216 | //\r | |
217 | #if _MSC_EXTENSIONS\r | |
218 | //\r | |
219 | // Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C.\r | |
220 | // \r | |
221 | \r | |
222 | #define _EFIAPI __cdecl \r | |
223 | #else\r | |
224 | #define _EFIAPI \r | |
225 | #endif\r | |
226 | \r | |
227 | \r | |
228 | #ifdef _EFI_WINNT\r | |
229 | \r | |
230 | #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r | |
231 | warning ( disable : 4142 )\r | |
232 | \r | |
233 | #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r | |
234 | warning ( default : 4142 )\r | |
235 | #else\r | |
236 | \r | |
237 | #define EFI_SUPPRESS_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r | |
238 | warning ( disable : 4068 )\r | |
239 | \r | |
240 | #define EFI_DEFAULT_BENIGN_REDEFINITION_OF_TYPE_WARNING() \\r | |
241 | warning ( default : 4068 )\r | |
242 | \r | |
243 | #endif\r | |
244 | \r | |
297c148b | 245 | //\r |
246 | // For symbol name in GNU assembly code, an extra "_" is necessary\r | |
247 | //\r | |
78709ef8 | 248 | #if defined(__GNUC__)\r |
c113cd32 | 249 | ///\r |
250 | /// Private worker functions for ASM_PFX()\r | |
251 | ///\r | |
252 | #define _CONCATENATE(a, b) __CONCATENATE(a, b)\r | |
253 | #define __CONCATENATE(a, b) a ## b\r | |
254 | \r | |
255 | ///\r | |
256 | /// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix\r | |
257 | /// on symbols in assembly language.\r | |
258 | ///\r | |
259 | #define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name)\r | |
260 | \r | |
297c148b | 261 | #endif\r |
3eb9473e | 262 | \r |
263 | #endif\r | |
264 | \r |