]>
Commit | Line | Data |
---|---|---|
b4319afb HL |
1 | /** @file\r |
2 | Processor or Compiler specific defines and types for AArch64.\r | |
3 | \r | |
90336529 | 4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
b4319afb HL |
5 | Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r |
6 | Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>\r | |
7 | \r | |
9344f092 | 8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
b4319afb HL |
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 | |
2f88bd3a MK |
23 | #if !defined (__GNUC__) && !defined (__ASSEMBLER__)\r |
24 | #pragma pack()\r | |
b4319afb HL |
25 | #endif\r |
26 | \r | |
2f88bd3a | 27 | #if defined (_MSC_EXTENSIONS)\r |
90336529 PB |
28 | \r |
29 | //\r | |
30 | // Disable some level 4 compilation warnings (same as IA32 and X64)\r | |
31 | //\r | |
32 | \r | |
33 | //\r | |
34 | // Disabling bitfield type checking warnings.\r | |
35 | //\r | |
2f88bd3a | 36 | #pragma warning ( disable : 4214 )\r |
90336529 PB |
37 | \r |
38 | //\r | |
39 | // Disabling the unreferenced formal parameter warnings.\r | |
40 | //\r | |
2f88bd3a | 41 | #pragma warning ( disable : 4100 )\r |
90336529 PB |
42 | \r |
43 | //\r | |
44 | // Disable slightly different base types warning as CHAR8 * can not be set\r | |
45 | // to a constant string.\r | |
46 | //\r | |
2f88bd3a | 47 | #pragma warning ( disable : 4057 )\r |
90336529 PB |
48 | \r |
49 | //\r | |
50 | // ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning\r | |
51 | //\r | |
2f88bd3a | 52 | #pragma warning ( disable : 4127 )\r |
90336529 PB |
53 | \r |
54 | //\r | |
55 | // This warning is caused by functions defined but not used. For precompiled header only.\r | |
56 | //\r | |
2f88bd3a | 57 | #pragma warning ( disable : 4505 )\r |
90336529 PB |
58 | \r |
59 | //\r | |
60 | // This warning is caused by empty (after preprocessing) source file. For precompiled header only.\r | |
61 | //\r | |
2f88bd3a | 62 | #pragma warning ( disable : 4206 )\r |
90336529 PB |
63 | \r |
64 | //\r | |
65 | // Disable 'potentially uninitialized local variable X used' warnings\r | |
66 | //\r | |
2f88bd3a | 67 | #pragma warning ( disable : 4701 )\r |
90336529 PB |
68 | \r |
69 | //\r | |
70 | // Disable 'potentially uninitialized local pointer variable X used' warnings\r | |
71 | //\r | |
2f88bd3a MK |
72 | #pragma warning ( disable : 4703 )\r |
73 | \r | |
74 | //\r | |
75 | // use Microsoft* C compiler dependent integer width types\r | |
76 | //\r | |
77 | typedef unsigned __int64 UINT64;\r | |
78 | typedef __int64 INT64;\r | |
79 | typedef unsigned __int32 UINT32;\r | |
80 | typedef __int32 INT32;\r | |
81 | typedef unsigned short UINT16;\r | |
82 | typedef unsigned short CHAR16;\r | |
83 | typedef short INT16;\r | |
84 | typedef unsigned char BOOLEAN;\r | |
85 | typedef unsigned char UINT8;\r | |
86 | typedef char CHAR8;\r | |
87 | typedef signed char INT8;\r | |
90336529 | 88 | \r |
b4319afb | 89 | #else\r |
90336529 | 90 | \r |
2f88bd3a MK |
91 | //\r |
92 | // Assume standard AARCH64 alignment.\r | |
93 | //\r | |
94 | typedef unsigned long long UINT64;\r | |
95 | typedef long long INT64;\r | |
96 | typedef unsigned int UINT32;\r | |
97 | typedef int INT32;\r | |
98 | typedef unsigned short UINT16;\r | |
99 | typedef unsigned short CHAR16;\r | |
100 | typedef short INT16;\r | |
101 | typedef unsigned char BOOLEAN;\r | |
102 | typedef unsigned char UINT8;\r | |
103 | typedef char CHAR8;\r | |
104 | typedef signed char INT8;\r | |
90336529 | 105 | \r |
b4319afb HL |
106 | #endif\r |
107 | \r | |
108 | ///\r | |
109 | /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,\r | |
110 | /// 8 bytes on supported 64-bit processor instructions)\r | |
111 | ///\r | |
2f88bd3a | 112 | typedef UINT64 UINTN;\r |
b4319afb HL |
113 | \r |
114 | ///\r | |
115 | /// Signed value of native width. (4 bytes on supported 32-bit processor instructions,\r | |
116 | /// 8 bytes on supported 64-bit processor instructions)\r | |
117 | ///\r | |
2f88bd3a | 118 | typedef INT64 INTN;\r |
b4319afb HL |
119 | \r |
120 | //\r | |
121 | // Processor specific defines\r | |
122 | //\r | |
123 | \r | |
124 | ///\r | |
125 | /// A value of native width with the highest bit set.\r | |
126 | ///\r | |
2f88bd3a | 127 | #define MAX_BIT 0x8000000000000000ULL\r |
b4319afb HL |
128 | \r |
129 | ///\r | |
130 | /// A value of native width with the two highest bits set.\r | |
131 | ///\r | |
2a79158c | 132 | #define MAX_2_BITS 0xC000000000000000ULL\r |
b4319afb HL |
133 | \r |
134 | ///\r | |
a5274cdc | 135 | /// Maximum legal AARCH64 address\r |
b4319afb | 136 | ///\r |
2f88bd3a | 137 | #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL\r |
2a79158c | 138 | \r |
67b8f806 AB |
139 | ///\r |
140 | /// Maximum usable address at boot time (48 bits using 4 KB pages)\r | |
141 | ///\r | |
2f88bd3a | 142 | #define MAX_ALLOC_ADDRESS 0xFFFFFFFFFFFFULL\r |
67b8f806 | 143 | \r |
2a79158c OM |
144 | ///\r |
145 | /// Maximum legal AArch64 INTN and UINTN values.\r | |
146 | ///\r | |
147 | #define MAX_INTN ((INTN)0x7FFFFFFFFFFFFFFFULL)\r | |
148 | #define MAX_UINTN ((UINTN)0xFFFFFFFFFFFFFFFFULL)\r | |
b4319afb | 149 | \r |
d7a09cb8 SB |
150 | ///\r |
151 | /// Minimum legal AArch64 INTN value.\r | |
152 | ///\r | |
2f88bd3a | 153 | #define MIN_INTN (((INTN)-9223372036854775807LL) - 1)\r |
d7a09cb8 | 154 | \r |
b4319afb HL |
155 | ///\r |
156 | /// The stack alignment required for AARCH64\r | |
157 | ///\r | |
158 | #define CPU_STACK_ALIGNMENT 16\r | |
159 | \r | |
08855193 AB |
160 | ///\r |
161 | /// Page allocation granularity for AARCH64\r | |
162 | ///\r | |
2f88bd3a MK |
163 | #define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)\r |
164 | #define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x10000)\r | |
08855193 | 165 | \r |
b4319afb HL |
166 | //\r |
167 | // Modifier to ensure that all protocol member functions and EFI intrinsics\r | |
168 | // use the correct C calling convention. All protocol member functions and\r | |
169 | // EFI intrinsics are required to modify their member functions with EFIAPI.\r | |
170 | //\r | |
171 | #define EFIAPI\r | |
172 | \r | |
ba0a34f1 OM |
173 | // When compiling with Clang, we still use GNU as for the assembler, so we still\r |
174 | // need to define the GCC_ASM* macros.\r | |
2f88bd3a MK |
175 | #if defined (__GNUC__) || defined (__clang__)\r |
176 | ///\r | |
177 | /// For GNU assembly code, .global or .globl can declare global symbols.\r | |
178 | /// Define this macro to unify the usage.\r | |
179 | ///\r | |
180 | #define ASM_GLOBAL .globl\r | |
181 | \r | |
182 | #define GCC_ASM_EXPORT(func__) \\r | |
b4319afb HL |
183 | .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\\r |
184 | .type ASM_PFX(func__), %function\r | |
185 | \r | |
2f88bd3a | 186 | #define GCC_ASM_IMPORT(func__) \\r |
b4319afb HL |
187 | .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)\r |
188 | \r | |
189 | #endif\r | |
190 | \r | |
191 | /**\r | |
192 | Return the pointer to the first instruction of a function given a function pointer.\r | |
193 | On ARM CPU architectures, these two pointer values are the same,\r | |
194 | so the implementation of this macro is very simple.\r | |
195 | \r | |
196 | @param FunctionPointer A pointer to a function.\r | |
197 | \r | |
198 | @return The pointer to the first instruction of a function given a function pointer.\r | |
199 | \r | |
200 | **/\r | |
2f88bd3a | 201 | #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r |
b4319afb | 202 | \r |
02eef553 JJ |
203 | #ifndef __USER_LABEL_PREFIX__\r |
204 | #define __USER_LABEL_PREFIX__\r | |
205 | #endif\r | |
206 | \r | |
b4319afb | 207 | #endif\r |