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#define GCC_ASM_EXPORT(func__) \
183 .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
184 .type ASM_PFX(func__), %function
185
186#define GCC_ASM_IMPORT(func__) \
187 .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
188
189 #if defined (__ARM_FEATURE_BTI_DEFAULT) && __ARM_FEATURE_BTI_DEFAULT == 1
190#define AARCH64_BTI_NOTE() \
191 .ifndef .Lgnu_bti_notesize ;\
192 .pushsection .note.gnu.property, "a" ;\
193 .set NT_GNU_PROPERTY_TYPE_0, 0x5 ;\
194 .set GNU_PROPERTY_AARCH64_FEATURE_1_AND, 0xc0000000 ;\
195 .set GNU_PROPERTY_AARCH64_FEATURE_1_BTI, 0x1 ;\
196 .align 3 ;\
197 .long .Lnamesize ;\
198 .long .Lgnu_bti_notesize ;\
199 .long NT_GNU_PROPERTY_TYPE_0 ;\
2000: .asciz "GNU" ;\
201 .set .Lnamesize, . - 0b ;\
202 .align 3 ;\
2031: .long GNU_PROPERTY_AARCH64_FEATURE_1_AND ;\
204 .long .Lvalsize ;\
2052: .long GNU_PROPERTY_AARCH64_FEATURE_1_BTI ;\
206 .set .Lvalsize, . - 2b ;\
207 .align 3 ;\
208 .set .Lgnu_bti_notesize, . - 1b ;\
209 .popsection ;\
210 .endif
211
212#define AARCH64_BTI(__type) \
213 AARCH64_BTI_NOTE() ;\
214 bti __type
215
216 #endif
217
218#endif
219
220#ifndef AARCH64_BTI
221#define AARCH64_BTI_NOTE()
222#define AARCH64_BTI(__type)
223#endif
224
235#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
236
237#ifndef __USER_LABEL_PREFIX__
238#define __USER_LABEL_PREFIX__
239#endif
240
241#endif
UINT64 UINTN
INT64 INTN