iPXE
ProcessorBind.h
Go to the documentation of this file.
1#ifndef _IPXE_EFI_ARM_PROCESSORBIND_H
2#define _IPXE_EFI_ARM_PROCESSORBIND_H
3
4
5/** @file
6 Processor or Compiler specific defines and types for ARM.
7
8 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
9 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
10 SPDX-License-Identifier: BSD-2-Clause-Patent
11
12**/
13
14#ifndef __PROCESSOR_BIND_H__
15#define __PROCESSOR_BIND_H__
16
17FILE_LICENCE ( BSD2_PATENT );
18
19///
20/// Define the processor type so other code can make processor based choices
21///
22/// Upstream EDK2 headers no longer accept MDE_CPU_ARM: define
23/// MDE_CPU_EBC to prevent build errors. (The definition doesn't
24/// actually affect anything used by iPXE.)
25///
26#define MDE_CPU_EBC
27
28//
29// Make sure we are using the correct packing rules per EFI specification
30//
31#if !defined (__GNUC__) && !defined (__ASSEMBLER__)
32 #pragma pack()
33#endif
34
35#if defined (_MSC_EXTENSIONS)
36
37//
38// Disable some level 4 compilation warnings (same as IA32 and X64)
39//
40
41//
42// Disabling bitfield type checking warnings.
43//
44 #pragma warning ( disable : 4214 )
45
46//
47// Disabling the unreferenced formal parameter warnings.
48//
49 #pragma warning ( disable : 4100 )
50
51//
52// Disable slightly different base types warning as CHAR8 * can not be set
53// to a constant string.
54//
55 #pragma warning ( disable : 4057 )
56
57//
58// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
59//
60 #pragma warning ( disable : 4127 )
61
62//
63// This warning is caused by functions defined but not used. For precompiled header only.
64//
65 #pragma warning ( disable : 4505 )
66
67//
68// This warning is caused by empty (after preprocessing) source file. For precompiled header only.
69//
70 #pragma warning ( disable : 4206 )
71
72//
73// Disable 'potentially uninitialized local variable X used' warnings
74//
75 #pragma warning ( disable : 4701 )
76
77//
78// Disable 'potentially uninitialized local pointer variable X used' warnings
79//
80 #pragma warning ( disable : 4703 )
81
82#endif
83
84//
85// MSFT doesn't support the __builtin_unreachable() macro
86//
87#if defined (_MSC_EXTENSIONS)
88#define UNREACHABLE()
89#endif
90
91#if defined (_MSC_EXTENSIONS)
92//
93// use Microsoft* C compiler dependent integer width types
94//
95typedef unsigned __int64 UINT64;
96typedef __int64 INT64;
97typedef unsigned __int32 UINT32;
98typedef __int32 INT32;
99typedef unsigned short UINT16;
100typedef unsigned short CHAR16;
101typedef short INT16;
102typedef unsigned char BOOLEAN;
103typedef unsigned char UINT8;
104typedef char CHAR8;
105typedef signed char INT8;
106#else
107//
108// Assume standard ARM alignment.
109// Need to check portability of long long
110//
111typedef unsigned long long UINT64;
112typedef long long INT64;
113typedef unsigned int UINT32;
114typedef int INT32;
115typedef unsigned short UINT16;
116typedef unsigned short CHAR16;
117typedef short INT16;
118typedef unsigned char BOOLEAN;
119typedef unsigned char UINT8;
120typedef char CHAR8;
121typedef signed char INT8;
122#endif
123
124///
125/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
126/// 8 bytes on supported 64-bit processor instructions)
127///
128typedef UINT32 UINTN;
129
130///
131/// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
132/// 8 bytes on supported 64-bit processor instructions)
133///
134typedef INT32 INTN;
135
136//
137// Processor specific defines
138//
139
140///
141/// A value of native width with the highest bit set.
142///
143#define MAX_BIT 0x80000000
144
145///
146/// A value of native width with the two highest bits set.
147///
148#define MAX_2_BITS 0xC0000000
149
150///
151/// Maximum legal ARM address
152///
153#define MAX_ADDRESS 0xFFFFFFFF
154
155///
156/// Maximum usable address at boot time
157///
158#define MAX_ALLOC_ADDRESS MAX_ADDRESS
159
160///
161/// Maximum legal ARM INTN and UINTN values.
162///
163#define MAX_INTN ((INTN)0x7FFFFFFF)
164#define MAX_UINTN ((UINTN)0xFFFFFFFF)
165
166///
167/// Minimum legal ARM INTN value.
168///
169#define MIN_INTN (((INTN)-2147483647) - 1)
170
171///
172/// The stack alignment required for ARM
173///
174#define CPU_STACK_ALIGNMENT sizeof(UINT64)
175
176///
177/// Page allocation granularity for ARM
178///
179#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)
180#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x1000)
181
182//
183// Modifier to ensure that all protocol member functions and EFI intrinsics
184// use the correct C calling convention. All protocol member functions and
185// EFI intrinsics are required to modify their member functions with EFIAPI.
186//
187#define EFIAPI
188
189// When compiling with Clang, we still use GNU as for the assembler, so we still
190// need to define the GCC_ASM* macros.
191#if defined (__GNUC__) || defined (__clang__)
192///
193/// For GNU assembly code, .global or .globl can declare global symbols.
194/// Define this macro to unify the usage.
195///
196#define ASM_GLOBAL .globl
197
198 #if !defined (__APPLE__)
199///
200/// ARM EABI defines that the linker should not manipulate call relocations
201/// (do bl/blx conversion) unless the target symbol has function type.
202/// CodeSourcery 2010.09 started requiring the .type to function properly
203///
204#define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function
205
206#define GCC_ASM_EXPORT(func__) \
207 .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
208 .type ASM_PFX(func__), %function
209
210#define GCC_ASM_IMPORT(func__) \
211 .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
212
213 #else
214//
215// .type not supported by Apple Xcode tools
216//
217#define INTERWORK_FUNC(func__)
218
219#define GCC_ASM_EXPORT(func__) \
220 .globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \
221
222#define GCC_ASM_IMPORT(name)
223
224 #endif
225#elif defined (_MSC_EXTENSIONS)
226//
227// PRESERVE8 is not supported by the MSFT assembler.
228//
229#define PRESERVE8
230#endif
231
232/**
233 Return the pointer to the first instruction of a function given a function pointer.
234 On ARM CPU architectures, these two pointer values are the same,
235 so the implementation of this macro is very simple.
236
237 @param FunctionPointer A pointer to a function.
238
239 @return The pointer to the first instruction of a function given a function pointer.
240
241**/
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
249
250#endif /* _IPXE_EFI_ARM_PROCESSORBIND_H */
unsigned short UINT16
2-byte unsigned value.
unsigned char BOOLEAN
Logical Boolean.
char CHAR8
1-byte Character
UINT64 UINTN
Unsigned value of native width.
unsigned long long UINT64
8-byte unsigned value.
short INT16
2-byte signed value.
int INT32
4-byte signed value.
long long INT64
8-byte signed value.
unsigned short CHAR16
2-byte Character.
signed char INT8
1-byte signed value
INT64 INTN
Signed value of native width.
unsigned char UINT8
1-byte unsigned value.
unsigned int UINT32
4-byte unsigned value.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896