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