]>
Commit | Line | Data |
---|---|---|
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 | |
2a79158c | 35 | // use Microsoft* C complier 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 | |
69 | typedef 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 | |
75 | typedef 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 | |
107 | //\r | |
108 | // Modifier to ensure that all protocol member functions and EFI intrinsics\r | |
109 | // use the correct C calling convention. All protocol member functions and\r | |
110 | // EFI intrinsics are required to modify their member functions with EFIAPI.\r | |
111 | //\r | |
112 | #define EFIAPI\r | |
113 | \r | |
114 | #if defined(__GNUC__)\r | |
115 | ///\r | |
116 | /// For GNU assembly code, .global or .globl can declare global symbols.\r | |
117 | /// Define this macro to unify the usage.\r | |
118 | ///\r | |
119 | #define ASM_GLOBAL .globl\r | |
120 | \r | |
121 | #define GCC_ASM_EXPORT(func__) \\r | |
122 | .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\\r | |
123 | .type ASM_PFX(func__), %function\r | |
124 | \r | |
125 | #define GCC_ASM_IMPORT(func__) \\r | |
126 | .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)\r | |
127 | \r | |
128 | #endif\r | |
129 | \r | |
130 | /**\r | |
131 | Return the pointer to the first instruction of a function given a function pointer.\r | |
132 | On ARM CPU architectures, these two pointer values are the same,\r | |
133 | so the implementation of this macro is very simple.\r | |
134 | \r | |
135 | @param FunctionPointer A pointer to a function.\r | |
136 | \r | |
137 | @return The pointer to the first instruction of a function given a function pointer.\r | |
138 | \r | |
139 | **/\r | |
140 | #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r | |
141 | \r | |
02eef553 JJ |
142 | #ifndef __USER_LABEL_PREFIX__\r |
143 | #define __USER_LABEL_PREFIX__\r | |
144 | #endif\r | |
145 | \r | |
b4319afb | 146 | #endif\r |