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