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