]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/AArch64/ProcessorBind.h
2 Processor or Compiler specific defines and types for AArch64.
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
6 Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #ifndef __PROCESSOR_BIND_H__
19 #define __PROCESSOR_BIND_H__
22 /// Define the processor type so other code can make processor based choices
24 #define MDE_CPU_AARCH64
27 // Make sure we are using the correct packing rules per EFI specification
29 #if !defined(__GNUC__) && !defined(__ASSEMBLER__)
33 #if defined(_MSC_EXTENSIONS)
36 // Disable some level 4 compilation warnings (same as IA32 and X64)
40 // Disabling bitfield type checking warnings.
42 #pragma warning ( disable : 4214 )
45 // Disabling the unreferenced formal parameter warnings.
47 #pragma warning ( disable : 4100 )
50 // Disable slightly different base types warning as CHAR8 * can not be set
51 // to a constant string.
53 #pragma warning ( disable : 4057 )
56 // ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
58 #pragma warning ( disable : 4127 )
61 // This warning is caused by functions defined but not used. For precompiled header only.
63 #pragma warning ( disable : 4505 )
66 // This warning is caused by empty (after preprocessing) source file. For precompiled header only.
68 #pragma warning ( disable : 4206 )
71 // Disable 'potentially uninitialized local variable X used' warnings
73 #pragma warning ( disable : 4701 )
76 // Disable 'potentially uninitialized local pointer variable X used' warnings
78 #pragma warning ( disable : 4703 )
81 // use Microsoft* C compiler dependent integer width types
83 typedef unsigned __int64 UINT64
;
84 typedef __int64 INT64
;
85 typedef unsigned __int32 UINT32
;
86 typedef __int32 INT32
;
87 typedef unsigned short UINT16
;
88 typedef unsigned short CHAR16
;
90 typedef unsigned char BOOLEAN
;
91 typedef unsigned char UINT8
;
93 typedef signed char INT8
;
98 // Assume standard AARCH64 alignment.
100 typedef unsigned long long UINT64
;
101 typedef long long INT64
;
102 typedef unsigned int UINT32
;
104 typedef unsigned short UINT16
;
105 typedef unsigned short CHAR16
;
107 typedef unsigned char BOOLEAN
;
108 typedef unsigned char UINT8
;
110 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 UINT64 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 0x8000000000000000ULL
136 /// A value of native width with the two highest bits set.
138 #define MAX_2_BITS 0xC000000000000000ULL
141 /// Maximum legal AARCH64 address
143 #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL
146 /// Maximum legal AArch64 INTN and UINTN values.
148 #define MAX_INTN ((INTN)0x7FFFFFFFFFFFFFFFULL)
149 #define MAX_UINTN ((UINTN)0xFFFFFFFFFFFFFFFFULL)
152 /// Minimum legal AArch64 INTN value.
154 #define MIN_INTN (((INTN)-9223372036854775807LL) - 1)
157 /// The stack alignment required for AARCH64
159 #define CPU_STACK_ALIGNMENT 16
162 /// Page allocation granularity for AARCH64
164 #define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)
165 #define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x10000)
168 // Modifier to ensure that all protocol member functions and EFI intrinsics
169 // use the correct C calling convention. All protocol member functions and
170 // EFI intrinsics are required to modify their member functions with EFIAPI.
174 // When compiling with Clang, we still use GNU as for the assembler, so we still
175 // need to define the GCC_ASM* macros.
176 #if defined(__GNUC__) || defined(__clang__)
178 /// For GNU assembly code, .global or .globl can declare global symbols.
179 /// Define this macro to unify the usage.
181 #define ASM_GLOBAL .globl
183 #define GCC_ASM_EXPORT(func__) \
184 .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\
185 .type ASM_PFX(func__), %function
187 #define GCC_ASM_IMPORT(func__) \
188 .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)
193 Return the pointer to the first instruction of a function given a function pointer.
194 On ARM CPU architectures, these two pointer values are the same,
195 so the implementation of this macro is very simple.
197 @param FunctionPointer A pointer to a function.
199 @return The pointer to the first instruction of a function given a function pointer.
202 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
204 #ifndef __USER_LABEL_PREFIX__
205 #define __USER_LABEL_PREFIX__