| 1 | /** @file\r |
| 2 | Processor or Compiler specific defines and types for Intel Itanium(TM) processors.\r |
| 3 | \r |
| 4 | Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r |
| 5 | This program and the accompanying materials are licensed and made available \r |
| 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 |
| 9 | \r |
| 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 |
| 12 | \r |
| 13 | **/\r |
| 14 | \r |
| 15 | #ifndef __PROCESSOR_BIND_H__\r |
| 16 | #define __PROCESSOR_BIND_H__\r |
| 17 | \r |
| 18 | \r |
| 19 | ///\r |
| 20 | /// Define the processor type so other code can make processor-based choices.\r |
| 21 | ///\r |
| 22 | #define MDE_CPU_IPF\r |
| 23 | \r |
| 24 | \r |
| 25 | //\r |
| 26 | // Make sure we are using the correct packing rules per EFI specification\r |
| 27 | //\r |
| 28 | #pragma pack()\r |
| 29 | \r |
| 30 | \r |
| 31 | #if defined(__INTEL_COMPILER)\r |
| 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 |
| 38 | //\r |
| 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 |
| 41 | //\r |
| 42 | #pragma warning ( disable : 1418 )\r |
| 43 | \r |
| 44 | //\r |
| 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 |
| 47 | //\r |
| 48 | #pragma warning ( disable : 1419 )\r |
| 49 | \r |
| 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 |
| 56 | #endif\r |
| 57 | \r |
| 58 | \r |
| 59 | #if defined(_MSC_EXTENSIONS)\r |
| 60 | //\r |
| 61 | // Disable warning that make it impossible to compile at /W4\r |
| 62 | // This only works for Microsoft* tools\r |
| 63 | //\r |
| 64 | \r |
| 65 | //\r |
| 66 | // Disabling bitfield type checking warnings.\r |
| 67 | //\r |
| 68 | #pragma warning ( disable : 4214 )\r |
| 69 | \r |
| 70 | //\r |
| 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 |
| 87 | // ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning\r |
| 88 | //\r |
| 89 | #pragma warning ( disable : 4127 )\r |
| 90 | \r |
| 91 | //\r |
| 92 | // Can not cast a function pointer to a data pointer. We need to do this on\r |
| 93 | // Itanium processors to get access to the PLABEL.\r |
| 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 |
| 103 | // This warning is caused by empty (after preprocessing) source file. For precompiled header only.\r |
| 104 | //\r |
| 105 | #pragma warning ( disable : 4206 )\r |
| 106 | \r |
| 107 | #endif\r |
| 108 | \r |
| 109 | #if defined(_MSC_EXTENSIONS)\r |
| 110 | //\r |
| 111 | // use Microsoft C compiler dependent integer width types\r |
| 112 | //\r |
| 113 | \r |
| 114 | ///\r |
| 115 | /// 8-byte unsigned value.\r |
| 116 | ///\r |
| 117 | typedef unsigned __int64 UINT64;\r |
| 118 | ///\r |
| 119 | /// 8-byte signed value.\r |
| 120 | ///\r |
| 121 | typedef __int64 INT64;\r |
| 122 | ///\r |
| 123 | /// 4-byte unsigned value.\r |
| 124 | ///\r |
| 125 | typedef unsigned __int32 UINT32;\r |
| 126 | ///\r |
| 127 | /// 4-byte signed value.\r |
| 128 | ///\r |
| 129 | typedef __int32 INT32;\r |
| 130 | ///\r |
| 131 | /// 2-byte unsigned value.\r |
| 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 |
| 140 | /// 2-byte signed value.\r |
| 141 | ///\r |
| 142 | typedef short INT16;\r |
| 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 |
| 147 | typedef unsigned char BOOLEAN;\r |
| 148 | ///\r |
| 149 | /// 1-byte unsigned value.\r |
| 150 | ///\r |
| 151 | typedef unsigned char UINT8;\r |
| 152 | ///\r |
| 153 | /// 1-byte Character.\r |
| 154 | ///\r |
| 155 | typedef char CHAR8;\r |
| 156 | ///\r |
| 157 | /// 1-byte signed value.\r |
| 158 | ///\r |
| 159 | typedef signed char INT8;\r |
| 160 | #else\r |
| 161 | ///\r |
| 162 | /// 8-byte unsigned value.\r |
| 163 | ///\r |
| 164 | typedef unsigned long long UINT64;\r |
| 165 | ///\r |
| 166 | /// 8-byte signed value.\r |
| 167 | ///\r |
| 168 | typedef long long INT64;\r |
| 169 | ///\r |
| 170 | /// 4-byte unsigned value.\r |
| 171 | ///\r |
| 172 | typedef unsigned int UINT32;\r |
| 173 | ///\r |
| 174 | /// 4-byte signed value.\r |
| 175 | ///\r |
| 176 | typedef int INT32;\r |
| 177 | ///\r |
| 178 | /// 2-byte unsigned value.\r |
| 179 | ///\r |
| 180 | typedef unsigned short UINT16;\r |
| 181 | ///\r |
| 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 |
| 184 | ///\r |
| 185 | typedef unsigned short CHAR16;\r |
| 186 | ///\r |
| 187 | /// 2-byte signed value.\r |
| 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 |
| 193 | ///\r |
| 194 | typedef unsigned char BOOLEAN;\r |
| 195 | ///\r |
| 196 | /// 1-byte unsigned value.\r |
| 197 | ///\r |
| 198 | typedef unsigned char UINT8;\r |
| 199 | ///\r |
| 200 | /// 1-byte Character.\r |
| 201 | ///\r |
| 202 | typedef char CHAR8;\r |
| 203 | ///\r |
| 204 | /// 1-byte signed value.\r |
| 205 | ///\r |
| 206 | typedef signed char INT8;\r |
| 207 | #endif\r |
| 208 | \r |
| 209 | ///\r |
| 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 |
| 212 | ///\r |
| 213 | typedef UINT64 UINTN;\r |
| 214 | ///\r |
| 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 |
| 217 | ///\r |
| 218 | typedef INT64 INTN;\r |
| 219 | \r |
| 220 | \r |
| 221 | //\r |
| 222 | // Processor specific defines\r |
| 223 | //\r |
| 224 | \r |
| 225 | ///\r |
| 226 | /// A value of native width with the highest bit set.\r |
| 227 | ///\r |
| 228 | #define MAX_BIT 0x8000000000000000ULL\r |
| 229 | ///\r |
| 230 | /// A value of native width with the two highest bits set.\r |
| 231 | ///\r |
| 232 | #define MAX_2_BITS 0xC000000000000000ULL\r |
| 233 | \r |
| 234 | ///\r |
| 235 | /// The maximum legal Itanium-based address\r |
| 236 | ///\r |
| 237 | #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL\r |
| 238 | \r |
| 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 |
| 245 | ///\r |
| 246 | /// Per the Itanium Software Conventions and Runtime Architecture Guide,\r |
| 247 | /// section 3.3.4, IPF stack must always be 16-byte aligned.\r |
| 248 | ///\r |
| 249 | #define CPU_STACK_ALIGNMENT 16\r |
| 250 | \r |
| 251 | ///\r |
| 252 | /// Page allocation granularity for Itanium\r |
| 253 | ///\r |
| 254 | #define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)\r |
| 255 | #define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x2000)\r |
| 256 | \r |
| 257 | //\r |
| 258 | // Modifier to ensure that all protocol member functions and EFI intrinsics\r |
| 259 | // use the correct C calling convention. All protocol member functions and\r |
| 260 | // EFI intrinsics are required to modify their member functions with EFIAPI.\r |
| 261 | //\r |
| 262 | #ifdef EFIAPI\r |
| 263 | ///\r |
| 264 | /// If EFIAPI is already defined, then we use that definition.\r |
| 265 | ///\r |
| 266 | #elif defined(_MSC_EXTENSIONS)\r |
| 267 | ///\r |
| 268 | /// Microsoft* compiler-specific method for EFIAPI calling convention.\r |
| 269 | /// \r |
| 270 | #define EFIAPI __cdecl\r |
| 271 | #else\r |
| 272 | #define EFIAPI\r |
| 273 | #endif\r |
| 274 | \r |
| 275 | ///\r |
| 276 | /// For GNU assembly code, .global or .globl can declare global symbols.\r |
| 277 | /// Define this macro to unify the usage.\r |
| 278 | ///\r |
| 279 | #define ASM_GLOBAL .globl\r |
| 280 | \r |
| 281 | ///\r |
| 282 | /// A pointer to a function in IPF points to a plabel.\r |
| 283 | ///\r |
| 284 | typedef struct {\r |
| 285 | UINT64 EntryPoint;\r |
| 286 | UINT64 GP;\r |
| 287 | } EFI_PLABEL;\r |
| 288 | \r |
| 289 | ///\r |
| 290 | /// PAL Call return structure.\r |
| 291 | ///\r |
| 292 | typedef struct {\r |
| 293 | UINT64 Status;\r |
| 294 | UINT64 r9;\r |
| 295 | UINT64 r10;\r |
| 296 | UINT64 r11;\r |
| 297 | } PAL_CALL_RETURN;\r |
| 298 | \r |
| 299 | /**\r |
| 300 | Return the pointer to the first instruction of a function given a function pointer.\r |
| 301 | For Itanium processors, all function calls are made through a PLABEL, so a pointer to a function \r |
| 302 | is actually a pointer to a PLABEL. The pointer to the first instruction of the function \r |
| 303 | is contained within the PLABEL. This macro may be used to retrieve a pointer to the first \r |
| 304 | instruction of a function independent of the CPU architecture being used. This is very \r |
| 305 | useful when printing function addresses through DEBUG() macros.\r |
| 306 | \r |
| 307 | @param FunctionPointer A pointer to a function.\r |
| 308 | \r |
| 309 | @return The pointer to the first instruction of a function given a function pointer.\r |
| 310 | \r |
| 311 | **/\r |
| 312 | #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(((EFI_PLABEL *)(FunctionPointer))->EntryPoint)\r |
| 313 | \r |
| 314 | #ifndef __USER_LABEL_PREFIX__\r |
| 315 | #define __USER_LABEL_PREFIX__\r |
| 316 | #endif\r |
| 317 | \r |
| 318 | #endif\r |
| 319 | \r |