]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Ia32/ProcessorBind.h
BaseTools GenFw: Fix the issue to update the wrong size as SectionSize
[mirror_edk2.git] / MdePkg / Include / Ia32 / ProcessorBind.h
CommitLineData
959ccb23 1/** @file\r
1a2f870c 2 Processor or Compiler specific defines and types for IA-32 architecture.\r
959ccb23 3\r
9095d37b 4Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
959ccb23 6\r
959ccb23 7**/\r
8\r
9#ifndef __PROCESSOR_BIND_H__\r
10#define __PROCESSOR_BIND_H__\r
11\r
3566565a 12///\r
8c18db27 13/// Define the processor type so other code can make processor based choices.\r
3566565a 14///\r
959ccb23 15#define MDE_CPU_IA32\r
16\r
17//\r
3963c4bf 18// Make sure we are using the correct packing rules per EFI specification\r
959ccb23 19//\r
5cfbd055 20#if !defined(__GNUC__)\r
959ccb23 21#pragma pack()\r
22#endif\r
23\r
5cfbd055 24#if defined(__INTEL_COMPILER)\r
ed300ce2 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
b483e395
A
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
b483e395
A
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
8fe69f13 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
b483e395
A
49#endif\r
50\r
51\r
5cfbd055 52#if defined(_MSC_EXTENSIONS)\r
959ccb23 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
00b7cc0f 76// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning\r
959ccb23 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
3963c4bf 86// This warning is caused by empty (after preprocessing) source file. For precompiled header only.\r
959ccb23 87//\r
88#pragma warning ( disable : 4206 )\r
89\r
c0f7a5d4 90#if _MSC_VER == 1800 || _MSC_VER == 1900 || _MSC_VER >= 1910\r
a5077fd0
SQ
91\r
92//\r
93// Disable these warnings for VS2013.\r
94//\r
95\r
96//\r
9095d37b 97// This warning is for potentially uninitialized local variable, and it may cause false\r
592a3790 98// positive issues in VS2013 and VS2015 build\r
a5077fd0
SQ
99//\r
100#pragma warning ( disable : 4701 )\r
9095d37b 101\r
a5077fd0 102//\r
9095d37b 103// This warning is for potentially uninitialized local pointer variable, and it may cause\r
592a3790 104// false positive issues in VS2013 and VS2015 build\r
a5077fd0
SQ
105//\r
106#pragma warning ( disable : 4703 )\r
9095d37b 107\r
a5077fd0
SQ
108#endif\r
109\r
959ccb23 110#endif\r
111\r
112\r
52aa9e13 113#if defined(_MSC_EXTENSIONS)\r
f4ec40ab 114\r
959ccb23 115 //\r
00b7cc0f 116 // use Microsoft C compiler dependent integer width types\r
959ccb23 117 //\r
f4ec40ab 118\r
52aa9e13 119 ///\r
8c18db27 120 /// 8-byte unsigned value.\r
52aa9e13
EB
121 ///\r
122 typedef unsigned __int64 UINT64;\r
123 ///\r
8c18db27 124 /// 8-byte signed value.\r
52aa9e13
EB
125 ///\r
126 typedef __int64 INT64;\r
127 ///\r
8c18db27 128 /// 4-byte unsigned value.\r
52aa9e13
EB
129 ///\r
130 typedef unsigned __int32 UINT32;\r
131 ///\r
8c18db27 132 /// 4-byte signed value.\r
52aa9e13
EB
133 ///\r
134 typedef __int32 INT32;\r
135 ///\r
8c18db27 136 /// 2-byte unsigned value.\r
52aa9e13
EB
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
8c18db27 145 /// 2-byte signed value.\r
52aa9e13
EB
146 ///\r
147 typedef short INT16;\r
f4ec40ab 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
52aa9e13
EB
152 typedef unsigned char BOOLEAN;\r
153 ///\r
8c18db27 154 /// 1-byte unsigned value.\r
52aa9e13
EB
155 ///\r
156 typedef unsigned char UINT8;\r
157 ///\r
8c18db27 158 /// 1-byte Character.\r
52aa9e13
EB
159 ///\r
160 typedef char CHAR8;\r
f4ec40ab 161 ///\r
8c18db27 162 /// 1-byte signed value.\r
f4ec40ab 163 ///\r
d22ebbe3 164 typedef signed char INT8;\r
9095d37b 165#else\r
f4ec40ab 166 ///\r
8c18db27 167 /// 8-byte unsigned value.\r
f4ec40ab 168 ///\r
52aa9e13 169 typedef unsigned long long UINT64;\r
f4ec40ab 170 ///\r
8c18db27 171 /// 8-byte signed value.\r
f4ec40ab 172 ///\r
52aa9e13 173 typedef long long INT64;\r
f4ec40ab 174 ///\r
8c18db27 175 /// 4-byte unsigned value.\r
f4ec40ab 176 ///\r
52aa9e13 177 typedef unsigned int UINT32;\r
f4ec40ab 178 ///\r
8c18db27 179 /// 4-byte signed value.\r
f4ec40ab 180 ///\r
52aa9e13 181 typedef int INT32;\r
f4ec40ab 182 ///\r
8c18db27 183 /// 2-byte unsigned value.\r
f4ec40ab 184 ///\r
52aa9e13 185 typedef unsigned short UINT16;\r
f4ec40ab 186 ///\r
52aa9e13
EB
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
f4ec40ab 189 ///\r
52aa9e13 190 typedef unsigned short CHAR16;\r
f4ec40ab 191 ///\r
8c18db27 192 /// 2-byte signed value.\r
52aa9e13
EB
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
f4ec40ab 198 ///\r
52aa9e13
EB
199 typedef unsigned char BOOLEAN;\r
200 ///\r
8c18db27 201 /// 1-byte unsigned value.\r
52aa9e13
EB
202 ///\r
203 typedef unsigned char UINT8;\r
f4ec40ab 204 ///\r
205 /// 1-byte Character\r
206 ///\r
52aa9e13 207 typedef char CHAR8;\r
f4ec40ab 208 ///\r
52aa9e13 209 /// 1-byte signed value\r
f4ec40ab 210 ///\r
d22ebbe3 211 typedef signed char INT8;\r
959ccb23 212#endif\r
213\r
f4ec40ab 214///\r
8c18db27 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
f4ec40ab 217///\r
959ccb23 218typedef UINT32 UINTN;\r
f4ec40ab 219///\r
8c18db27 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
f4ec40ab 222///\r
959ccb23 223typedef INT32 INTN;\r
224\r
f4ec40ab 225//\r
226// Processor specific defines\r
227//\r
959ccb23 228\r
3566565a 229///\r
f4ec40ab 230/// A value of native width with the highest bit set.\r
3566565a 231///\r
959ccb23 232#define MAX_BIT 0x80000000\r
f4ec40ab 233///\r
234/// A value of native width with the two highest bits set.\r
235///\r
959ccb23 236#define MAX_2_BITS 0xC0000000\r
237\r
3566565a 238///\r
8c18db27 239/// Maximum legal IA-32 address.\r
3566565a 240///\r
959ccb23 241#define MAX_ADDRESS 0xFFFFFFFF\r
242\r
67b8f806
AB
243///\r
244/// Maximum usable address at boot time\r
245///\r
246#define MAX_ALLOC_ADDRESS MAX_ADDRESS\r
247\r
068a82fc
LG
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
d7a09cb8
SB
254///\r
255/// Minimum legal IA-32 INTN value.\r
256///\r
257#define MIN_INTN (((INTN)-2147483647) - 1)\r
258\r
3566565a 259///\r
8c18db27 260/// The stack alignment required for IA-32.\r
3566565a 261///\r
959ccb23 262#define CPU_STACK_ALIGNMENT sizeof(UINTN)\r
263\r
08855193
AB
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
959ccb23 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
3963c4bf 273// EFI intrinsics are required to modify their member functions with EFIAPI.\r
959ccb23 274//\r
6149e6bb 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
3566565a 280 ///\r
8c18db27 281 /// Microsoft* compiler specific method for EFIAPI calling convention.\r
9095d37b
LG
282 ///\r
283 #define EFIAPI __cdecl\r
a0e1b127
LG
284#elif defined(__GNUC__)\r
285 ///\r
286 /// GCC specific method for EFIAPI calling convention.\r
9095d37b
LG
287 ///\r
288 #define EFIAPI __attribute__((cdecl))\r
86b2b825 289#else\r
a0e1b127
LG
290 ///\r
291 /// The default for a non Microsoft* or GCC compiler is to assume the EFI ABI\r
9095d37b 292 /// is the standard.\r
a0e1b127
LG
293 ///\r
294 #define EFIAPI\r
959ccb23 295#endif\r
296\r
5cfbd055 297#if defined(__GNUC__)\r
68167fed 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
27af6b87 303#endif\r
304\r
14996c96
LG
305/**\r
306 Return the pointer to the first instruction of a function given a function pointer.\r
9095d37b 307 On IA-32 CPU architectures, these two pointer values are the same,\r
14996c96 308 so the implementation of this macro is very simple.\r
9095d37b 309\r
3963c4bf 310 @param FunctionPointer A pointer to a function.\r
14996c96
LG
311\r
312 @return The pointer to the first instruction of a function given a function pointer.\r
9095d37b 313\r
14996c96 314**/\r
9a1d00cb 315#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r
24a7505c 316\r
02eef553
JJ
317#ifndef __USER_LABEL_PREFIX__\r
318#define __USER_LABEL_PREFIX__ _\r
319#endif\r
320\r
959ccb23 321#endif\r
322\r