]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Arm/ProcessorBind.h
2 Processor or Compiler specific defines and types for ARM.
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef __PROCESSOR_BIND_H__
11 #define __PROCESSOR_BIND_H__
14 /// Define the processor type so other code can make processor based choices
19 // Make sure we are using the correct packing rules per EFI specification
21 #if !defined (__GNUC__) && !defined (__ASSEMBLER__)
25 #if defined (_MSC_EXTENSIONS)
28 // Disable some level 4 compilation warnings (same as IA32 and X64)
32 // Disabling bitfield type checking warnings.
34 #pragma warning ( disable : 4214 )
37 // Disabling the unreferenced formal parameter warnings.
39 #pragma warning ( disable : 4100 )
42 // Disable slightly different base types warning as CHAR8 * can not be set
43 // to a constant string.
45 #pragma warning ( disable : 4057 )
48 // ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
50 #pragma warning ( disable : 4127 )
53 // This warning is caused by functions defined but not used. For precompiled header only.
55 #pragma warning ( disable : 4505 )
58 // This warning is caused by empty (after preprocessing) source file. For precompiled header only.
60 #pragma warning ( disable : 4206 )
63 // Disable 'potentially uninitialized local variable X used' warnings
65 #pragma warning ( disable : 4701 )
68 // Disable 'potentially uninitialized local pointer variable X used' warnings
70 #pragma warning ( disable : 4703 )
75 // RVCT and MSFT don't support the __builtin_unreachable() macro
77 #if defined (__ARMCC_VERSION) || defined (_MSC_EXTENSIONS)
81 #if defined (_MSC_EXTENSIONS)
83 // use Microsoft* C compiler dependent integer width types
85 typedef unsigned __int64 UINT64
;
86 typedef __int64 INT64
;
87 typedef unsigned __int32 UINT32
;
88 typedef __int32 INT32
;
89 typedef unsigned short UINT16
;
90 typedef unsigned short CHAR16
;
92 typedef unsigned char BOOLEAN
;
93 typedef unsigned char UINT8
;
95 typedef signed char INT8
;
98 // Assume standard ARM alignment.
99 // Need to check portability of long long
101 typedef unsigned long long UINT64
;
102 typedef long long INT64
;
103 typedef unsigned int UINT32
;
105 typedef unsigned short UINT16
;
106 typedef unsigned short CHAR16
;
108 typedef unsigned char BOOLEAN
;
109 typedef unsigned char UINT8
;
111 typedef signed char INT8
;
115 /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
116 /// 8 bytes on supported 64-bit processor instructions)
118 typedef UINT32 UINTN
;
121 /// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
122 /// 8 bytes on supported 64-bit processor instructions)
127 // Processor specific defines
131 /// A value of native width with the highest bit set.
133 #define MAX_BIT 0x80000000
136 /// A value of native width with the two highest bits set.
138 #define MAX_2_BITS 0xC0000000
141 /// Maximum legal ARM address
143 #define MAX_ADDRESS 0xFFFFFFFF
146 /// Maximum usable address at boot time
148 #define MAX_ALLOC_ADDRESS MAX_ADDRESS
151 /// Maximum legal ARM INTN and UINTN values.
153 #define MAX_INTN ((INTN)0x7FFFFFFF)
154 #define MAX_UINTN ((UINTN)0xFFFFFFFF)
157 /// Minimum legal ARM INTN value.
159 #define MIN_INTN (((INTN)-2147483647) - 1)
162 /// The stack alignment required for ARM
164 #define CPU_STACK_ALIGNMENT sizeof(UINT64)
167 /// Page allocation granularity for ARM
169 #define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)
170 #define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x1000)
173 // Modifier to ensure that all protocol member functions and EFI intrinsics
174 // use the correct C calling convention. All protocol member functions and
175 // EFI intrinsics are required to modify their member functions with EFIAPI.
179 // When compiling with Clang, we still use GNU as for the assembler, so we still
180 // need to define the GCC_ASM* macros.
181 #if defined (__GNUC__) || defined (__clang__)
183 /// For GNU assembly code, .global or .globl can declare global symbols.
184 /// Define this macro to unify the usage.
186 #define ASM_GLOBAL .globl
188 #if !defined (__APPLE__)
190 /// ARM EABI defines that the linker should not manipulate call relocations
191 /// (do bl/blx conversion) unless the target symbol has function type.
192 /// CodeSourcery 2010.09 started requiring the .type to function properly
194 #define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function
196 #define GCC_ASM_EXPORT(func__) \
197 .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
198 .type ASM_PFX(func__), %function
200 #define GCC_ASM_IMPORT(func__) \
201 .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
205 // .type not supported by Apple Xcode tools
207 #define INTERWORK_FUNC(func__)
209 #define GCC_ASM_EXPORT(func__) \
210 .globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \
212 #define GCC_ASM_IMPORT(name)
215 #elif defined (_MSC_EXTENSIONS)
217 // PRESERVE8 is not supported by the MSFT assembler.
223 Return the pointer to the first instruction of a function given a function pointer.
224 On ARM CPU architectures, these two pointer values are the same,
225 so the implementation of this macro is very simple.
227 @param FunctionPointer A pointer to a function.
229 @return The pointer to the first instruction of a function given a function pointer.
232 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
234 #ifndef __USER_LABEL_PREFIX__
235 #define __USER_LABEL_PREFIX__