]>
Commit | Line | Data |
---|---|---|
30fdf114 LG |
1 | /** @file\r |
2 | Processor or Compiler specific defines and types x64 (Intel(r) EM64T, AMD64).\r | |
3 | \r | |
f7496d71 | 4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
30fdf114 | 5 | \r |
2e351cbe | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
30fdf114 | 7 | \r |
30fdf114 LG |
8 | **/\r |
9 | \r | |
10 | #ifndef __PROCESSOR_BIND_H__\r | |
11 | #define __PROCESSOR_BIND_H__\r | |
12 | \r | |
13 | //\r | |
14 | // Define the processor type so other code can make processor based choices\r | |
15 | //\r | |
16 | #define MDE_CPU_X64\r | |
17 | \r | |
18 | \r | |
19 | //\r | |
20 | // Make sure we are useing the correct packing rules per EFI specification\r | |
21 | //\r | |
a709adfa | 22 | #ifndef __GNUC__\r |
30fdf114 | 23 | #pragma pack()\r |
a709adfa | 24 | #endif\r |
30fdf114 LG |
25 | \r |
26 | \r | |
f7496d71 LG |
27 | #if _MSC_EXTENSIONS\r |
28 | \r | |
30fdf114 LG |
29 | //\r |
30 | // Disable warning that make it impossible to compile at /W4\r | |
31 | // This only works for Microsoft* tools\r | |
32 | //\r | |
33 | \r | |
34 | //\r | |
35 | // Disabling bitfield type checking warnings.\r | |
36 | //\r | |
37 | #pragma warning ( disable : 4214 )\r | |
38 | \r | |
39 | //\r | |
40 | // Disabling the unreferenced formal parameter warnings.\r | |
41 | //\r | |
42 | #pragma warning ( disable : 4100 )\r | |
43 | \r | |
44 | //\r | |
45 | // Disable slightly different base types warning as CHAR8 * can not be set\r | |
46 | // to a constant string.\r | |
47 | //\r | |
48 | #pragma warning ( disable : 4057 )\r | |
49 | \r | |
50 | //\r | |
51 | // ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning\r | |
52 | //\r | |
53 | #pragma warning ( disable : 4127 )\r | |
54 | \r | |
55 | \r | |
56 | #endif\r | |
57 | \r | |
58 | \r | |
59 | #if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)\r | |
60 | //\r | |
61 | // No ANSI C 2000 stdint.h integer width declarations, so define equivalents\r | |
62 | //\r | |
f7496d71 LG |
63 | \r |
64 | #if _MSC_EXTENSIONS\r | |
65 | \r | |
30fdf114 LG |
66 | \r |
67 | //\r | |
fb0b35e0 | 68 | // use Microsoft C compiler dependent integer width types\r |
30fdf114 LG |
69 | //\r |
70 | typedef unsigned __int64 UINT64;\r | |
71 | typedef __int64 INT64;\r | |
72 | typedef unsigned __int32 UINT32;\r | |
73 | typedef __int32 INT32;\r | |
74 | typedef unsigned short UINT16;\r | |
75 | typedef unsigned short CHAR16;\r | |
76 | typedef short INT16;\r | |
77 | typedef unsigned char BOOLEAN;\r | |
78 | typedef unsigned char UINT8;\r | |
79 | typedef char CHAR8;\r | |
80 | typedef char INT8;\r | |
81 | #else\r | |
f7496d71 | 82 | #ifdef _EFI_P64\r |
30fdf114 | 83 | //\r |
f7496d71 | 84 | // P64 - is Intel Itanium(TM) speak for pointers being 64-bit and longs and ints\r |
30fdf114 LG |
85 | // are 32-bits\r |
86 | //\r | |
87 | typedef unsigned long long UINT64;\r | |
88 | typedef long long INT64;\r | |
89 | typedef unsigned int UINT32;\r | |
90 | typedef int INT32;\r | |
91 | typedef unsigned short CHAR16;\r | |
92 | typedef unsigned short UINT16;\r | |
93 | typedef short INT16;\r | |
94 | typedef unsigned char BOOLEAN;\r | |
95 | typedef unsigned char UINT8;\r | |
96 | typedef char CHAR8;\r | |
97 | typedef char INT8;\r | |
98 | #else\r | |
99 | //\r | |
100 | // Assume LP64 - longs and pointers are 64-bit. Ints are 32-bit.\r | |
101 | //\r | |
102 | typedef unsigned long UINT64;\r | |
103 | typedef long INT64;\r | |
104 | typedef unsigned int UINT32;\r | |
105 | typedef int INT32;\r | |
106 | typedef unsigned short UINT16;\r | |
107 | typedef unsigned short CHAR16;\r | |
108 | typedef short INT16;\r | |
109 | typedef unsigned char BOOLEAN;\r | |
110 | typedef unsigned char UINT8;\r | |
111 | typedef char CHAR8;\r | |
112 | typedef char INT8;\r | |
113 | #endif\r | |
114 | #endif\r | |
115 | \r | |
116 | #define UINT8_MAX 0xff\r | |
117 | \r | |
118 | #else\r | |
119 | //\r | |
120 | // Use ANSI C 2000 stdint.h integer width declarations\r | |
121 | //\r | |
122 | #include <stdint.h>\r | |
123 | typedef uint8_t BOOLEAN;\r | |
124 | typedef int8_t INT8;\r | |
125 | typedef uint8_t UINT8;\r | |
126 | typedef int16_t INT16;\r | |
127 | typedef uint16_t UINT16;\r | |
128 | typedef int32_t INT32;\r | |
129 | typedef uint32_t UINT32;\r | |
130 | typedef int64_t INT64;\r | |
131 | typedef uint64_t UINT64;\r | |
132 | typedef char CHAR8;\r | |
133 | typedef uint16_t CHAR16;\r | |
134 | \r | |
135 | #endif\r | |
136 | \r | |
137 | typedef UINT64 UINTN;\r | |
138 | typedef INT64 INTN;\r | |
139 | \r | |
140 | \r | |
141 | //\r | |
142 | // Processor specific defines\r | |
143 | //\r | |
6780eef1 LG |
144 | #define MAX_BIT 0x8000000000000000ULL\r |
145 | #define MAX_2_BITS 0xC000000000000000ULL\r | |
30fdf114 | 146 | \r |
30fdf114 LG |
147 | //\r |
148 | // Modifier to ensure that all protocol member functions and EFI intrinsics\r | |
149 | // use the correct C calling convention. All protocol member functions and\r | |
fb0b35e0 | 150 | // EFI intrinsics are required to modify their member functions with EFIAPI.\r |
30fdf114 | 151 | //\r |
f7496d71 | 152 | #if _MSC_EXTENSIONS\r |
30fdf114 | 153 | ///\r |
fb0b35e0 | 154 | /// Define the standard calling convention regardless of optimization level.\r |
30fdf114 | 155 | /// __cdecl is Microsoft* specific C extension.\r |
f7496d71 LG |
156 | ///\r |
157 | #define EFIAPI __cdecl\r | |
30fdf114 LG |
158 | #elif __GNUC__\r |
159 | ///\r | |
fb0b35e0 | 160 | /// Define the standard calling convention regardless of optimization level.\r |
30fdf114 LG |
161 | /// efidecl is an extension to GCC that supports the differnece between x64\r |
162 | /// GCC ABI and x64 Microsoft* ABI. EFI is closer to the Microsoft* ABI and\r | |
f7496d71 | 163 | /// EFIAPI makes sure the right ABI is used for public interfaces.\r |
30fdf114 LG |
164 | /// eficecl is a work in progress and we do not yet have the compiler\r |
165 | ///\r | |
f7496d71 | 166 | #define EFIAPI\r |
30fdf114 | 167 | #else\r |
f7496d71 | 168 | #define EFIAPI\r |
30fdf114 LG |
169 | #endif\r |
170 | \r | |
171 | //\r | |
172 | // The Microsoft* C compiler can removed references to unreferenced data items\r | |
f7496d71 | 173 | // if the /OPT:REF linker option is used. We defined a macro as this is a\r |
30fdf114 LG |
174 | // a non standard extension\r |
175 | //\r | |
176 | #if _MSC_EXTENSIONS\r | |
177 | #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)\r | |
178 | #else\r | |
179 | #define GLOBAL_REMOVE_IF_UNREFERENCED\r | |
180 | #endif\r | |
181 | \r | |
182 | #endif\r | |
183 | \r |