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