TianoCore EDK2 master
ProcessorBind.h
Go to the documentation of this file.
1
9#ifndef __PROCESSOR_BIND_H__
10#define __PROCESSOR_BIND_H__
11
15#define MDE_CPU_X64
16
17//
18// Make sure we are using the correct packing rules per EFI specification
19//
20#if !defined (__GNUC__)
21 #pragma pack()
22#endif
23
24#if defined (__GNUC__) && defined (__pic__) && !defined (USING_LTO) && !defined (__APPLE__)
25//
26// Mark all symbol declarations and references as hidden, meaning they will
27// not be subject to symbol preemption. This allows the compiler to refer to
28// symbols directly using relative references rather than via the GOT, which
29// contains absolute symbol addresses that are subject to runtime relocation.
30//
31// The LTO linker will not emit GOT based relocations when all symbol
32// references can be resolved locally, and so there is no need to set the
33// pragma in that case (and doing so will cause other issues).
34//
35 #pragma GCC visibility push (hidden)
36#endif
37
38#if defined (__INTEL_COMPILER)
39//
40// Disable ICC's remark #869: "Parameter" was never referenced warning.
41// This is legal ANSI C code so we disable the remark that is turned on with -Wall
42//
43 #pragma warning ( disable : 869 )
44
45//
46// Disable ICC's remark #1418: external function definition with no prior declaration.
47// This is legal ANSI C code so we disable the remark that is turned on with /W4
48//
49 #pragma warning ( disable : 1418 )
50
51//
52// Disable ICC's remark #1419: external declaration in primary source file
53// This is legal ANSI C code so we disable the remark that is turned on with /W4
54//
55 #pragma warning ( disable : 1419 )
56
57//
58// Disable ICC's remark #593: "Variable" was set but never used.
59// This is legal ANSI C code so we disable the remark that is turned on with /W4
60//
61 #pragma warning ( disable : 593 )
62
63#endif
64
65#if defined (_MSC_EXTENSIONS)
66
67//
68// Disable warning that make it impossible to compile at /W4
69// This only works for Microsoft* tools
70//
71
72//
73// Disabling bitfield type checking warnings.
74//
75 #pragma warning ( disable : 4214 )
76
77//
78// Disabling the unreferenced formal parameter warnings.
79//
80 #pragma warning ( disable : 4100 )
81
82//
83// Disable slightly different base types warning as CHAR8 * can not be set
84// to a constant string.
85//
86 #pragma warning ( disable : 4057 )
87
88//
89// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
90//
91 #pragma warning ( disable : 4127 )
92
93//
94// This warning is caused by functions defined but not used. For precompiled header only.
95//
96 #pragma warning ( disable : 4505 )
97
98//
99// This warning is caused by empty (after preprocessing) source file. For precompiled header only.
100//
101 #pragma warning ( disable : 4206 )
102
103 #if defined (_MSC_VER) && _MSC_VER >= 1800
104
105//
106// Disable these warnings for VS2013.
107//
108
109//
110// This warning is for potentially uninitialized local variable, and it may cause false
111// positive issues in VS2013 and VS2015 build
112//
113 #pragma warning ( disable : 4701 )
114
115//
116// This warning is for potentially uninitialized local pointer variable, and it may cause
117// false positive issues in VS2013 and VS2015 build
118//
119 #pragma warning ( disable : 4703 )
120
121 #endif
122
123#endif
124
125#if defined (_MSC_EXTENSIONS)
126//
127// use Microsoft C compiler dependent integer width types
128//
129
133typedef unsigned __int64 UINT64;
137typedef __int64 INT64;
141typedef unsigned __int32 UINT32;
145typedef __int32 INT32;
149typedef unsigned short UINT16;
154typedef unsigned short CHAR16;
158typedef short INT16;
163typedef unsigned char BOOLEAN;
167typedef unsigned char UINT8;
171typedef char CHAR8;
175typedef signed char INT8;
176#else
180typedef unsigned long long UINT64;
184typedef long long INT64;
188typedef unsigned int UINT32;
192typedef int INT32;
196typedef unsigned short UINT16;
201typedef unsigned short CHAR16;
205typedef short INT16;
210typedef unsigned char BOOLEAN;
214typedef unsigned char UINT8;
218typedef char CHAR8;
222typedef signed char INT8;
223#endif
224
229typedef UINT64 UINTN;
234typedef INT64 INTN;
235
236//
237// Processor specific defines
238//
239
243#define MAX_BIT 0x8000000000000000ULL
247#define MAX_2_BITS 0xC000000000000000ULL
248
252#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL
253
257#define MAX_ALLOC_ADDRESS MAX_ADDRESS
258
262#define MAX_INTN ((INTN)0x7FFFFFFFFFFFFFFFULL)
263#define MAX_UINTN ((UINTN)0xFFFFFFFFFFFFFFFFULL)
264
268#define MIN_INTN (((INTN)-9223372036854775807LL) - 1)
269
273#define CPU_STACK_ALIGNMENT 16
274
278#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)
279#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x1000)
280
281//
282// Modifier to ensure that all protocol member functions and EFI intrinsics
283// use the correct C calling convention. All protocol member functions and
284// EFI intrinsics are required to modify their member functions with EFIAPI.
285//
286#ifdef EFIAPI
290#elif defined (_MSC_EXTENSIONS)
294#define EFIAPI __cdecl
295#elif defined (__GNUC__)
304#define EFIAPI
305#else
310#define EFIAPI
311#endif
312
313#if defined (__GNUC__) || defined (__clang__)
318#define ASM_GLOBAL .globl
319#endif
320
331#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
332
333#ifndef __USER_LABEL_PREFIX__
334#define __USER_LABEL_PREFIX__
335#endif
336
337#endif
UINT64 UINTN
INT64 INTN
unsigned short UINT16
Definition: ProcessorBind.h:48
unsigned char BOOLEAN
Definition: ProcessorBind.h:32
__int64 INT64
Definition: ProcessorBind.h:65
char CHAR8
Definition: ProcessorBind.h:40
short INT16
Definition: ProcessorBind.h:44
int INT32
Definition: ProcessorBind.h:57
unsigned short CHAR16
Definition: ProcessorBind.h:53
signed char INT8
Definition: ProcessorBind.h:27
unsigned __int64 UINT64
Definition: ProcessorBind.h:69
unsigned char UINT8
Definition: ProcessorBind.h:36
unsigned int UINT32
Definition: ProcessorBind.h:61