Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / ipxe / src / include / ipxe / efi / Ia32 / ProcessorBind.h
1 /** @file
2   Processor or Compiler specific defines and types for IA-32 architecture.
3
4 Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 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_IA32
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 #if defined(__INTEL_COMPILER)
33 //
34 // Disable ICC's remark #869: "Parameter" was never referenced warning.
35 // This is legal ANSI C code so we disable the remark that is turned on with -Wall
36 //
37 #pragma warning ( disable : 869 )
38
39 //
40 // Disable ICC's remark #1418: external function definition with no prior declaration.
41 // This is legal ANSI C code so we disable the remark that is turned on with /W4
42 //
43 #pragma warning ( disable : 1418 )
44
45 //
46 // Disable ICC's remark #1419: external declaration in primary source file
47 // This is legal ANSI C code so we disable the remark that is turned on with /W4
48 //
49 #pragma warning ( disable : 1419 )
50
51 //
52 // Disable ICC's remark #593: "Variable" was set but never used.
53 // This is legal ANSI C code so we disable the remark that is turned on with /W4
54 //
55 #pragma warning ( disable : 593 )
56
57 #endif
58
59
60 #if defined(_MSC_EXTENSIONS)
61
62 //
63 // Disable warning that make it impossible to compile at /W4
64 // This only works for Microsoft* tools
65 //
66
67 //
68 // Disabling bitfield type checking warnings.
69 //
70 #pragma warning ( disable : 4214 )
71
72 //
73 // Disabling the unreferenced formal parameter warnings.
74 //
75 #pragma warning ( disable : 4100 )
76
77 //
78 // Disable slightly different base types warning as CHAR8 * can not be set
79 // to a constant string.
80 //
81 #pragma warning ( disable : 4057 )
82
83 //
84 // ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
85 //
86 #pragma warning ( disable : 4127 )
87
88 //
89 // This warning is caused by functions defined but not used. For precompiled header only.
90 //
91 #pragma warning ( disable : 4505 )
92
93 //
94 // This warning is caused by empty (after preprocessing) source file. For precompiled header only.
95 //
96 #pragma warning ( disable : 4206 )
97
98 #endif
99
100
101 #if defined(_MSC_EXTENSIONS)
102
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 UINT32  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 INT32   INTN;
212
213 //
214 // Processor specific defines
215 //
216
217 ///
218 /// A value of native width with the highest bit set.
219 ///
220 #define MAX_BIT     0x80000000
221 ///
222 /// A value of native width with the two highest bits set.
223 ///
224 #define MAX_2_BITS  0xC0000000
225
226 ///
227 /// Maximum legal IA-32 address.
228 ///
229 #define MAX_ADDRESS   0xFFFFFFFF
230
231 ///
232 /// Maximum legal IA-32 INTN and UINTN values.
233 ///
234 #define MAX_INTN   ((INTN)0x7FFFFFFF)
235 #define MAX_UINTN  ((UINTN)0xFFFFFFFF)
236
237 ///
238 /// The stack alignment required for IA-32.
239 ///
240 #define CPU_STACK_ALIGNMENT   sizeof(UINTN)
241
242 //
243 // Modifier to ensure that all protocol member functions and EFI intrinsics
244 // use the correct C calling convention. All protocol member functions and
245 // EFI intrinsics are required to modify their member functions with EFIAPI.
246 //
247 #ifdef EFIAPI
248   ///
249   /// If EFIAPI is already defined, then we use that definition.
250   ///
251 #elif defined(_MSC_EXTENSIONS)
252   ///
253   /// Microsoft* compiler specific method for EFIAPI calling convention.
254   ///
255   #define EFIAPI __cdecl
256 #elif defined(__GNUC__)
257   ///
258   /// GCC specific method for EFIAPI calling convention.
259   ///
260   #define EFIAPI __attribute__((cdecl))
261 #else
262   ///
263   /// The default for a non Microsoft* or GCC compiler is to assume the EFI ABI
264   /// is the standard.
265   ///
266   #define EFIAPI
267 #endif
268
269 #if defined(__GNUC__)
270   ///
271   /// For GNU assembly code, .global or .globl can declare global symbols.
272   /// Define this macro to unify the usage.
273   ///
274   #define ASM_GLOBAL .globl
275 #endif
276
277 /**
278   Return the pointer to the first instruction of a function given a function pointer.
279   On IA-32 CPU architectures, these two pointer values are the same,
280   so the implementation of this macro is very simple.
281
282   @param  FunctionPointer   A pointer to a function.
283
284   @return The pointer to the first instruction of a function given a function pointer.
285
286 **/
287 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
288
289 #ifndef __USER_LABEL_PREFIX__
290 #define __USER_LABEL_PREFIX__ _
291 #endif
292
293 #endif
294