]>
Commit | Line | Data |
---|---|---|
959ccb23 | 1 | /** @file\r |
1a2f870c | 2 | Processor or Compiler specific defines and types for Intel Itanium(TM) processors.\r |
959ccb23 | 3 | \r |
9095d37b LG |
4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
5 | This program and the accompanying materials are licensed and made available\r | |
809bd7b3 | 6 | under the terms and conditions of the BSD License which accompanies this\r |
7 | distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php.\r | |
959ccb23 | 9 | \r |
809bd7b3 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
959ccb23 | 12 | \r |
959ccb23 | 13 | **/\r |
14 | \r | |
15 | #ifndef __PROCESSOR_BIND_H__\r | |
16 | #define __PROCESSOR_BIND_H__\r | |
17 | \r | |
18 | \r | |
fb5148a0 | 19 | ///\r |
809bd7b3 | 20 | /// Define the processor type so other code can make processor-based choices.\r |
fb5148a0 | 21 | ///\r |
959ccb23 | 22 | #define MDE_CPU_IPF\r |
23 | \r | |
24 | \r | |
25 | //\r | |
3963c4bf | 26 | // Make sure we are using the correct packing rules per EFI specification\r |
959ccb23 | 27 | //\r |
28 | #pragma pack()\r | |
29 | \r | |
30 | \r | |
5cfbd055 | 31 | #if defined(__INTEL_COMPILER)\r |
1fb24cc4 | 32 | //\r |
33 | // Disable ICC's remark #869: "Parameter" was never referenced warning.\r | |
34 | // This is legal ANSI C code so we disable the remark that is turned on with -Wall\r | |
35 | //\r | |
36 | #pragma warning ( disable : 869 )\r | |
37 | \r | |
46913d4d | 38 | //\r |
b483e395 A |
39 | // Disable ICC's remark #1418: external function definition with no prior declaration.\r |
40 | // This is legal ANSI C code so we disable the remark that is turned on with /W4\r | |
46913d4d | 41 | //\r |
42 | #pragma warning ( disable : 1418 )\r | |
43 | \r | |
46913d4d | 44 | //\r |
b483e395 A |
45 | // Disable ICC's remark #1419: external declaration in primary source file\r |
46 | // This is legal ANSI C code so we disable the remark that is turned on with /W4\r | |
46913d4d | 47 | //\r |
48 | #pragma warning ( disable : 1419 )\r | |
49 | \r | |
8fe69f13 | 50 | //\r |
51 | // Disable ICC's remark #593: "Variable" was set but never used.\r | |
52 | // This is legal ANSI C code so we disable the remark that is turned on with /W4\r | |
53 | //\r | |
54 | #pragma warning ( disable : 593 )\r | |
55 | \r | |
46913d4d | 56 | #endif\r |
57 | \r | |
b483e395 | 58 | \r |
5cfbd055 | 59 | #if defined(_MSC_EXTENSIONS)\r |
b483e395 A |
60 | //\r |
61 | // Disable warning that make it impossible to compile at /W4\r | |
f4ec40ab | 62 | // This only works for Microsoft* tools\r |
b483e395 A |
63 | //\r |
64 | \r | |
959ccb23 | 65 | //\r |
66 | // Disabling bitfield type checking warnings.\r | |
67 | //\r | |
68 | #pragma warning ( disable : 4214 )\r | |
69 | \r | |
f4ec40ab | 70 | //\r |
959ccb23 | 71 | // Disabling the unreferenced formal parameter warnings.\r |
72 | //\r | |
73 | #pragma warning ( disable : 4100 )\r | |
74 | \r | |
75 | //\r | |
76 | // Disable slightly different base types warning as CHAR8 * can not be set\r | |
77 | // to a constant string.\r | |
78 | //\r | |
79 | #pragma warning ( disable : 4057 )\r | |
80 | \r | |
81 | //\r | |
82 | // Disable warning on conversion from function pointer to a data pointer\r | |
83 | //\r | |
84 | #pragma warning ( disable : 4054 )\r | |
85 | \r | |
86 | //\r | |
00b7cc0f | 87 | // ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning\r |
959ccb23 | 88 | //\r |
89 | #pragma warning ( disable : 4127 )\r | |
90 | \r | |
91 | //\r | |
bf3179d8 | 92 | // Can not cast a function pointer to a data pointer. We need to do this on\r |
1a2f870c | 93 | // Itanium processors to get access to the PLABEL.\r |
959ccb23 | 94 | //\r |
95 | #pragma warning ( disable : 4514 )\r | |
96 | \r | |
97 | //\r | |
98 | // This warning is caused by functions defined but not used. For precompiled header only.\r | |
99 | //\r | |
100 | #pragma warning ( disable : 4505 )\r | |
101 | \r | |
102 | //\r | |
3963c4bf | 103 | // This warning is caused by empty (after preprocessing) source file. For precompiled header only.\r |
959ccb23 | 104 | //\r |
105 | #pragma warning ( disable : 4206 )\r | |
106 | \r | |
107 | #endif\r | |
108 | \r | |
52aa9e13 | 109 | #if defined(_MSC_EXTENSIONS)\r |
959ccb23 | 110 | //\r |
52aa9e13 | 111 | // use Microsoft C compiler dependent integer width types\r |
959ccb23 | 112 | //\r |
f4ec40ab | 113 | \r |
52aa9e13 | 114 | ///\r |
809bd7b3 | 115 | /// 8-byte unsigned value.\r |
52aa9e13 EB |
116 | ///\r |
117 | typedef unsigned __int64 UINT64;\r | |
118 | ///\r | |
809bd7b3 | 119 | /// 8-byte signed value.\r |
52aa9e13 EB |
120 | ///\r |
121 | typedef __int64 INT64;\r | |
122 | ///\r | |
809bd7b3 | 123 | /// 4-byte unsigned value.\r |
52aa9e13 EB |
124 | ///\r |
125 | typedef unsigned __int32 UINT32;\r | |
126 | ///\r | |
809bd7b3 | 127 | /// 4-byte signed value.\r |
52aa9e13 EB |
128 | ///\r |
129 | typedef __int32 INT32;\r | |
130 | ///\r | |
809bd7b3 | 131 | /// 2-byte unsigned value.\r |
52aa9e13 EB |
132 | ///\r |
133 | typedef unsigned short UINT16;\r | |
134 | ///\r | |
135 | /// 2-byte Character. Unless otherwise specified all strings are stored in the\r | |
136 | /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.\r | |
137 | ///\r | |
138 | typedef unsigned short CHAR16;\r | |
139 | ///\r | |
809bd7b3 | 140 | /// 2-byte signed value.\r |
52aa9e13 EB |
141 | ///\r |
142 | typedef short INT16;\r | |
f4ec40ab | 143 | ///\r |
144 | /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other\r | |
145 | /// values are undefined.\r | |
146 | ///\r | |
52aa9e13 EB |
147 | typedef unsigned char BOOLEAN;\r |
148 | ///\r | |
809bd7b3 | 149 | /// 1-byte unsigned value.\r |
52aa9e13 EB |
150 | ///\r |
151 | typedef unsigned char UINT8;\r | |
152 | ///\r | |
809bd7b3 | 153 | /// 1-byte Character.\r |
52aa9e13 EB |
154 | ///\r |
155 | typedef char CHAR8;\r | |
f4ec40ab | 156 | ///\r |
809bd7b3 | 157 | /// 1-byte signed value.\r |
f4ec40ab | 158 | ///\r |
d22ebbe3 | 159 | typedef signed char INT8;\r |
52aa9e13 | 160 | #else\r |
f4ec40ab | 161 | ///\r |
809bd7b3 | 162 | /// 8-byte unsigned value.\r |
f4ec40ab | 163 | ///\r |
52aa9e13 | 164 | typedef unsigned long long UINT64;\r |
f4ec40ab | 165 | ///\r |
809bd7b3 | 166 | /// 8-byte signed value.\r |
f4ec40ab | 167 | ///\r |
52aa9e13 | 168 | typedef long long INT64;\r |
f4ec40ab | 169 | ///\r |
809bd7b3 | 170 | /// 4-byte unsigned value.\r |
f4ec40ab | 171 | ///\r |
52aa9e13 | 172 | typedef unsigned int UINT32;\r |
f4ec40ab | 173 | ///\r |
809bd7b3 | 174 | /// 4-byte signed value.\r |
f4ec40ab | 175 | ///\r |
52aa9e13 | 176 | typedef int INT32;\r |
f4ec40ab | 177 | ///\r |
809bd7b3 | 178 | /// 2-byte unsigned value.\r |
f4ec40ab | 179 | ///\r |
52aa9e13 | 180 | typedef unsigned short UINT16;\r |
f4ec40ab | 181 | ///\r |
52aa9e13 EB |
182 | /// 2-byte Character. Unless otherwise specified all strings are stored in the\r |
183 | /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.\r | |
f4ec40ab | 184 | ///\r |
52aa9e13 | 185 | typedef unsigned short CHAR16;\r |
f4ec40ab | 186 | ///\r |
809bd7b3 | 187 | /// 2-byte signed value.\r |
52aa9e13 EB |
188 | ///\r |
189 | typedef short INT16;\r | |
190 | ///\r | |
191 | /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other\r | |
192 | /// values are undefined.\r | |
f4ec40ab | 193 | ///\r |
52aa9e13 EB |
194 | typedef unsigned char BOOLEAN;\r |
195 | ///\r | |
809bd7b3 | 196 | /// 1-byte unsigned value.\r |
52aa9e13 EB |
197 | ///\r |
198 | typedef unsigned char UINT8;\r | |
f4ec40ab | 199 | ///\r |
809bd7b3 | 200 | /// 1-byte Character.\r |
f4ec40ab | 201 | ///\r |
52aa9e13 | 202 | typedef char CHAR8;\r |
f4ec40ab | 203 | ///\r |
809bd7b3 | 204 | /// 1-byte signed value.\r |
f4ec40ab | 205 | ///\r |
d22ebbe3 | 206 | typedef signed char INT8;\r |
959ccb23 | 207 | #endif\r |
208 | \r | |
f4ec40ab | 209 | ///\r |
809bd7b3 | 210 | /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions;\r |
211 | /// 8 bytes on supported 64-bit processor instructions.)\r | |
f4ec40ab | 212 | ///\r |
959ccb23 | 213 | typedef UINT64 UINTN;\r |
f4ec40ab | 214 | ///\r |
809bd7b3 | 215 | /// Signed 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 | 218 | typedef INT64 INTN;\r |
219 | \r | |
220 | \r | |
221 | //\r | |
222 | // Processor specific defines\r | |
223 | //\r | |
f4ec40ab | 224 | \r |
225 | ///\r | |
226 | /// A value of native width with the highest bit set.\r | |
227 | ///\r | |
959ccb23 | 228 | #define MAX_BIT 0x8000000000000000ULL\r |
f4ec40ab | 229 | ///\r |
230 | /// A value of native width with the two highest bits set.\r | |
231 | ///\r | |
959ccb23 | 232 | #define MAX_2_BITS 0xC000000000000000ULL\r |
233 | \r | |
f4ec40ab | 234 | ///\r |
809bd7b3 | 235 | /// The maximum legal Itanium-based address\r |
f4ec40ab | 236 | ///\r |
959ccb23 | 237 | #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL\r |
238 | \r | |
068a82fc LG |
239 | ///\r |
240 | /// Maximum legal Itanium-based INTN and UINTN values.\r | |
241 | ///\r | |
242 | #define MAX_INTN ((INTN)0x7FFFFFFFFFFFFFFFULL)\r | |
243 | #define MAX_UINTN ((UINTN)0xFFFFFFFFFFFFFFFFULL)\r | |
244 | \r | |
d7a09cb8 SB |
245 | ///\r |
246 | /// Minimum legal Itanium-based INTN value.\r | |
247 | ///\r | |
248 | #define MIN_INTN (((INTN)-9223372036854775807LL) - 1)\r | |
249 | \r | |
f4ec40ab | 250 | ///\r |
251 | /// Per the Itanium Software Conventions and Runtime Architecture Guide,\r | |
252 | /// section 3.3.4, IPF stack must always be 16-byte aligned.\r | |
253 | ///\r | |
959ccb23 | 254 | #define CPU_STACK_ALIGNMENT 16\r |
255 | \r | |
08855193 AB |
256 | ///\r |
257 | /// Page allocation granularity for Itanium\r | |
258 | ///\r | |
259 | #define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)\r | |
260 | #define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x2000)\r | |
261 | \r | |
959ccb23 | 262 | //\r |
263 | // Modifier to ensure that all protocol member functions and EFI intrinsics\r | |
264 | // use the correct C calling convention. All protocol member functions and\r | |
3963c4bf | 265 | // EFI intrinsics are required to modify their member functions with EFIAPI.\r |
959ccb23 | 266 | //\r |
6149e6bb | 267 | #ifdef EFIAPI\r |
268 | ///\r | |
269 | /// If EFIAPI is already defined, then we use that definition.\r | |
270 | ///\r | |
271 | #elif defined(_MSC_EXTENSIONS)\r | |
f4ec40ab | 272 | ///\r |
809bd7b3 | 273 | /// Microsoft* compiler-specific method for EFIAPI calling convention.\r |
9095d37b | 274 | ///\r |
bf3179d8 | 275 | #define EFIAPI __cdecl\r |
959ccb23 | 276 | #else\r |
bf3179d8 | 277 | #define EFIAPI\r |
959ccb23 | 278 | #endif\r |
279 | \r | |
68167fed | 280 | ///\r |
281 | /// For GNU assembly code, .global or .globl can declare global symbols.\r | |
282 | /// Define this macro to unify the usage.\r | |
283 | ///\r | |
284 | #define ASM_GLOBAL .globl\r | |
285 | \r | |
fb5148a0 | 286 | ///\r |
287 | /// A pointer to a function in IPF points to a plabel.\r | |
288 | ///\r | |
959ccb23 | 289 | typedef struct {\r |
290 | UINT64 EntryPoint;\r | |
291 | UINT64 GP;\r | |
292 | } EFI_PLABEL;\r | |
293 | \r | |
f4ec40ab | 294 | ///\r |
295 | /// PAL Call return structure.\r | |
296 | ///\r | |
842f5579 A |
297 | typedef struct {\r |
298 | UINT64 Status;\r | |
299 | UINT64 r9;\r | |
300 | UINT64 r10;\r | |
301 | UINT64 r11;\r | |
302 | } PAL_CALL_RETURN;\r | |
303 | \r | |
14996c96 LG |
304 | /**\r |
305 | Return the pointer to the first instruction of a function given a function pointer.\r | |
9095d37b LG |
306 | For Itanium processors, all function calls are made through a PLABEL, so a pointer to a function\r |
307 | is actually a pointer to a PLABEL. The pointer to the first instruction of the function\r | |
308 | is contained within the PLABEL. This macro may be used to retrieve a pointer to the first\r | |
309 | instruction of a function independent of the CPU architecture being used. This is very\r | |
14996c96 | 310 | useful when printing function addresses through DEBUG() macros.\r |
9095d37b | 311 | \r |
3963c4bf | 312 | @param FunctionPointer A pointer to a function.\r |
14996c96 LG |
313 | \r |
314 | @return The pointer to the first instruction of a function given a function pointer.\r | |
9095d37b | 315 | \r |
14996c96 | 316 | **/\r |
9a1d00cb | 317 | #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(((EFI_PLABEL *)(FunctionPointer))->EntryPoint)\r |
24a7505c | 318 | \r |
02eef553 JJ |
319 | #ifndef __USER_LABEL_PREFIX__\r |
320 | #define __USER_LABEL_PREFIX__\r | |
321 | #endif\r | |
322 | \r | |
959ccb23 | 323 | #endif\r |
324 | \r |