TianoCore EDK2 master
Loading...
Searching...
No Matches
ProcessorBind.h
Go to the documentation of this file.
1
12#ifndef __PROCESSOR_BIND_H__
13#define __PROCESSOR_BIND_H__
14
18#define MDE_CPU_AARCH64
19
20//
21// Make sure we are using the correct packing rules per EFI specification
22//
23#if !defined (__GNUC__) && !defined (__ASSEMBLER__)
24 #pragma pack()
25#endif
26
27#if defined (_MSC_EXTENSIONS)
28
29//
30// Disable some level 4 compilation warnings (same as IA32 and X64)
31//
32
33//
34// Disabling bitfield type checking warnings.
35//
36 #pragma warning ( disable : 4214 )
37
38//
39// Disabling the unreferenced formal parameter warnings.
40//
41 #pragma warning ( disable : 4100 )
42
43//
44// Disable slightly different base types warning as CHAR8 * can not be set
45// to a constant string.
46//
47 #pragma warning ( disable : 4057 )
48
49//
50// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
51//
52 #pragma warning ( disable : 4127 )
53
54//
55// This warning is caused by functions defined but not used. For precompiled header only.
56//
57 #pragma warning ( disable : 4505 )
58
59//
60// This warning is caused by empty (after preprocessing) source file. For precompiled header only.
61//
62 #pragma warning ( disable : 4206 )
63
64//
65// Disable 'potentially uninitialized local variable X used' warnings
66//
67 #pragma warning ( disable : 4701 )
68
69//
70// Disable 'potentially uninitialized local pointer variable X used' warnings
71//
72 #pragma warning ( disable : 4703 )
73
74//
75// use Microsoft* C compiler dependent integer width types
76//
77typedef unsigned __int64 UINT64;
78typedef __int64 INT64;
79typedef unsigned __int32 UINT32;
80typedef __int32 INT32;
81typedef unsigned short UINT16;
82typedef unsigned short CHAR16;
83typedef short INT16;
84typedef unsigned char BOOLEAN;
85typedef unsigned char UINT8;
86typedef char CHAR8;
87typedef signed char INT8;
88
89#else
90
91//
92// Assume standard AARCH64 alignment.
93//
94typedef unsigned long long UINT64;
95typedef long long INT64;
96typedef unsigned int UINT32;
97typedef int INT32;
98typedef unsigned short UINT16;
99typedef unsigned short CHAR16;
100typedef short INT16;
101typedef unsigned char BOOLEAN;
102typedef unsigned char UINT8;
103typedef char CHAR8;
104typedef signed char INT8;
105
106#endif
107
112typedef UINT64 UINTN;
113
118typedef INT64 INTN;
119
120//
121// Processor specific defines
122//
123
127#define MAX_BIT 0x8000000000000000ULL
128
132#define MAX_2_BITS 0xC000000000000000ULL
133
137#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL
138
142#define MAX_ALLOC_ADDRESS 0xFFFFFFFFFFFFULL
143
147#define MAX_INTN ((INTN)0x7FFFFFFFFFFFFFFFULL)
148#define MAX_UINTN ((UINTN)0xFFFFFFFFFFFFFFFFULL)
149
153#define MIN_INTN (((INTN)-9223372036854775807LL) - 1)
154
158#define CPU_STACK_ALIGNMENT 16
159
163#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)
164#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x10000)
165
166//
167// Modifier to ensure that all protocol member functions and EFI intrinsics
168// use the correct C calling convention. All protocol member functions and
169// EFI intrinsics are required to modify their member functions with EFIAPI.
170//
171#define EFIAPI
172
173// When compiling with Clang, we still use GNU as for the assembler, so we still
174// need to define the GCC_ASM* macros.
175#if defined (__GNUC__) || defined (__clang__)
180#define ASM_GLOBAL .globl
181
182// PE targets (i.e. building with CLANGPDB) do not support the ELF style .type directive
183 #ifdef __ELF__
184#define _ASM_TYPE(Name) .type Name, %function
185 #else
186#define _ASM_TYPE(Name)
187 #endif // __ELF__
188
189#define GCC_ASM_EXPORT(func__) \
190 .global ASM_PFX(func__) ;\
191 _ASM_TYPE(ASM_PFX(func__))
192
193#define GCC_ASM_IMPORT(func__) \
194 .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
195
196 #if defined (__ARM_FEATURE_BTI_DEFAULT) && __ARM_FEATURE_BTI_DEFAULT == 1
197#define AARCH64_BTI_NOTE() \
198 .ifndef .Lgnu_bti_notesize ;\
199 .pushsection .note.gnu.property, "a" ;\
200 .set NT_GNU_PROPERTY_TYPE_0, 0x5 ;\
201 .set GNU_PROPERTY_AARCH64_FEATURE_1_AND, 0xc0000000 ;\
202 .set GNU_PROPERTY_AARCH64_FEATURE_1_BTI, 0x1 ;\
203 .align 3 ;\
204 .long .Lnamesize ;\
205 .long .Lgnu_bti_notesize ;\
206 .long NT_GNU_PROPERTY_TYPE_0 ;\
2070: .asciz "GNU" ;\
208 .set .Lnamesize, . - 0b ;\
209 .align 3 ;\
2101: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND ;\
211 .long .Lvalsize ;\
2122: .long GNU_PROPERTY_AARCH64_FEATURE_1_BTI ;\
213 .set .Lvalsize, . - 2b ;\
214 .align 3 ;\
215 .set .Lgnu_bti_notesize, . - 1b ;\
216 .popsection ;\
217 .endif
218
219#define AARCH64_BTI(__type) \
220 AARCH64_BTI_NOTE() ;\
221 bti __type
222
223 #endif
224
225#endif
226
227#ifndef AARCH64_BTI
228#define AARCH64_BTI_NOTE()
229#define AARCH64_BTI(__type)
230#endif
231
242#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
243
244#ifndef __USER_LABEL_PREFIX__
245#define __USER_LABEL_PREFIX__
246#endif
247
248#endif
UINT64 UINTN
INT64 INTN