Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

ProcessorBind.h 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. /** @file
  2. Processor or Compiler specific defines and types for IA-32 architecture.
  3. Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
  4. This program and the accompanying materials are licensed and made available under
  5. the terms and conditions of the BSD License that accompanies this distribution.
  6. 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. FILE_LICENCE ( BSD3 );
  14. ///
  15. /// Define the processor type so other code can make processor based choices.
  16. ///
  17. #define MDE_CPU_IA32
  18. //
  19. // Make sure we are using the correct packing rules per EFI specification
  20. //
  21. #if !defined(__GNUC__)
  22. #pragma pack()
  23. #endif
  24. #if defined(__INTEL_COMPILER)
  25. //
  26. // Disable ICC's remark #869: "Parameter" was never referenced warning.
  27. // This is legal ANSI C code so we disable the remark that is turned on with -Wall
  28. //
  29. #pragma warning ( disable : 869 )
  30. //
  31. // Disable ICC's remark #1418: external function definition with no prior declaration.
  32. // This is legal ANSI C code so we disable the remark that is turned on with /W4
  33. //
  34. #pragma warning ( disable : 1418 )
  35. //
  36. // Disable ICC's remark #1419: external declaration in primary source file
  37. // This is legal ANSI C code so we disable the remark that is turned on with /W4
  38. //
  39. #pragma warning ( disable : 1419 )
  40. //
  41. // Disable ICC's remark #593: "Variable" was set but never used.
  42. // This is legal ANSI C code so we disable the remark that is turned on with /W4
  43. //
  44. #pragma warning ( disable : 593 )
  45. #endif
  46. #if defined(_MSC_EXTENSIONS)
  47. //
  48. // Disable warning that make it impossible to compile at /W4
  49. // This only works for Microsoft* tools
  50. //
  51. //
  52. // Disabling bitfield type checking warnings.
  53. //
  54. #pragma warning ( disable : 4214 )
  55. //
  56. // Disabling the unreferenced formal parameter warnings.
  57. //
  58. #pragma warning ( disable : 4100 )
  59. //
  60. // Disable slightly different base types warning as CHAR8 * can not be set
  61. // to a constant string.
  62. //
  63. #pragma warning ( disable : 4057 )
  64. //
  65. // ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
  66. //
  67. #pragma warning ( disable : 4127 )
  68. //
  69. // This warning is caused by functions defined but not used. For precompiled header only.
  70. //
  71. #pragma warning ( disable : 4505 )
  72. //
  73. // This warning is caused by empty (after preprocessing) source file. For precompiled header only.
  74. //
  75. #pragma warning ( disable : 4206 )
  76. #endif
  77. #if defined(_MSC_EXTENSIONS)
  78. //
  79. // use Microsoft C complier dependent integer width types
  80. //
  81. ///
  82. /// 8-byte unsigned value.
  83. ///
  84. typedef unsigned __int64 UINT64;
  85. ///
  86. /// 8-byte signed value.
  87. ///
  88. typedef __int64 INT64;
  89. ///
  90. /// 4-byte unsigned value.
  91. ///
  92. typedef unsigned __int32 UINT32;
  93. ///
  94. /// 4-byte signed value.
  95. ///
  96. typedef __int32 INT32;
  97. ///
  98. /// 2-byte unsigned value.
  99. ///
  100. typedef unsigned short UINT16;
  101. ///
  102. /// 2-byte Character. Unless otherwise specified all strings are stored in the
  103. /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
  104. ///
  105. typedef unsigned short CHAR16;
  106. ///
  107. /// 2-byte signed value.
  108. ///
  109. typedef short INT16;
  110. ///
  111. /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
  112. /// values are undefined.
  113. ///
  114. typedef unsigned char BOOLEAN;
  115. ///
  116. /// 1-byte unsigned value.
  117. ///
  118. typedef unsigned char UINT8;
  119. ///
  120. /// 1-byte Character.
  121. ///
  122. typedef char CHAR8;
  123. ///
  124. /// 1-byte signed value.
  125. ///
  126. typedef signed char INT8;
  127. #else
  128. ///
  129. /// 8-byte unsigned value.
  130. ///
  131. typedef unsigned long long UINT64;
  132. ///
  133. /// 8-byte signed value.
  134. ///
  135. typedef long long INT64;
  136. ///
  137. /// 4-byte unsigned value.
  138. ///
  139. typedef unsigned int UINT32;
  140. ///
  141. /// 4-byte signed value.
  142. ///
  143. typedef int INT32;
  144. ///
  145. /// 2-byte unsigned value.
  146. ///
  147. typedef unsigned short UINT16;
  148. ///
  149. /// 2-byte Character. Unless otherwise specified all strings are stored in the
  150. /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
  151. ///
  152. typedef unsigned short CHAR16;
  153. ///
  154. /// 2-byte signed value.
  155. ///
  156. typedef short INT16;
  157. ///
  158. /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
  159. /// values are undefined.
  160. ///
  161. typedef unsigned char BOOLEAN;
  162. ///
  163. /// 1-byte unsigned value.
  164. ///
  165. typedef unsigned char UINT8;
  166. ///
  167. /// 1-byte Character
  168. ///
  169. typedef char CHAR8;
  170. ///
  171. /// 1-byte signed value
  172. ///
  173. typedef signed char INT8;
  174. #endif
  175. ///
  176. /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions;
  177. /// 8 bytes on supported 64-bit processor instructions.)
  178. ///
  179. typedef UINT32 UINTN;
  180. ///
  181. /// Signed value of native width. (4 bytes on supported 32-bit processor instructions;
  182. /// 8 bytes on supported 64-bit processor instructions.)
  183. ///
  184. typedef INT32 INTN;
  185. //
  186. // Processor specific defines
  187. //
  188. ///
  189. /// A value of native width with the highest bit set.
  190. ///
  191. #define MAX_BIT 0x80000000
  192. ///
  193. /// A value of native width with the two highest bits set.
  194. ///
  195. #define MAX_2_BITS 0xC0000000
  196. ///
  197. /// Maximum legal IA-32 address.
  198. ///
  199. #define MAX_ADDRESS 0xFFFFFFFF
  200. ///
  201. /// Maximum legal IA-32 INTN and UINTN values.
  202. ///
  203. #define MAX_INTN ((INTN)0x7FFFFFFF)
  204. #define MAX_UINTN ((UINTN)0xFFFFFFFF)
  205. ///
  206. /// The stack alignment required for IA-32.
  207. ///
  208. #define CPU_STACK_ALIGNMENT sizeof(UINTN)
  209. //
  210. // Modifier to ensure that all protocol member functions and EFI intrinsics
  211. // use the correct C calling convention. All protocol member functions and
  212. // EFI intrinsics are required to modify their member functions with EFIAPI.
  213. //
  214. #ifdef EFIAPI
  215. ///
  216. /// If EFIAPI is already defined, then we use that definition.
  217. ///
  218. #elif defined(_MSC_EXTENSIONS)
  219. ///
  220. /// Microsoft* compiler specific method for EFIAPI calling convention.
  221. ///
  222. #define EFIAPI __cdecl
  223. #elif defined(__GNUC__)
  224. ///
  225. /// GCC specific method for EFIAPI calling convention.
  226. ///
  227. #define EFIAPI __attribute__((cdecl))
  228. #else
  229. ///
  230. /// The default for a non Microsoft* or GCC compiler is to assume the EFI ABI
  231. /// is the standard.
  232. ///
  233. #define EFIAPI
  234. #endif
  235. #if defined(__GNUC__)
  236. ///
  237. /// For GNU assembly code, .global or .globl can declare global symbols.
  238. /// Define this macro to unify the usage.
  239. ///
  240. #define ASM_GLOBAL .globl
  241. #endif
  242. /**
  243. Return the pointer to the first instruction of a function given a function pointer.
  244. On IA-32 CPU architectures, these two pointer values are the same,
  245. so the implementation of this macro is very simple.
  246. @param FunctionPointer A pointer to a function.
  247. @return The pointer to the first instruction of a function given a function pointer.
  248. **/
  249. #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
  250. #ifndef __USER_LABEL_PREFIX__
  251. #define __USER_LABEL_PREFIX__ _
  252. #endif
  253. #endif