ProcessorBind.h

Go to the documentation of this file.
00001 /** @file
00002   Processor or Compiler specific defines and types x64 (Intel(r) EM64T, AMD64).
00003 
00004   Copyright (c) 2006, Intel Corporation
00005   All rights reserved. This program and the accompanying materials
00006   are licensed and made available under the terms and conditions of the BSD License
00007   which accompanies this distribution.  The full text of the license may be found at
00008   http://opensource.org/licenses/bsd-license.php
00009 
00010   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
00011   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
00012 
00013 **/
00014 
00015 #ifndef __PROCESSOR_BIND_H__
00016 #define __PROCESSOR_BIND_H__
00017 
00018 ///
00019 /// Define the processor type so other code can make processor based choices
00020 ///
00021 #define MDE_CPU_X64
00022 
00023 
00024 //
00025 // Make sure we are useing the correct packing rules per EFI specification
00026 //
00027 #ifndef __GNUC__
00028 #pragma pack()
00029 #endif
00030 
00031 
00032 #if __INTEL_COMPILER
00033 //
00034 // Disable ICC's remark #869: "Parameter" was never referenced warning.
00035 // This is legal ANSI C code so we disable the remark that is turned on with -Wall
00036 //
00037 #pragma warning ( disable : 869 )
00038 
00039 //
00040 // Disable ICC's remark #1418: external function definition with no prior declaration.
00041 // This is legal ANSI C code so we disable the remark that is turned on with /W4
00042 //
00043 #pragma warning ( disable : 1418 )
00044 
00045 //
00046 // Disable ICC's remark #1419: external declaration in primary source file
00047 // This is legal ANSI C code so we disable the remark that is turned on with /W4
00048 //
00049 #pragma warning ( disable : 1419 )
00050 
00051 #endif
00052 
00053 
00054 #if _MSC_EXTENSIONS
00055 
00056 //
00057 // Disable warning that make it impossible to compile at /W4
00058 // This only works for Microsoft* tools
00059 //
00060 
00061 //
00062 // Disabling bitfield type checking warnings.
00063 //
00064 #pragma warning ( disable : 4214 )
00065 
00066 //
00067 // Disabling the unreferenced formal parameter warnings.
00068 //
00069 #pragma warning ( disable : 4100 )
00070 
00071 //
00072 // Disable slightly different base types warning as CHAR8 * can not be set
00073 // to a constant string.
00074 //
00075 #pragma warning ( disable : 4057 )
00076 
00077 //
00078 // ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
00079 //
00080 #pragma warning ( disable : 4127 )
00081 
00082 //
00083 // This warning is caused by functions defined but not used. For precompiled header only.
00084 //
00085 #pragma warning ( disable : 4505 )
00086 
00087 //
00088 // This warning is caused by empty (after preprocessing) souce file. For precompiled header only.
00089 //
00090 #pragma warning ( disable : 4206 )
00091 
00092 #endif
00093 
00094 
00095 #if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)
00096   //
00097   // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
00098   //
00099 
00100   #if _MSC_EXTENSIONS
00101 
00102 
00103     //
00104     // use Microsoft C complier dependent interger width types
00105     //
00106     typedef unsigned __int64    UINT64;
00107     typedef __int64             INT64;
00108     typedef unsigned __int32    UINT32;
00109     typedef __int32             INT32;
00110     typedef unsigned short      UINT16;
00111     typedef unsigned short      CHAR16;
00112     typedef short               INT16;
00113     typedef unsigned char       BOOLEAN;
00114     typedef unsigned char       UINT8;
00115     typedef char                CHAR8;
00116     typedef char                INT8;
00117   #else
00118     #ifdef _EFI_P64
00119       //
00120       // P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints
00121       //  are 32-bits
00122       //
00123       typedef unsigned long long  UINT64;
00124       typedef long long           INT64;
00125       typedef unsigned int        UINT32;
00126       typedef int                 INT32;
00127       typedef unsigned short      CHAR16;
00128       typedef unsigned short      UINT16;
00129       typedef short               INT16;
00130       typedef unsigned char       BOOLEAN;
00131       typedef unsigned char       UINT8;
00132       typedef char                CHAR8;
00133       typedef char                INT8;
00134     #else
00135       //
00136       // Assume LP64 - longs and pointers are 64-bit. Ints are 32-bit.
00137       //
00138       typedef unsigned long   UINT64;
00139       typedef long            INT64;
00140       typedef unsigned int    UINT32;
00141       typedef int             INT32;
00142       typedef unsigned short  UINT16;
00143       typedef unsigned short  CHAR16;
00144       typedef short           INT16;
00145       typedef unsigned char   BOOLEAN;
00146       typedef unsigned char   UINT8;
00147       typedef char            CHAR8;
00148       typedef char            INT8;
00149     #endif
00150   #endif
00151 
00152   #define UINT8_MAX 0xff
00153 
00154 #else
00155   //
00156   // Use ANSI C 2000 stdint.h integer width declarations
00157   //
00158   #include <stdint.h>
00159   typedef uint8_t   BOOLEAN;
00160   typedef int8_t    INT8;
00161   typedef uint8_t   UINT8;
00162   typedef int16_t   INT16;
00163   typedef uint16_t  UINT16;
00164   typedef int32_t   INT32;
00165   typedef uint32_t  UINT32;
00166   typedef int64_t   INT64;
00167   typedef uint64_t  UINT64;
00168   typedef char      CHAR8;
00169   typedef uint16_t  CHAR16;
00170 
00171 #endif
00172 
00173 typedef UINT64  UINTN;
00174 typedef INT64   INTN;
00175 
00176 
00177 //
00178 // Processor specific defines
00179 //
00180 #define MAX_BIT     0x8000000000000000ULL
00181 #define MAX_2_BITS  0xC000000000000000ULL
00182 
00183 //
00184 // Maximum legal X64 address
00185 //
00186 #define MAX_ADDRESS   0xFFFFFFFFFFFFFFFFULL
00187 
00188 //
00189 // The stack alignment required for X64
00190 //
00191 #define CPU_STACK_ALIGNMENT   16
00192 
00193 //
00194 // Modifier to ensure that all protocol member functions and EFI intrinsics
00195 // use the correct C calling convention. All protocol member functions and
00196 // EFI intrinsics are required to modify thier member functions with EFIAPI.
00197 //
00198 #if _MSC_EXTENSIONS
00199   ///
00200   /// Define the standard calling convention reguardless of optimization level.
00201   /// __cdecl is Microsoft* specific C extension.
00202   ///
00203   #define EFIAPI __cdecl
00204 #elif __GNUC__
00205   ///
00206   /// Define the standard calling convention reguardless of optimization level.
00207   /// The GCC support assumes a GCC compiler that supports the EFI ABI. The EFI
00208   /// ABI is much closer to the x64 Microsoft* ABI than standard x64 (x86-64)
00209   /// GCC ABI. Thus a standard x64 (x86-64) GCC compiler can not be used for
00210   /// x64. Warning the assembly code in the MDE x64 does not follow the correct
00211   /// ABI for the standard x64 (x86-64) GCC.
00212   ///
00213   #define EFIAPI __attribute__((ms_abi))
00214 #else
00215   ///
00216   /// The default for a non Microsoft* or GCC compiler is to assume the EFI ABI
00217   /// is the standard.
00218   ///
00219   #define EFIAPI
00220 #endif
00221 
00222 //
00223 // The Microsoft* C compiler can removed references to unreferenced data items
00224 //  if the /OPT:REF linker option is used. We defined a macro as this is a
00225 //  a non standard extension
00226 //
00227 #if _MSC_EXTENSIONS
00228   #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
00229 #else
00230   #define GLOBAL_REMOVE_IF_UNREFERENCED
00231 #endif
00232 
00233 //
00234 // For symbol name in GNU assembly code, an extra "_" is necessary
00235 //
00236 #if __GNUC__
00237   #if defined(linux)
00238     #define ASM_PFX(name) name
00239   #else
00240     #define ASM_PFX(name) _##name
00241   #endif
00242 #endif
00243 
00244 #define FUNCTION_ENTRY_POINT(p) (p)
00245 
00246 #endif
00247 

Generated on Tue Apr 6 20:01:06 2010 for gPXE by  doxygen 1.5.7.1