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