]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/C/Include/AArch64/ProcessorBind.h
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / C / Include / AArch64 / ProcessorBind.h
CommitLineData
4afd3d04
LG
1/** @file\r
2 Processor or Compiler specific defines and types for AArch64.\r
3\r
f7496d71 4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
4afd3d04
LG
5 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
6 Portions copyright (c) 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
f7496d71 35 // use Microsoft* C complier dependent integer width types\r
4afd3d04
LG
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
47 typedef signed char INT8;\r
48#else\r
49 //\r
50 // Assume standard AARCH64 alignment.\r
51 //\r
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
62 typedef signed char INT8;\r
63\r
64 #define UINT8_MAX 0xff\r
65#endif\r
66\r
67///\r
68/// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,\r
69/// 8 bytes on supported 64-bit processor instructions)\r
70///\r
71typedef UINT64 UINTN;\r
72\r
73///\r
74/// Signed value of native width. (4 bytes on supported 32-bit processor instructions,\r
75/// 8 bytes on supported 64-bit processor instructions)\r
76///\r
77typedef INT64 INTN;\r
78\r
79//\r
80// Processor specific defines\r
81//\r
82\r
83///\r
84/// A value of native width with the highest bit set.\r
85///\r
86#define MAX_BIT 0x8000000000000000\r
87\r
88///\r
89/// A value of native width with the two highest bits set.\r
90///\r
91#define MAX_2_BITS 0xC000000000000000\r
92\r
93///\r
94/// Maximum legal AARCH64 address\r
95///\r
96#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF\r
97\r
98///\r
99/// The stack alignment required for AARCH64\r
100///\r
101#define CPU_STACK_ALIGNMENT 16\r
102\r
103//\r
104// Modifier to ensure that all protocol member functions and EFI intrinsics\r
105// use the correct C calling convention. All protocol member functions and\r
106// EFI intrinsics are required to modify their member functions with EFIAPI.\r
107//\r
108#define EFIAPI\r
109\r
110#if defined(__GNUC__)\r
111 ///\r
112 /// For GNU assembly code, .global or .globl can declare global symbols.\r
113 /// Define this macro to unify the usage.\r
114 ///\r
115 #define ASM_GLOBAL .globl\r
116\r
117 #if !defined(__APPLE__)\r
118 ///\r
119 /// ARM EABI defines that the linker should not manipulate call relocations\r
120 /// (do bl/blx conversion) unless the target symbol has function type.\r
121 /// CodeSourcery 2010.09 started requiring the .type to function properly\r
122 ///\r
123 #define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function\r
124\r
125 #define GCC_ASM_EXPORT(func__) \\r
126 .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\\r
f7496d71 127 .type ASM_PFX(func__), %function\r
4afd3d04
LG
128\r
129 #define GCC_ASM_IMPORT(func__) \\r
130 .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)\r
f7496d71 131\r
4afd3d04
LG
132 #else\r
133 //\r
f7496d71 134 // .type not supported by Apple Xcode tools\r
4afd3d04 135 //\r
f7496d71 136 #define INTERWORK_FUNC(func__)\r
4afd3d04
LG
137\r
138 #define GCC_ASM_EXPORT(func__) \\r
139 .globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \\r
f7496d71
LG
140\r
141 #define GCC_ASM_IMPORT(name)\r
4afd3d04
LG
142\r
143 #endif\r
144#endif\r
145\r
146/**\r
147 Return the pointer to the first instruction of a function given a function pointer.\r
148 On ARM CPU architectures, these two pointer values are the same,\r
149 so the implementation of this macro is very simple.\r
150\r
151 @param FunctionPointer A pointer to a function.\r
152\r
153 @return The pointer to the first instruction of a function given a function pointer.\r
154\r
155**/\r
156#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r
157\r
158#endif\r
159\r