]>
Commit | Line | Data |
---|---|---|
4afd3d04 LG |
1 | /** @file\r |
2 | Processor or Compiler specific defines and types for AArch64.\r | |
3 | \r | |
f7496d71 | 4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
4afd3d04 LG |
5 | Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r |
6 | Portions copyright (c) 2013, ARM Ltd. All rights reserved.<BR>\r | |
7 | \r | |
2e351cbe | 8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
4afd3d04 LG |
9 | \r |
10 | **/\r | |
11 | \r | |
12 | #ifndef __PROCESSOR_BIND_H__\r | |
13 | #define __PROCESSOR_BIND_H__\r | |
14 | \r | |
15 | ///\r | |
16 | /// Define the processor type so other code can make processor based choices\r | |
17 | ///\r | |
18 | #define MDE_CPU_AARCH64\r | |
19 | \r | |
20 | //\r | |
21 | // Make sure we are using the correct packing rules per EFI specification\r | |
22 | //\r | |
23 | #ifndef __GNUC__\r | |
24 | #pragma pack()\r | |
25 | #endif\r | |
26 | \r | |
27 | #if _MSC_EXTENSIONS\r | |
28 | //\r | |
fb0b35e0 | 29 | // use Microsoft* C compiler dependent integer width types\r |
4afd3d04 LG |
30 | //\r |
31 | typedef unsigned __int64 UINT64;\r | |
32 | typedef __int64 INT64;\r | |
33 | typedef unsigned __int32 UINT32;\r | |
34 | typedef __int32 INT32;\r | |
35 | typedef unsigned short UINT16;\r | |
36 | typedef unsigned short CHAR16;\r | |
37 | typedef short INT16;\r | |
38 | typedef unsigned char BOOLEAN;\r | |
39 | typedef unsigned char UINT8;\r | |
40 | typedef char CHAR8;\r | |
41 | typedef signed char INT8;\r | |
42 | #else\r | |
43 | //\r | |
5be5439a | 44 | // Use ANSI C 2000 stdint.h integer width declarations\r |
4afd3d04 | 45 | //\r |
5be5439a LL |
46 | #include <stdint.h>\r |
47 | typedef uint8_t BOOLEAN;\r | |
48 | typedef int8_t INT8;\r | |
49 | typedef uint8_t UINT8;\r | |
50 | typedef int16_t INT16;\r | |
51 | typedef uint16_t UINT16;\r | |
52 | typedef int32_t INT32;\r | |
53 | typedef uint32_t UINT32;\r | |
54 | typedef int64_t INT64;\r | |
55 | typedef uint64_t UINT64;\r | |
56 | typedef char CHAR8;\r | |
57 | typedef uint16_t CHAR16;\r | |
4afd3d04 | 58 | \r |
4afd3d04 LG |
59 | #endif\r |
60 | \r | |
61 | ///\r | |
62 | /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,\r | |
63 | /// 8 bytes on supported 64-bit processor instructions)\r | |
64 | ///\r | |
65 | typedef UINT64 UINTN;\r | |
66 | \r | |
67 | ///\r | |
68 | /// Signed value of native width. (4 bytes on supported 32-bit processor instructions,\r | |
69 | /// 8 bytes on supported 64-bit processor instructions)\r | |
70 | ///\r | |
71 | typedef INT64 INTN;\r | |
72 | \r | |
73 | //\r | |
74 | // Processor specific defines\r | |
75 | //\r | |
76 | \r | |
77 | ///\r | |
78 | /// A value of native width with the highest bit set.\r | |
79 | ///\r | |
80 | #define MAX_BIT 0x8000000000000000\r | |
81 | \r | |
82 | ///\r | |
83 | /// A value of native width with the two highest bits set.\r | |
84 | ///\r | |
85 | #define MAX_2_BITS 0xC000000000000000\r | |
86 | \r | |
4afd3d04 LG |
87 | ///\r |
88 | /// The stack alignment required for AARCH64\r | |
89 | ///\r | |
90 | #define CPU_STACK_ALIGNMENT 16\r | |
91 | \r | |
92 | //\r | |
93 | // Modifier to ensure that all protocol member functions and EFI intrinsics\r | |
94 | // use the correct C calling convention. All protocol member functions and\r | |
95 | // EFI intrinsics are required to modify their member functions with EFIAPI.\r | |
96 | //\r | |
97 | #define EFIAPI\r | |
98 | \r | |
99 | #if defined(__GNUC__)\r | |
100 | ///\r | |
101 | /// For GNU assembly code, .global or .globl can declare global symbols.\r | |
102 | /// Define this macro to unify the usage.\r | |
103 | ///\r | |
104 | #define ASM_GLOBAL .globl\r | |
105 | \r | |
106 | #if !defined(__APPLE__)\r | |
107 | ///\r | |
108 | /// ARM EABI defines that the linker should not manipulate call relocations\r | |
109 | /// (do bl/blx conversion) unless the target symbol has function type.\r | |
110 | /// CodeSourcery 2010.09 started requiring the .type to function properly\r | |
111 | ///\r | |
112 | #define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function\r | |
113 | \r | |
114 | #define GCC_ASM_EXPORT(func__) \\r | |
115 | .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\\r | |
f7496d71 | 116 | .type ASM_PFX(func__), %function\r |
4afd3d04 LG |
117 | \r |
118 | #define GCC_ASM_IMPORT(func__) \\r | |
119 | .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)\r | |
f7496d71 | 120 | \r |
4afd3d04 LG |
121 | #else\r |
122 | //\r | |
f7496d71 | 123 | // .type not supported by Apple Xcode tools\r |
4afd3d04 | 124 | //\r |
f7496d71 | 125 | #define INTERWORK_FUNC(func__)\r |
4afd3d04 LG |
126 | \r |
127 | #define GCC_ASM_EXPORT(func__) \\r | |
128 | .globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \\r | |
f7496d71 LG |
129 | \r |
130 | #define GCC_ASM_IMPORT(name)\r | |
4afd3d04 LG |
131 | \r |
132 | #endif\r | |
133 | #endif\r | |
134 | \r | |
135 | /**\r | |
136 | Return the pointer to the first instruction of a function given a function pointer.\r | |
137 | On ARM CPU architectures, these two pointer values are the same,\r | |
138 | so the implementation of this macro is very simple.\r | |
139 | \r | |
140 | @param FunctionPointer A pointer to a function.\r | |
141 | \r | |
142 | @return The pointer to the first instruction of a function given a function pointer.\r | |
143 | \r | |
144 | **/\r | |
145 | #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r | |
146 | \r | |
147 | #endif\r | |
148 | \r |