ProcessorBind.h

Go to the documentation of this file.
00001 /** @file
00002   Processor or Compiler specific defines and types for Ia32 architecture.
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_IA32
00022 
00023 //
00024 // Make sure we are useing the correct packing rules per EFI specification
00025 //
00026 #ifndef __GNUC__
00027 #pragma pack()
00028 #endif
00029 
00030 #if __INTEL_COMPILER
00031 //
00032 // Disable ICC's remark #869: "Parameter" was never referenced warning.
00033 // This is legal ANSI C code so we disable the remark that is turned on with -Wall
00034 //
00035 #pragma warning ( disable : 869 )
00036 
00037 //
00038 // Disable ICC's remark #1418: external function definition with no prior declaration.
00039 // This is legal ANSI C code so we disable the remark that is turned on with /W4
00040 //
00041 #pragma warning ( disable : 1418 )
00042 
00043 //
00044 // Disable ICC's remark #1419: external declaration in primary source file
00045 // This is legal ANSI C code so we disable the remark that is turned on with /W4
00046 //
00047 #pragma warning ( disable : 1419 )
00048 
00049 #endif
00050 
00051 
00052 #if _MSC_EXTENSIONS
00053 
00054 //
00055 // Disable warning that make it impossible to compile at /W4
00056 // This only works for Microsoft* tools
00057 //
00058 
00059 //
00060 // Disabling bitfield type checking warnings.
00061 //
00062 #pragma warning ( disable : 4214 )
00063 
00064 //
00065 // Disabling the unreferenced formal parameter warnings.
00066 //
00067 #pragma warning ( disable : 4100 )
00068 
00069 //
00070 // Disable slightly different base types warning as CHAR8 * can not be set
00071 // to a constant string.
00072 //
00073 #pragma warning ( disable : 4057 )
00074 
00075 //
00076 // ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
00077 //
00078 #pragma warning ( disable : 4127 )
00079 
00080 //
00081 // This warning is caused by functions defined but not used. For precompiled header only.
00082 //
00083 #pragma warning ( disable : 4505 )
00084 
00085 //
00086 // This warning is caused by empty (after preprocessing) souce file. For precompiled header only.
00087 //
00088 #pragma warning ( disable : 4206 )
00089 
00090 #endif
00091 
00092 
00093 #if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)
00094   //
00095   // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
00096   //
00097 
00098   #if _MSC_EXTENSIONS
00099 
00100     //
00101     // use Microsoft* C complier dependent interger width types
00102     //
00103     typedef unsigned __int64    UINT64;
00104     typedef __int64             INT64;
00105     typedef unsigned __int32    UINT32;
00106     typedef __int32             INT32;
00107     typedef unsigned short      UINT16;
00108     typedef unsigned short      CHAR16;
00109     typedef short               INT16;
00110     typedef unsigned char       BOOLEAN;
00111     typedef unsigned char       UINT8;
00112     typedef char                CHAR8;
00113     typedef char                INT8;
00114   #else
00115 
00116     //
00117     // Assume standard IA-32 alignment.
00118     // Need to check portability of long long
00119     //
00120     typedef unsigned long long  UINT64;
00121     typedef long long           INT64;
00122     typedef unsigned int        UINT32;
00123     typedef int                 INT32;
00124     typedef unsigned short      UINT16;
00125     typedef unsigned short      CHAR16;
00126     typedef short               INT16;
00127     typedef unsigned char       BOOLEAN;
00128     typedef unsigned char       UINT8;
00129     typedef char                CHAR8;
00130     typedef char                INT8;
00131   #endif
00132 
00133   #define UINT8_MAX 0xff
00134 
00135 #else
00136   //
00137   // Use ANSI C 2000 stdint.h integer width declarations
00138   //
00139   #include "stdint.h"
00140   typedef uint8_t   BOOLEAN;
00141   typedef int8_t    INT8;
00142   typedef uint8_t   UINT8;
00143   typedef int16_t   INT16;
00144   typedef uint16_t  UINT16;
00145   typedef int32_t   INT32;
00146   typedef uint32_t  UINT32;
00147   typedef int64_t   INT64;
00148   typedef uint64_t  UINT64;
00149   typedef char      CHAR8;
00150   typedef uint16_t  CHAR16;
00151 
00152 #endif
00153 
00154 typedef UINT32  UINTN;
00155 typedef INT32   INTN;
00156 
00157 
00158 ///
00159 /// Processor specific defines
00160 ///
00161 #define MAX_BIT     0x80000000
00162 #define MAX_2_BITS  0xC0000000
00163 
00164 ///
00165 /// Maximum legal IA-32 address
00166 ///
00167 #define MAX_ADDRESS   0xFFFFFFFF
00168 
00169 ///
00170 /// The stack alignment required for IA-32
00171 ///
00172 #define CPU_STACK_ALIGNMENT   sizeof(UINTN)
00173 
00174 //
00175 // Modifier to ensure that all protocol member functions and EFI intrinsics
00176 // use the correct C calling convention. All protocol member functions and
00177 // EFI intrinsics are required to modify thier member functions with EFIAPI.
00178 //
00179 #if _MSC_EXTENSIONS
00180   ///
00181   /// Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C.
00182   ///
00183   #define EFIAPI __cdecl
00184 #else
00185   #if __GNUC__
00186     #define EFIAPI __attribute__((cdecl,regparm(0)))
00187   #endif
00188 #endif
00189 
00190 //
00191 // The Microsoft* C compiler can removed references to unreferenced data items
00192 //  if the /OPT:REF linker option is used. We defined a macro as this is a
00193 //  a non standard extension
00194 //
00195 #if _MSC_EXTENSIONS
00196   #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
00197 #else
00198   #define GLOBAL_REMOVE_IF_UNREFERENCED
00199 #endif
00200 
00201 //
00202 // For symbol name in GNU assembly code, an extra "_" is necessary
00203 //
00204 #if __GNUC__
00205   #if defined(linux)
00206     #define ASM_PFX(name) name
00207   #else
00208     #define ASM_PFX(name) _##name
00209   #endif
00210 #endif
00211 
00212 #define FUNCTION_ENTRY_POINT(p) (p)
00213 
00214 #endif
00215 

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