Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

ProcessorBind.h 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. /** @file
  2. Processor or Compiler specific defines and types x64 (Intel(r) EM64T, AMD64).
  3. Copyright (c) 2006, Intel Corporation
  4. All rights reserved. This program and the accompanying materials
  5. are licensed and made available under the terms and conditions of the BSD License
  6. which accompanies this distribution. The full text of the license may be found at
  7. http://opensource.org/licenses/bsd-license.php
  8. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  10. **/
  11. #ifndef __PROCESSOR_BIND_H__
  12. #define __PROCESSOR_BIND_H__
  13. ///
  14. /// Define the processor type so other code can make processor based choices
  15. ///
  16. #define MDE_CPU_X64
  17. //
  18. // Make sure we are useing the correct packing rules per EFI specification
  19. //
  20. #ifndef __GNUC__
  21. #pragma pack()
  22. #endif
  23. #if __INTEL_COMPILER
  24. //
  25. // Disable ICC's remark #869: "Parameter" was never referenced warning.
  26. // This is legal ANSI C code so we disable the remark that is turned on with -Wall
  27. //
  28. #pragma warning ( disable : 869 )
  29. //
  30. // Disable ICC's remark #1418: external function definition with no prior declaration.
  31. // This is legal ANSI C code so we disable the remark that is turned on with /W4
  32. //
  33. #pragma warning ( disable : 1418 )
  34. //
  35. // Disable ICC's remark #1419: external declaration in primary source file
  36. // This is legal ANSI C code so we disable the remark that is turned on with /W4
  37. //
  38. #pragma warning ( disable : 1419 )
  39. #endif
  40. #if _MSC_EXTENSIONS
  41. //
  42. // Disable warning that make it impossible to compile at /W4
  43. // This only works for Microsoft* tools
  44. //
  45. //
  46. // Disabling bitfield type checking warnings.
  47. //
  48. #pragma warning ( disable : 4214 )
  49. //
  50. // Disabling the unreferenced formal parameter warnings.
  51. //
  52. #pragma warning ( disable : 4100 )
  53. //
  54. // Disable slightly different base types warning as CHAR8 * can not be set
  55. // to a constant string.
  56. //
  57. #pragma warning ( disable : 4057 )
  58. //
  59. // ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
  60. //
  61. #pragma warning ( disable : 4127 )
  62. //
  63. // This warning is caused by functions defined but not used. For precompiled header only.
  64. //
  65. #pragma warning ( disable : 4505 )
  66. //
  67. // This warning is caused by empty (after preprocessing) souce file. For precompiled header only.
  68. //
  69. #pragma warning ( disable : 4206 )
  70. #endif
  71. #if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)
  72. //
  73. // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
  74. //
  75. #if _MSC_EXTENSIONS
  76. //
  77. // use Microsoft C complier dependent interger width types
  78. //
  79. typedef unsigned __int64 UINT64;
  80. typedef __int64 INT64;
  81. typedef unsigned __int32 UINT32;
  82. typedef __int32 INT32;
  83. typedef unsigned short UINT16;
  84. typedef unsigned short CHAR16;
  85. typedef short INT16;
  86. typedef unsigned char BOOLEAN;
  87. typedef unsigned char UINT8;
  88. typedef char CHAR8;
  89. typedef char INT8;
  90. #else
  91. #ifdef _EFI_P64
  92. //
  93. // P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints
  94. // are 32-bits
  95. //
  96. typedef unsigned long long UINT64;
  97. typedef long long INT64;
  98. typedef unsigned int UINT32;
  99. typedef int INT32;
  100. typedef unsigned short CHAR16;
  101. typedef unsigned short UINT16;
  102. typedef short INT16;
  103. typedef unsigned char BOOLEAN;
  104. typedef unsigned char UINT8;
  105. typedef char CHAR8;
  106. typedef char INT8;
  107. #else
  108. //
  109. // Assume LP64 - longs and pointers are 64-bit. Ints are 32-bit.
  110. //
  111. typedef unsigned long UINT64;
  112. typedef long INT64;
  113. typedef unsigned int UINT32;
  114. typedef int INT32;
  115. typedef unsigned short UINT16;
  116. typedef unsigned short CHAR16;
  117. typedef short INT16;
  118. typedef unsigned char BOOLEAN;
  119. typedef unsigned char UINT8;
  120. typedef char CHAR8;
  121. typedef char INT8;
  122. #endif
  123. #endif
  124. #define UINT8_MAX 0xff
  125. #else
  126. //
  127. // Use ANSI C 2000 stdint.h integer width declarations
  128. //
  129. #include <stdint.h>
  130. typedef uint8_t BOOLEAN;
  131. typedef int8_t INT8;
  132. typedef uint8_t UINT8;
  133. typedef int16_t INT16;
  134. typedef uint16_t UINT16;
  135. typedef int32_t INT32;
  136. typedef uint32_t UINT32;
  137. typedef int64_t INT64;
  138. typedef uint64_t UINT64;
  139. typedef char CHAR8;
  140. typedef uint16_t CHAR16;
  141. #endif
  142. typedef UINT64 UINTN;
  143. typedef INT64 INTN;
  144. //
  145. // Processor specific defines
  146. //
  147. #define MAX_BIT 0x8000000000000000ULL
  148. #define MAX_2_BITS 0xC000000000000000ULL
  149. //
  150. // Maximum legal X64 address
  151. //
  152. #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL
  153. //
  154. // The stack alignment required for X64
  155. //
  156. #define CPU_STACK_ALIGNMENT 16
  157. //
  158. // Modifier to ensure that all protocol member functions and EFI intrinsics
  159. // use the correct C calling convention. All protocol member functions and
  160. // EFI intrinsics are required to modify thier member functions with EFIAPI.
  161. //
  162. #if _MSC_EXTENSIONS
  163. ///
  164. /// Define the standard calling convention reguardless of optimization level.
  165. /// __cdecl is Microsoft* specific C extension.
  166. ///
  167. #define EFIAPI __cdecl
  168. #elif __GNUC__
  169. ///
  170. /// Define the standard calling convention reguardless of optimization level.
  171. /// The GCC support assumes a GCC compiler that supports the EFI ABI. The EFI
  172. /// ABI is much closer to the x64 Microsoft* ABI than standard x64 (x86-64)
  173. /// GCC ABI. Thus a standard x64 (x86-64) GCC compiler can not be used for
  174. /// x64. Warning the assembly code in the MDE x64 does not follow the correct
  175. /// ABI for the standard x64 (x86-64) GCC.
  176. ///
  177. #define EFIAPI __attribute__((ms_abi))
  178. #else
  179. ///
  180. /// The default for a non Microsoft* or GCC compiler is to assume the EFI ABI
  181. /// is the standard.
  182. ///
  183. #define EFIAPI
  184. #endif
  185. //
  186. // The Microsoft* C compiler can removed references to unreferenced data items
  187. // if the /OPT:REF linker option is used. We defined a macro as this is a
  188. // a non standard extension
  189. //
  190. #if _MSC_EXTENSIONS
  191. #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
  192. #else
  193. #define GLOBAL_REMOVE_IF_UNREFERENCED
  194. #endif
  195. //
  196. // For symbol name in GNU assembly code, an extra "_" is necessary
  197. //
  198. #if __GNUC__
  199. #if defined(linux)
  200. #define ASM_PFX(name) name
  201. #else
  202. #define ASM_PFX(name) _##name
  203. #endif
  204. #endif
  205. #define FUNCTION_ENTRY_POINT(p) (p)
  206. #endif