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