]>
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 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef __PROCESSOR_BIND_H__
17 #define __PROCESSOR_BIND_H__
20 /// Define the processor type so other code can make processor based choices
25 // Make sure we are using the correct packing rules per EFI specification
27 #if !defined(__GNUC__) && !defined(__ASSEMBLER__)
31 #if defined(_MSC_EXTENSIONS)
34 // Disable some level 4 compilation warnings (same as IA32 and X64)
38 // Disabling bitfield type checking warnings.
40 #pragma warning ( disable : 4214 )
43 // Disabling the unreferenced formal parameter warnings.
45 #pragma warning ( disable : 4100 )
48 // Disable slightly different base types warning as CHAR8 * can not be set
49 // to a constant string.
51 #pragma warning ( disable : 4057 )
54 // ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
56 #pragma warning ( disable : 4127 )
59 // This warning is caused by functions defined but not used. For precompiled header only.
61 #pragma warning ( disable : 4505 )
64 // This warning is caused by empty (after preprocessing) source file. For precompiled header only.
66 #pragma warning ( disable : 4206 )
69 // Disable 'potentially uninitialized local variable X used' warnings
71 #pragma warning ( disable : 4701 )
74 // Disable 'potentially uninitialized local pointer variable X used' warnings
76 #pragma warning ( disable : 4703 )
81 // RVCT and MSFT don't support the __builtin_unreachable() macro
83 #if defined(__ARMCC_VERSION) || defined(_MSC_EXTENSIONS)
87 #if defined(_MSC_EXTENSIONS)
89 // use Microsoft* C compiler dependent integer width types
91 typedef unsigned __int64 UINT64
;
92 typedef __int64 INT64
;
93 typedef unsigned __int32 UINT32
;
94 typedef __int32 INT32
;
95 typedef unsigned short UINT16
;
96 typedef unsigned short CHAR16
;
98 typedef unsigned char BOOLEAN
;
99 typedef unsigned char UINT8
;
101 typedef signed char INT8
;
104 // Assume standard ARM alignment.
105 // Need to check portability of long long
107 typedef unsigned long long UINT64
;
108 typedef long long INT64
;
109 typedef unsigned int UINT32
;
111 typedef unsigned short UINT16
;
112 typedef unsigned short CHAR16
;
114 typedef unsigned char BOOLEAN
;
115 typedef unsigned char UINT8
;
117 typedef signed char INT8
;
121 /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,
122 /// 8 bytes on supported 64-bit processor instructions)
124 typedef UINT32 UINTN
;
127 /// Signed value of native width. (4 bytes on supported 32-bit processor instructions,
128 /// 8 bytes on supported 64-bit processor instructions)
133 // Processor specific defines
137 /// A value of native width with the highest bit set.
139 #define MAX_BIT 0x80000000
142 /// A value of native width with the two highest bits set.
144 #define MAX_2_BITS 0xC0000000
147 /// Maximum legal ARM address
149 #define MAX_ADDRESS 0xFFFFFFFF
152 /// Maximum usable address at boot time
154 #define MAX_ALLOC_ADDRESS MAX_ALLOC_ADDRESS
157 /// Maximum legal ARM INTN and UINTN values.
159 #define MAX_INTN ((INTN)0x7FFFFFFF)
160 #define MAX_UINTN ((UINTN)0xFFFFFFFF)
163 /// Minimum legal ARM INTN value.
165 #define MIN_INTN (((INTN)-2147483647) - 1)
168 /// The stack alignment required for ARM
170 #define CPU_STACK_ALIGNMENT sizeof(UINT64)
173 /// Page allocation granularity for ARM
175 #define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)
176 #define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x1000)
179 // Modifier to ensure that all protocol member functions and EFI intrinsics
180 // use the correct C calling convention. All protocol member functions and
181 // EFI intrinsics are required to modify their member functions with EFIAPI.
185 // When compiling with Clang, we still use GNU as for the assembler, so we still
186 // need to define the GCC_ASM* macros.
187 #if defined(__GNUC__) || defined(__clang__)
189 /// For GNU assembly code, .global or .globl can declare global symbols.
190 /// Define this macro to unify the usage.
192 #define ASM_GLOBAL .globl
194 #if !defined(__APPLE__)
196 /// ARM EABI defines that the linker should not manipulate call relocations
197 /// (do bl/blx conversion) unless the target symbol has function type.
198 /// CodeSourcery 2010.09 started requiring the .type to function properly
200 #define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function
202 #define GCC_ASM_EXPORT(func__) \
203 .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
204 .type ASM_PFX(func__), %function
206 #define GCC_ASM_IMPORT(func__) \
207 .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
211 // .type not supported by Apple Xcode tools
213 #define INTERWORK_FUNC(func__)
215 #define GCC_ASM_EXPORT(func__) \
216 .globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \
218 #define GCC_ASM_IMPORT(name)
221 #elif defined(_MSC_EXTENSIONS)
223 // PRESERVE8 is not supported by the MSFT assembler.
229 Return the pointer to the first instruction of a function given a function pointer.
230 On ARM CPU architectures, these two pointer values are the same,
231 so the implementation of this macro is very simple.
233 @param FunctionPointer A pointer to a function.
235 @return The pointer to the first instruction of a function given a function pointer.
238 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
240 #ifndef __USER_LABEL_PREFIX__
241 #define __USER_LABEL_PREFIX__