]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Ipf/ProcessorBind.h
MdePkg Base.h: Always define ASM_PFX
[mirror_edk2.git] / MdePkg / Include / Ipf / ProcessorBind.h
1 /** @file
2 Processor or Compiler specific defines and types for Intel Itanium(TM) processors.
3
4 Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available
6 under the terms and conditions of the BSD License which accompanies this
7 distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef __PROCESSOR_BIND_H__
16 #define __PROCESSOR_BIND_H__
17
18
19 ///
20 /// Define the processor type so other code can make processor-based choices.
21 ///
22 #define MDE_CPU_IPF
23
24
25 //
26 // Make sure we are using the correct packing rules per EFI specification
27 //
28 #pragma pack()
29
30
31 #if defined(__INTEL_COMPILER)
32 //
33 // Disable ICC's remark #869: "Parameter" was never referenced warning.
34 // This is legal ANSI C code so we disable the remark that is turned on with -Wall
35 //
36 #pragma warning ( disable : 869 )
37
38 //
39 // Disable ICC's remark #1418: external function definition with no prior declaration.
40 // This is legal ANSI C code so we disable the remark that is turned on with /W4
41 //
42 #pragma warning ( disable : 1418 )
43
44 //
45 // Disable ICC's remark #1419: external declaration in primary source file
46 // This is legal ANSI C code so we disable the remark that is turned on with /W4
47 //
48 #pragma warning ( disable : 1419 )
49
50 //
51 // Disable ICC's remark #593: "Variable" was set but never used.
52 // This is legal ANSI C code so we disable the remark that is turned on with /W4
53 //
54 #pragma warning ( disable : 593 )
55
56 #endif
57
58
59 #if defined(_MSC_EXTENSIONS)
60 //
61 // Disable warning that make it impossible to compile at /W4
62 // This only works for Microsoft* tools
63 //
64
65 //
66 // Disabling bitfield type checking warnings.
67 //
68 #pragma warning ( disable : 4214 )
69
70 //
71 // Disabling the unreferenced formal parameter warnings.
72 //
73 #pragma warning ( disable : 4100 )
74
75 //
76 // Disable slightly different base types warning as CHAR8 * can not be set
77 // to a constant string.
78 //
79 #pragma warning ( disable : 4057 )
80
81 //
82 // Disable warning on conversion from function pointer to a data pointer
83 //
84 #pragma warning ( disable : 4054 )
85
86 //
87 // ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
88 //
89 #pragma warning ( disable : 4127 )
90
91 //
92 // Can not cast a function pointer to a data pointer. We need to do this on
93 // Itanium processors to get access to the PLABEL.
94 //
95 #pragma warning ( disable : 4514 )
96
97 //
98 // This warning is caused by functions defined but not used. For precompiled header only.
99 //
100 #pragma warning ( disable : 4505 )
101
102 //
103 // This warning is caused by empty (after preprocessing) source file. For precompiled header only.
104 //
105 #pragma warning ( disable : 4206 )
106
107 #endif
108
109 #if defined(_MSC_EXTENSIONS)
110 //
111 // use Microsoft C compiler dependent integer width types
112 //
113
114 ///
115 /// 8-byte unsigned value.
116 ///
117 typedef unsigned __int64 UINT64;
118 ///
119 /// 8-byte signed value.
120 ///
121 typedef __int64 INT64;
122 ///
123 /// 4-byte unsigned value.
124 ///
125 typedef unsigned __int32 UINT32;
126 ///
127 /// 4-byte signed value.
128 ///
129 typedef __int32 INT32;
130 ///
131 /// 2-byte unsigned value.
132 ///
133 typedef unsigned short UINT16;
134 ///
135 /// 2-byte Character. Unless otherwise specified all strings are stored in the
136 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
137 ///
138 typedef unsigned short CHAR16;
139 ///
140 /// 2-byte signed value.
141 ///
142 typedef short INT16;
143 ///
144 /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
145 /// values are undefined.
146 ///
147 typedef unsigned char BOOLEAN;
148 ///
149 /// 1-byte unsigned value.
150 ///
151 typedef unsigned char UINT8;
152 ///
153 /// 1-byte Character.
154 ///
155 typedef char CHAR8;
156 ///
157 /// 1-byte signed value.
158 ///
159 typedef signed char INT8;
160 #else
161 ///
162 /// 8-byte unsigned value.
163 ///
164 typedef unsigned long long UINT64;
165 ///
166 /// 8-byte signed value.
167 ///
168 typedef long long INT64;
169 ///
170 /// 4-byte unsigned value.
171 ///
172 typedef unsigned int UINT32;
173 ///
174 /// 4-byte signed value.
175 ///
176 typedef int INT32;
177 ///
178 /// 2-byte unsigned value.
179 ///
180 typedef unsigned short UINT16;
181 ///
182 /// 2-byte Character. Unless otherwise specified all strings are stored in the
183 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
184 ///
185 typedef unsigned short CHAR16;
186 ///
187 /// 2-byte signed value.
188 ///
189 typedef short INT16;
190 ///
191 /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other
192 /// values are undefined.
193 ///
194 typedef unsigned char BOOLEAN;
195 ///
196 /// 1-byte unsigned value.
197 ///
198 typedef unsigned char UINT8;
199 ///
200 /// 1-byte Character.
201 ///
202 typedef char CHAR8;
203 ///
204 /// 1-byte signed value.
205 ///
206 typedef signed char INT8;
207 #endif
208
209 ///
210 /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions;
211 /// 8 bytes on supported 64-bit processor instructions.)
212 ///
213 typedef UINT64 UINTN;
214 ///
215 /// Signed value of native width. (4 bytes on supported 32-bit processor instructions;
216 /// 8 bytes on supported 64-bit processor instructions.)
217 ///
218 typedef INT64 INTN;
219
220
221 //
222 // Processor specific defines
223 //
224
225 ///
226 /// A value of native width with the highest bit set.
227 ///
228 #define MAX_BIT 0x8000000000000000ULL
229 ///
230 /// A value of native width with the two highest bits set.
231 ///
232 #define MAX_2_BITS 0xC000000000000000ULL
233
234 ///
235 /// The maximum legal Itanium-based address
236 ///
237 #define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL
238
239 ///
240 /// Maximum legal Itanium-based INTN and UINTN values.
241 ///
242 #define MAX_INTN ((INTN)0x7FFFFFFFFFFFFFFFULL)
243 #define MAX_UINTN ((UINTN)0xFFFFFFFFFFFFFFFFULL)
244
245 ///
246 /// Per the Itanium Software Conventions and Runtime Architecture Guide,
247 /// section 3.3.4, IPF stack must always be 16-byte aligned.
248 ///
249 #define CPU_STACK_ALIGNMENT 16
250
251 //
252 // Modifier to ensure that all protocol member functions and EFI intrinsics
253 // use the correct C calling convention. All protocol member functions and
254 // EFI intrinsics are required to modify their member functions with EFIAPI.
255 //
256 #ifdef EFIAPI
257 ///
258 /// If EFIAPI is already defined, then we use that definition.
259 ///
260 #elif defined(_MSC_EXTENSIONS)
261 ///
262 /// Microsoft* compiler-specific method for EFIAPI calling convention.
263 ///
264 #define EFIAPI __cdecl
265 #else
266 #define EFIAPI
267 #endif
268
269 ///
270 /// For GNU assembly code, .global or .globl can declare global symbols.
271 /// Define this macro to unify the usage.
272 ///
273 #define ASM_GLOBAL .globl
274
275 ///
276 /// A pointer to a function in IPF points to a plabel.
277 ///
278 typedef struct {
279 UINT64 EntryPoint;
280 UINT64 GP;
281 } EFI_PLABEL;
282
283 ///
284 /// PAL Call return structure.
285 ///
286 typedef struct {
287 UINT64 Status;
288 UINT64 r9;
289 UINT64 r10;
290 UINT64 r11;
291 } PAL_CALL_RETURN;
292
293 /**
294 Return the pointer to the first instruction of a function given a function pointer.
295 For Itanium processors, all function calls are made through a PLABEL, so a pointer to a function
296 is actually a pointer to a PLABEL. The pointer to the first instruction of the function
297 is contained within the PLABEL. This macro may be used to retrieve a pointer to the first
298 instruction of a function independent of the CPU architecture being used. This is very
299 useful when printing function addresses through DEBUG() macros.
300
301 @param FunctionPointer A pointer to a function.
302
303 @return The pointer to the first instruction of a function given a function pointer.
304
305 **/
306 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(((EFI_PLABEL *)(FunctionPointer))->EntryPoint)
307
308 #ifndef __USER_LABEL_PREFIX__
309 #define __USER_LABEL_PREFIX__
310 #endif
311
312 #endif
313