iPXE
ProcessorBind.h
Go to the documentation of this file.
1 /** @file
2  Processor or Compiler specific defines and types for IA-32 architecture.
3 
4 Copyright (c) 2006 - 2015, 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 constructs so suppress 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 #if _MSC_VER == 1800 || _MSC_VER == 1900
99 
100 //
101 // Disable these warnings for VS2013.
102 //
103 
104 //
105 // This warning is for potentially uninitialized local variable, and it may cause false
106 // positive issues in VS2013 and VS2015 build
107 //
108 #pragma warning ( disable : 4701 )
109 
110 //
111 // This warning is for potentially uninitialized local pointer variable, and it may cause
112 // false positive issues in VS2013 and VS2015 build
113 //
114 #pragma warning ( disable : 4703 )
115 
116 #endif
117 
118 #endif
119 
120 
121 #if defined(_MSC_EXTENSIONS)
122 
123  //
124  // use Microsoft C compiler dependent integer width types
125  //
126 
127  ///
128  /// 8-byte unsigned value.
129  ///
130  typedef unsigned __int64 UINT64;
131  ///
132  /// 8-byte signed value.
133  ///
134  typedef __int64 INT64;
135  ///
136  /// 4-byte unsigned value.
137  ///
138  typedef unsigned __int32 UINT32;
139  ///
140  /// 4-byte signed value.
141  ///
142  typedef __int32 INT32;
143  ///
144  /// 2-byte unsigned value.
145  ///
146  typedef unsigned short UINT16;
147  ///
148  /// 2-byte Character. Unless otherwise specified all strings are stored in the
149  /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
150  ///
151  typedef unsigned short CHAR16;
152  ///
153  /// 2-byte signed value.
154  ///
155  typedef short INT16;
156  ///
157  /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
158  /// values are undefined.
159  ///
160  typedef unsigned char BOOLEAN;
161  ///
162  /// 1-byte unsigned value.
163  ///
164  typedef unsigned char UINT8;
165  ///
166  /// 1-byte Character.
167  ///
168  typedef char CHAR8;
169  ///
170  /// 1-byte signed value.
171  ///
172  typedef signed char INT8;
173 #else
174  ///
175  /// 8-byte unsigned value.
176  ///
177  typedef unsigned long long UINT64;
178  ///
179  /// 8-byte signed value.
180  ///
181  typedef long long INT64;
182  ///
183  /// 4-byte unsigned value.
184  ///
185  typedef unsigned int UINT32;
186  ///
187  /// 4-byte signed value.
188  ///
189  typedef int INT32;
190  ///
191  /// 2-byte unsigned value.
192  ///
193  typedef unsigned short UINT16;
194  ///
195  /// 2-byte Character. Unless otherwise specified all strings are stored in the
196  /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
197  ///
198  typedef unsigned short CHAR16;
199  ///
200  /// 2-byte signed value.
201  ///
202  typedef short INT16;
203  ///
204  /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
205  /// values are undefined.
206  ///
207  typedef unsigned char BOOLEAN;
208  ///
209  /// 1-byte unsigned value.
210  ///
211  typedef unsigned char UINT8;
212  ///
213  /// 1-byte Character
214  ///
215  typedef char CHAR8;
216  ///
217  /// 1-byte signed value
218  ///
219  typedef signed char INT8;
220 #endif
221 
222 ///
223 /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions;
224 /// 8 bytes on supported 64-bit processor instructions.)
225 ///
226 typedef UINT32 UINTN;
227 ///
228 /// Signed value of native width. (4 bytes on supported 32-bit processor instructions;
229 /// 8 bytes on supported 64-bit processor instructions.)
230 ///
231 typedef INT32 INTN;
232 
233 //
234 // Processor specific defines
235 //
236 
237 ///
238 /// A value of native width with the highest bit set.
239 ///
240 #define MAX_BIT 0x80000000
241 ///
242 /// A value of native width with the two highest bits set.
243 ///
244 #define MAX_2_BITS 0xC0000000
245 
246 ///
247 /// Maximum legal IA-32 address.
248 ///
249 #define MAX_ADDRESS 0xFFFFFFFF
250 
251 ///
252 /// Maximum legal IA-32 INTN and UINTN values.
253 ///
254 #define MAX_INTN ((INTN)0x7FFFFFFF)
255 #define MAX_UINTN ((UINTN)0xFFFFFFFF)
256 
257 ///
258 /// The stack alignment required for IA-32.
259 ///
260 #define CPU_STACK_ALIGNMENT sizeof(UINTN)
261 
262 ///
263 /// Page allocation granularity for IA-32.
264 ///
265 #define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)
266 #define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x1000)
267 
268 //
269 // Modifier to ensure that all protocol member functions and EFI intrinsics
270 // use the correct C calling convention. All protocol member functions and
271 // EFI intrinsics are required to modify their member functions with EFIAPI.
272 //
273 #ifdef EFIAPI
274  ///
275  /// If EFIAPI is already defined, then we use that definition.
276  ///
277 #elif defined(_MSC_EXTENSIONS)
278  ///
279  /// Microsoft* compiler specific method for EFIAPI calling convention.
280  ///
281  #define EFIAPI __cdecl
282 #elif defined(__GNUC__)
283  ///
284  /// GCC specific method for EFIAPI calling convention.
285  ///
286  #define EFIAPI __attribute__((cdecl))
287 #else
288  ///
289  /// The default for a non Microsoft* or GCC compiler is to assume the EFI ABI
290  /// is the standard.
291  ///
292  #define EFIAPI
293 #endif
294 
295 #if defined(__GNUC__)
296  ///
297  /// For GNU assembly code, .global or .globl can declare global symbols.
298  /// Define this macro to unify the usage.
299  ///
300  #define ASM_GLOBAL .globl
301 #endif
302 
303 /**
304  Return the pointer to the first instruction of a function given a function pointer.
305  On IA-32 CPU architectures, these two pointer values are the same,
306  so the implementation of this macro is very simple.
307 
308  @param FunctionPointer A pointer to a function.
309 
310  @return The pointer to the first instruction of a function given a function pointer.
311 
312 **/
313 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
314 
315 #ifndef __USER_LABEL_PREFIX__
316 #define __USER_LABEL_PREFIX__ _
317 #endif
318 
319 #endif
320 
int INT32
Definition: ProcessorBind.h:57
FILE_LICENCE(BSD3)
unsigned char BOOLEAN
Definition: ProcessorBind.h:61
INT64 INTN
Signed value of native width.
Definition: ProcessorBind.h:77
unsigned int UINT32
Definition: ProcessorBind.h:56
unsigned short CHAR16
Definition: ProcessorBind.h:59
unsigned char UINT8
Definition: ProcessorBind.h:62
long long INT64
Definition: ProcessorBind.h:55
short INT16
Definition: ProcessorBind.h:60
unsigned short UINT16
Definition: ProcessorBind.h:58
UINT64 UINTN
Unsigned value of native width.
Definition: ProcessorBind.h:71
unsigned long long UINT64
Definition: ProcessorBind.h:54
char CHAR8
Definition: ProcessorBind.h:63
signed char INT8
Definition: ProcessorBind.h:64