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