Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

ProcessorBind.h 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /** @file
  2. Processor or Compiler specific defines and types for ARM.
  3. Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
  4. Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
  5. This program and the accompanying materials
  6. are licensed and made available under the terms and conditions of the BSD License
  7. which accompanies this distribution. The full text of the license may be found at
  8. http://opensource.org/licenses/bsd-license.php
  9. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  11. **/
  12. #ifndef __PROCESSOR_BIND_H__
  13. #define __PROCESSOR_BIND_H__
  14. FILE_LICENCE ( BSD3 );
  15. ///
  16. /// Define the processor type so other code can make processor based choices
  17. ///
  18. #define MDE_CPU_ARM
  19. //
  20. // Make sure we are using the correct packing rules per EFI specification
  21. //
  22. #ifndef __GNUC__
  23. #pragma pack()
  24. #endif
  25. //
  26. // RVCT does not support the __builtin_unreachable() macro
  27. //
  28. #ifdef __ARMCC_VERSION
  29. #define UNREACHABLE()
  30. #endif
  31. #if _MSC_EXTENSIONS
  32. //
  33. // use Microsoft* C compiler dependent integer width types
  34. //
  35. typedef unsigned __int64 UINT64;
  36. typedef __int64 INT64;
  37. typedef unsigned __int32 UINT32;
  38. typedef __int32 INT32;
  39. typedef unsigned short UINT16;
  40. typedef unsigned short CHAR16;
  41. typedef short INT16;
  42. typedef unsigned char BOOLEAN;
  43. typedef unsigned char UINT8;
  44. typedef char CHAR8;
  45. typedef signed char INT8;
  46. #else
  47. //
  48. // Assume standard ARM alignment.
  49. // Need to check portability of long long
  50. //
  51. typedef unsigned long long UINT64;
  52. typedef long long INT64;
  53. typedef unsigned int UINT32;
  54. typedef int INT32;
  55. typedef unsigned short UINT16;
  56. typedef unsigned short CHAR16;
  57. typedef short INT16;
  58. typedef unsigned char BOOLEAN;
  59. typedef unsigned char UINT8;
  60. typedef char CHAR8;
  61. typedef signed char INT8;
  62. #endif
  63. ///
  64. /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
  65. /// 8 bytes on supported 64-bit processor instructions)
  66. ///
  67. typedef UINT32 UINTN;
  68. ///
  69. /// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
  70. /// 8 bytes on supported 64-bit processor instructions)
  71. ///
  72. typedef INT32 INTN;
  73. //
  74. // Processor specific defines
  75. //
  76. ///
  77. /// A value of native width with the highest bit set.
  78. ///
  79. #define MAX_BIT 0x80000000
  80. ///
  81. /// A value of native width with the two highest bits set.
  82. ///
  83. #define MAX_2_BITS 0xC0000000
  84. ///
  85. /// Maximum legal ARM address
  86. ///
  87. #define MAX_ADDRESS 0xFFFFFFFF
  88. ///
  89. /// Maximum legal ARM INTN and UINTN values.
  90. ///
  91. #define MAX_INTN ((INTN)0x7FFFFFFF)
  92. #define MAX_UINTN ((UINTN)0xFFFFFFFF)
  93. ///
  94. /// The stack alignment required for ARM
  95. ///
  96. #define CPU_STACK_ALIGNMENT sizeof(UINT64)
  97. ///
  98. /// Page allocation granularity for ARM
  99. ///
  100. #define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)
  101. #define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x1000)
  102. //
  103. // Modifier to ensure that all protocol member functions and EFI intrinsics
  104. // use the correct C calling convention. All protocol member functions and
  105. // EFI intrinsics are required to modify their member functions with EFIAPI.
  106. //
  107. #define EFIAPI
  108. // When compiling with Clang, we still use GNU as for the assembler, so we still
  109. // need to define the GCC_ASM* macros.
  110. #if defined(__GNUC__) || defined(__clang__)
  111. ///
  112. /// For GNU assembly code, .global or .globl can declare global symbols.
  113. /// Define this macro to unify the usage.
  114. ///
  115. #define ASM_GLOBAL .globl
  116. #if !defined(__APPLE__)
  117. ///
  118. /// ARM EABI defines that the linker should not manipulate call relocations
  119. /// (do bl/blx conversion) unless the target symbol has function type.
  120. /// CodeSourcery 2010.09 started requiring the .type to function properly
  121. ///
  122. #define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function
  123. #define GCC_ASM_EXPORT(func__) \
  124. .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
  125. .type ASM_PFX(func__), %function
  126. #define GCC_ASM_IMPORT(func__) \
  127. .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
  128. #else
  129. //
  130. // .type not supported by Apple Xcode tools
  131. //
  132. #define INTERWORK_FUNC(func__)
  133. #define GCC_ASM_EXPORT(func__) \
  134. .globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \
  135. #define GCC_ASM_IMPORT(name)
  136. #endif
  137. #endif
  138. /**
  139. Return the pointer to the first instruction of a function given a function pointer.
  140. On ARM CPU architectures, these two pointer values are the same,
  141. so the implementation of this macro is very simple.
  142. @param FunctionPointer A pointer to a function.
  143. @return The pointer to the first instruction of a function given a function pointer.
  144. **/
  145. #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
  146. #ifndef __USER_LABEL_PREFIX__
  147. #define __USER_LABEL_PREFIX__
  148. #endif
  149. #endif