]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/AArch64/ProcessorBind.h
Revert "MdePkg/ProcessorBind.h AARCH64: limit MAX_ADDRESS to 48 bits"
[mirror_edk2.git] / MdePkg / Include / AArch64 / ProcessorBind.h
CommitLineData
b4319afb
HL
1/** @file\r
2 Processor or Compiler specific defines and types for AArch64.\r
3\r
90336529 4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
b4319afb
HL
5 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
6 Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>\r
7\r
8 This program and the accompanying materials\r
9 are licensed and made available under the terms and conditions of the BSD License\r
10 which accompanies this distribution. The full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16**/\r
17\r
18#ifndef __PROCESSOR_BIND_H__\r
19#define __PROCESSOR_BIND_H__\r
20\r
21///\r
22/// Define the processor type so other code can make processor based choices\r
23///\r
24#define MDE_CPU_AARCH64\r
25\r
26//\r
27// Make sure we are using the correct packing rules per EFI specification\r
28//\r
5b8766bb 29#if !defined(__GNUC__) && !defined(__ASSEMBLER__)\r
b4319afb
HL
30#pragma pack()\r
31#endif\r
32\r
90336529
PB
33#if defined(_MSC_EXTENSIONS)\r
34\r
35//\r
36// Disable some level 4 compilation warnings (same as IA32 and X64)\r
37//\r
38\r
39//\r
40// Disabling bitfield type checking warnings.\r
41//\r
42#pragma warning ( disable : 4214 )\r
43\r
44//\r
45// Disabling the unreferenced formal parameter warnings.\r
46//\r
47#pragma warning ( disable : 4100 )\r
48\r
49//\r
50// Disable slightly different base types warning as CHAR8 * can not be set\r
51// to a constant string.\r
52//\r
53#pragma warning ( disable : 4057 )\r
54\r
55//\r
56// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning\r
57//\r
58#pragma warning ( disable : 4127 )\r
59\r
60//\r
61// This warning is caused by functions defined but not used. For precompiled header only.\r
62//\r
63#pragma warning ( disable : 4505 )\r
64\r
65//\r
66// This warning is caused by empty (after preprocessing) source file. For precompiled header only.\r
67//\r
68#pragma warning ( disable : 4206 )\r
69\r
70//\r
71// Disable 'potentially uninitialized local variable X used' warnings\r
72//\r
73#pragma warning ( disable : 4701 )\r
74\r
75//\r
76// Disable 'potentially uninitialized local pointer variable X used' warnings\r
77//\r
78#pragma warning ( disable : 4703 )\r
79\r
b4319afb 80 //\r
00b7cc0f 81 // use Microsoft* C compiler dependent integer width types\r
b4319afb
HL
82 //\r
83 typedef unsigned __int64 UINT64;\r
84 typedef __int64 INT64;\r
85 typedef unsigned __int32 UINT32;\r
86 typedef __int32 INT32;\r
87 typedef unsigned short UINT16;\r
88 typedef unsigned short CHAR16;\r
89 typedef short INT16;\r
90 typedef unsigned char BOOLEAN;\r
91 typedef unsigned char UINT8;\r
92 typedef char CHAR8;\r
2a79158c 93 typedef signed char INT8;\r
90336529 94\r
b4319afb 95#else\r
90336529 96\r
b4319afb
HL
97 //\r
98 // Assume standard AARCH64 alignment.\r
2a79158c 99 //\r
b4319afb
HL
100 typedef unsigned long long UINT64;\r
101 typedef long long INT64;\r
102 typedef unsigned int UINT32;\r
103 typedef int INT32;\r
104 typedef unsigned short UINT16;\r
105 typedef unsigned short CHAR16;\r
106 typedef short INT16;\r
107 typedef unsigned char BOOLEAN;\r
108 typedef unsigned char UINT8;\r
109 typedef char CHAR8;\r
2a79158c 110 typedef signed char INT8;\r
90336529 111\r
b4319afb
HL
112#endif\r
113\r
114///\r
115/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,\r
116/// 8 bytes on supported 64-bit processor instructions)\r
117///\r
118typedef UINT64 UINTN;\r
119\r
120///\r
121/// Signed value of native width. (4 bytes on supported 32-bit processor instructions,\r
122/// 8 bytes on supported 64-bit processor instructions)\r
123///\r
124typedef INT64 INTN;\r
125\r
126//\r
127// Processor specific defines\r
128//\r
129\r
130///\r
131/// A value of native width with the highest bit set.\r
132///\r
2a79158c 133#define MAX_BIT 0x8000000000000000ULL\r
b4319afb
HL
134\r
135///\r
136/// A value of native width with the two highest bits set.\r
137///\r
2a79158c 138#define MAX_2_BITS 0xC000000000000000ULL\r
b4319afb
HL
139\r
140///\r
a5274cdc 141/// Maximum legal AARCH64 address\r
b4319afb 142///\r
a5274cdc 143#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL\r
2a79158c
OM
144\r
145///\r
146/// Maximum legal AArch64 INTN and UINTN values.\r
147///\r
148#define MAX_INTN ((INTN)0x7FFFFFFFFFFFFFFFULL)\r
149#define MAX_UINTN ((UINTN)0xFFFFFFFFFFFFFFFFULL)\r
b4319afb 150\r
d7a09cb8
SB
151///\r
152/// Minimum legal AArch64 INTN value.\r
153///\r
154#define MIN_INTN (((INTN)-9223372036854775807LL) - 1)\r
155\r
b4319afb
HL
156///\r
157/// The stack alignment required for AARCH64\r
158///\r
159#define CPU_STACK_ALIGNMENT 16\r
160\r
08855193
AB
161///\r
162/// Page allocation granularity for AARCH64\r
163///\r
164#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)\r
165#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x10000)\r
166\r
b4319afb
HL
167//\r
168// Modifier to ensure that all protocol member functions and EFI intrinsics\r
169// use the correct C calling convention. All protocol member functions and\r
170// EFI intrinsics are required to modify their member functions with EFIAPI.\r
171//\r
172#define EFIAPI\r
173\r
ba0a34f1
OM
174// When compiling with Clang, we still use GNU as for the assembler, so we still\r
175// need to define the GCC_ASM* macros.\r
176#if defined(__GNUC__) || defined(__clang__)\r
b4319afb
HL
177 ///\r
178 /// For GNU assembly code, .global or .globl can declare global symbols.\r
179 /// Define this macro to unify the usage.\r
180 ///\r
181 #define ASM_GLOBAL .globl\r
182\r
183 #define GCC_ASM_EXPORT(func__) \\r
184 .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\\r
185 .type ASM_PFX(func__), %function\r
186\r
187 #define GCC_ASM_IMPORT(func__) \\r
188 .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)\r
189\r
190#endif\r
191\r
192/**\r
193 Return the pointer to the first instruction of a function given a function pointer.\r
194 On ARM CPU architectures, these two pointer values are the same,\r
195 so the implementation of this macro is very simple.\r
196\r
197 @param FunctionPointer A pointer to a function.\r
198\r
199 @return The pointer to the first instruction of a function given a function pointer.\r
200\r
201**/\r
202#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r
203\r
02eef553
JJ
204#ifndef __USER_LABEL_PREFIX__\r
205#define __USER_LABEL_PREFIX__\r
206#endif\r
207\r
b4319afb 208#endif\r