MdePkg/ProcessorBind: add defines for page allocation granularity
[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
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
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
29#ifndef __GNUC__\r
30#pragma pack()\r
31#endif\r
32\r
33#if _MSC_EXTENSIONS\r
34 //\r
00b7cc0f 35 // use Microsoft* C compiler dependent integer width types\r
b4319afb
HL
36 //\r
37 typedef unsigned __int64 UINT64;\r
38 typedef __int64 INT64;\r
39 typedef unsigned __int32 UINT32;\r
40 typedef __int32 INT32;\r
41 typedef unsigned short UINT16;\r
42 typedef unsigned short CHAR16;\r
43 typedef short INT16;\r
44 typedef unsigned char BOOLEAN;\r
45 typedef unsigned char UINT8;\r
46 typedef char CHAR8;\r
2a79158c 47 typedef signed char INT8;\r
b4319afb
HL
48#else\r
49 //\r
50 // Assume standard AARCH64 alignment.\r
2a79158c 51 //\r
b4319afb
HL
52 typedef unsigned long long UINT64;\r
53 typedef long long INT64;\r
54 typedef unsigned int UINT32;\r
55 typedef int INT32;\r
56 typedef unsigned short UINT16;\r
57 typedef unsigned short CHAR16;\r
58 typedef short INT16;\r
59 typedef unsigned char BOOLEAN;\r
60 typedef unsigned char UINT8;\r
61 typedef char CHAR8;\r
2a79158c 62 typedef signed char INT8;\r
b4319afb
HL
63#endif\r
64\r
65///\r
66/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,\r
67/// 8 bytes on supported 64-bit processor instructions)\r
68///\r
69typedef UINT64 UINTN;\r
70\r
71///\r
72/// Signed value of native width. (4 bytes on supported 32-bit processor instructions,\r
73/// 8 bytes on supported 64-bit processor instructions)\r
74///\r
75typedef INT64 INTN;\r
76\r
77//\r
78// Processor specific defines\r
79//\r
80\r
81///\r
82/// A value of native width with the highest bit set.\r
83///\r
2a79158c 84#define MAX_BIT 0x8000000000000000ULL\r
b4319afb
HL
85\r
86///\r
87/// A value of native width with the two highest bits set.\r
88///\r
2a79158c 89#define MAX_2_BITS 0xC000000000000000ULL\r
b4319afb
HL
90\r
91///\r
92/// Maximum legal AARCH64 address\r
93///\r
2a79158c
OM
94#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL\r
95\r
96///\r
97/// Maximum legal AArch64 INTN and UINTN values.\r
98///\r
99#define MAX_INTN ((INTN)0x7FFFFFFFFFFFFFFFULL)\r
100#define MAX_UINTN ((UINTN)0xFFFFFFFFFFFFFFFFULL)\r
b4319afb
HL
101\r
102///\r
103/// The stack alignment required for AARCH64\r
104///\r
105#define CPU_STACK_ALIGNMENT 16\r
106\r
08855193
AB
107///\r
108/// Page allocation granularity for AARCH64\r
109///\r
110#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)\r
111#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x10000)\r
112\r
b4319afb
HL
113//\r
114// Modifier to ensure that all protocol member functions and EFI intrinsics\r
115// use the correct C calling convention. All protocol member functions and\r
116// EFI intrinsics are required to modify their member functions with EFIAPI.\r
117//\r
118#define EFIAPI\r
119\r
ba0a34f1
OM
120// When compiling with Clang, we still use GNU as for the assembler, so we still\r
121// need to define the GCC_ASM* macros.\r
122#if defined(__GNUC__) || defined(__clang__)\r
b4319afb
HL
123 ///\r
124 /// For GNU assembly code, .global or .globl can declare global symbols.\r
125 /// Define this macro to unify the usage.\r
126 ///\r
127 #define ASM_GLOBAL .globl\r
128\r
129 #define GCC_ASM_EXPORT(func__) \\r
130 .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\\r
131 .type ASM_PFX(func__), %function\r
132\r
133 #define GCC_ASM_IMPORT(func__) \\r
134 .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)\r
135\r
136#endif\r
137\r
138/**\r
139 Return the pointer to the first instruction of a function given a function pointer.\r
140 On ARM CPU architectures, these two pointer values are the same,\r
141 so the implementation of this macro is very simple.\r
142\r
143 @param FunctionPointer A pointer to a function.\r
144\r
145 @return The pointer to the first instruction of a function given a function pointer.\r
146\r
147**/\r
148#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r
149\r
02eef553
JJ
150#ifndef __USER_LABEL_PREFIX__\r
151#define __USER_LABEL_PREFIX__\r
152#endif\r
153\r
b4319afb 154#endif\r