You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ProcessorBind.h 4.3KB

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