]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/X64/ProcessorBind.h
MdePkg IA32/X64 ProcessorBind.h : Disable the C4701 and C4703 warnings for VS2013.
[mirror_edk2.git] / MdePkg / Include / X64 / ProcessorBind.h
1 /** @file
2 Processor or Compiler specific defines and types x64 (Intel 64, AMD64).
3
4 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
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.
12
13 **/
14
15 #ifndef __PROCESSOR_BIND_H__
16 #define __PROCESSOR_BIND_H__
17
18 ///
19 /// Define the processor type so other code can make processor based choices
20 ///
21 #define MDE_CPU_X64
22
23 //
24 // Make sure we are using the correct packing rules per EFI specification
25 //
26 #if !defined(__GNUC__)
27 #pragma pack()
28 #endif
29
30
31 #if defined(__INTEL_COMPILER)
32 //
33 // Disable ICC's remark #869: "Parameter" was never referenced warning.
34 // This is legal ANSI C code so we disable the remark that is turned on with -Wall
35 //
36 #pragma warning ( disable : 869 )
37
38 //
39 // Disable ICC's remark #1418: external function definition with no prior declaration.
40 // This is legal ANSI C code so we disable the remark that is turned on with /W4
41 //
42 #pragma warning ( disable : 1418 )
43
44 //
45 // Disable ICC's remark #1419: external declaration in primary source file
46 // This is legal ANSI C code so we disable the remark that is turned on with /W4
47 //
48 #pragma warning ( disable : 1419 )
49
50 //
51 // Disable ICC's remark #593: "Variable" was set but never used.
52 // This is legal ANSI C code so we disable the remark that is turned on with /W4
53 //
54 #pragma warning ( disable : 593 )
55
56 #endif
57
58
59 #if defined(_MSC_EXTENSIONS)
60
61 //
62 // Disable warning that make it impossible to compile at /W4
63 // This only works for Microsoft* tools
64 //
65
66 //
67 // Disabling bitfield type checking warnings.
68 //
69 #pragma warning ( disable : 4214 )
70
71 //
72 // Disabling the unreferenced formal parameter warnings.
73 //
74 #pragma warning ( disable : 4100 )
75
76 //
77 // Disable slightly different base types warning as CHAR8 * can not be set
78 // to a constant string.
79 //
80 #pragma warning ( disable : 4057 )
81
82 //
83 // ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
84 //
85 #pragma warning ( disable : 4127 )
86
87 //
88 // This warning is caused by functions defined but not used. For precompiled header only.
89 //
90 #pragma warning ( disable : 4505 )
91
92 //
93 // This warning is caused by empty (after preprocessing) source file. For precompiled header only.
94 //
95 #pragma warning ( disable : 4206 )
96
97 #if _MSC_VER == 1800
98
99 //
100 // Disable these warnings for VS2013.
101 //
102
103 //
104 // This warning is for potentially uninitialized local variable, and it may cause false
105 // positive issues in VS2013 build
106 //
107 #pragma warning ( disable : 4701 )
108
109 //
110 // This warning is for potentially uninitialized local pointer variable, and it may cause
111 // false positive issues in VS2013 build
112 //
113 #pragma warning ( disable : 4703 )
114
115 #endif
116
117 #endif
118
119
120 #if defined(_MSC_EXTENSIONS)
121 //
122 // use Microsoft C complier dependent integer width types
123 //
124
125 ///
126 /// 8-byte unsigned value
127 ///
128 typedef unsigned __int64 UINT64;
129 ///
130 /// 8-byte signed value
131 ///
132 typedef __int64 INT64;
133 ///
134 /// 4-byte unsigned value
135 ///
136 typedef unsigned __int32 UINT32;
137 ///
138 /// 4-byte signed value
139 ///
140 typedef __int32 INT32;
141 ///
142 /// 2-byte unsigned value
143 ///
144 typedef unsigned short UINT16;
145 ///
146 /// 2-byte Character. Unless otherwise specified all strings are stored in the
147 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
148 ///
149 typedef unsigned short CHAR16;
150 ///
151 /// 2-byte signed value
152 ///
153 typedef short INT16;
154 ///
155 /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
156 /// values are undefined.
157 ///
158 typedef unsigned char BOOLEAN;
159 ///
160 /// 1-byte unsigned value
161 ///
162 typedef unsigned char UINT8;
163 ///
164 /// 1-byte Character
165 ///
166 typedef char CHAR8;
167 ///
168 /// 1-byte signed value
169 ///
170 typedef signed char INT8;
171 #else
172 ///
173 /// 8-byte unsigned value
174 ///
175 typedef unsigned long long UINT64;
176 ///
177 /// 8-byte signed value
178 ///
179 typedef long long INT64;
180 ///
181 /// 4-byte unsigned value
182 ///
183 typedef unsigned int UINT32;
184 ///
185 /// 4-byte signed value
186 ///
187 typedef int INT32;
188 ///
189 /// 2-byte unsigned value
190 ///
191 typedef unsigned short UINT16;
192 ///
193 /// 2-byte Character. Unless otherwise specified all strings are stored in the
194 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
195 ///
196 typedef unsigned short CHAR16;
197 ///
198 /// 2-byte signed value
199 ///
200 typedef short INT16;
201 ///
202 /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
203 /// values are undefined.
204 ///
205 typedef unsigned char BOOLEAN;
206 ///
207 /// 1-byte unsigned value
208 ///
209 typedef unsigned char UINT8;
210 ///
211 /// 1-byte Character
212 ///
213 typedef char CHAR8;
214 ///
215 /// 1-byte signed value
216 ///
217 typedef signed char INT8;
218 #endif
219
220 ///
221 /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
222 /// 8 bytes on supported 64-bit processor instructions)
223 ///
224 typedef UINT64 UINTN;
225 ///
226 /// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
227 /// 8 bytes on supported 64-bit processor instructions)
228 ///
229 typedef INT64 INTN;
230
231
232 //
233 // Processor specific defines
234 //
235
236 ///
237 /// A value of native width with the highest bit set.
238 ///
239 #define MAX_BIT 0x8000000000000000ULL
240 ///
241 /// A value of native width with the two highest bits set.
242 ///
243 #define MAX_2_BITS 0xC000000000000000ULL
244
245 ///
246 /// Maximum legal x64 address
247 ///
248 #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL
249
250 ///
251 /// Maximum legal x64 INTN and UINTN values.
252 ///
253 #define MAX_INTN ((INTN)0x7FFFFFFFFFFFFFFFULL)
254 #define MAX_UINTN ((UINTN)0xFFFFFFFFFFFFFFFFULL)
255
256 ///
257 /// The stack alignment required for x64
258 ///
259 #define CPU_STACK_ALIGNMENT 16
260
261 //
262 // Modifier to ensure that all protocol member functions and EFI intrinsics
263 // use the correct C calling convention. All protocol member functions and
264 // EFI intrinsics are required to modify their member functions with EFIAPI.
265 //
266 #ifdef EFIAPI
267 ///
268 /// If EFIAPI is already defined, then we use that definition.
269 ///
270 #elif defined(_MSC_EXTENSIONS)
271 ///
272 /// Microsoft* compiler specific method for EFIAPI calling convention.
273 ///
274 #define EFIAPI __cdecl
275 #elif defined(__GNUC__)
276 ///
277 /// Define the standard calling convention regardless of optimization level.
278 /// The GCC support assumes a GCC compiler that supports the EFI ABI. The EFI
279 /// ABI is much closer to the x64 Microsoft* ABI than standard x64 (x86-64)
280 /// GCC ABI. Thus a standard x64 (x86-64) GCC compiler can not be used for
281 /// x64. Warning the assembly code in the MDE x64 does not follow the correct
282 /// ABI for the standard x64 (x86-64) GCC.
283 ///
284 #define EFIAPI
285 #else
286 ///
287 /// The default for a non Microsoft* or GCC compiler is to assume the EFI ABI
288 /// is the standard.
289 ///
290 #define EFIAPI
291 #endif
292
293 #if defined(__GNUC__)
294 ///
295 /// For GNU assembly code, .global or .globl can declare global symbols.
296 /// Define this macro to unify the usage.
297 ///
298 #define ASM_GLOBAL .globl
299 #endif
300
301 /**
302 Return the pointer to the first instruction of a function given a function pointer.
303 On x64 CPU architectures, these two pointer values are the same,
304 so the implementation of this macro is very simple.
305
306 @param FunctionPointer A pointer to a function.
307
308 @return The pointer to the first instruction of a function given a function pointer.
309
310 **/
311 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
312
313 #ifndef __USER_LABEL_PREFIX__
314 #define __USER_LABEL_PREFIX__
315 #endif
316
317 #endif
318