]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/C/Include/Ia32/ProcessorBind.h
BaseTools: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / BaseTools / Source / C / Include / Ia32 / ProcessorBind.h
CommitLineData
30fdf114
LG
1/** @file\r
2 Processor or Compiler specific defines and types for x64.\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_IA32\r
17\r
18//\r
19// Make sure we are useing the correct packing rules per EFI specification\r
20//\r
21#ifndef __GNUC__\r
22#pragma pack()\r
23#endif\r
24\r
25#if _MSC_EXTENSIONS\r
26\r
27//\r
28// Disable warning that make it impossible to compile at /W4\r
29// This only works for Microsoft* tools\r
30//\r
31\r
32//\r
33// Disabling bitfield type checking warnings.\r
34//\r
35#pragma warning ( disable : 4214 )\r
36\r
37//\r
38// Disabling the unreferenced formal parameter warnings.\r
39//\r
40#pragma warning ( disable : 4100 )\r
41\r
42//\r
43// Disable slightly different base types warning as CHAR8 * can not be set\r
44// to a constant string.\r
45//\r
46#pragma warning ( disable : 4057 )\r
47\r
48//\r
fd171542 49// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning\r
30fdf114
LG
50//\r
51#pragma warning ( disable : 4127 )\r
52\r
53\r
54#endif\r
55\r
56\r
57#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)\r
58 //\r
59 // No ANSI C 2000 stdint.h integer width declarations, so define equivalents\r
60 //\r
f7496d71
LG
61\r
62 #if _MSC_EXTENSIONS\r
63\r
30fdf114 64 //\r
fb0b35e0 65 // use Microsoft* C compiler dependent integer width types\r
30fdf114
LG
66 //\r
67 typedef unsigned __int64 UINT64;\r
68 typedef __int64 INT64;\r
69 typedef unsigned __int32 UINT32;\r
70 typedef __int32 INT32;\r
71 typedef unsigned short UINT16;\r
72 typedef unsigned short CHAR16;\r
73 typedef short INT16;\r
74 typedef unsigned char BOOLEAN;\r
75 typedef unsigned char UINT8;\r
76 typedef char CHAR8;\r
77 typedef char INT8;\r
78 #else\r
79\r
80 //\r
f7496d71 81 // Assume standard IA-32 alignment.\r
30fdf114
LG
82 // BugBug: Need to check portability of long long\r
83 //\r
84 typedef unsigned long long UINT64;\r
85 typedef long long INT64;\r
86 typedef unsigned int UINT32;\r
87 typedef int INT32;\r
88 typedef unsigned short UINT16;\r
89 typedef unsigned short CHAR16;\r
90 typedef short INT16;\r
91 typedef unsigned char BOOLEAN;\r
92 typedef unsigned char UINT8;\r
93 typedef char CHAR8;\r
94 typedef char INT8;\r
95 #endif\r
96\r
97 #define UINT8_MAX 0xff\r
98\r
99#else\r
100 //\r
101 // Use ANSI C 2000 stdint.h integer width declarations\r
102 //\r
103 #include "stdint.h"\r
104 typedef uint8_t BOOLEAN;\r
105 typedef int8_t INT8;\r
106 typedef uint8_t UINT8;\r
107 typedef int16_t INT16;\r
108 typedef uint16_t UINT16;\r
109 typedef int32_t INT32;\r
110 typedef uint32_t UINT32;\r
111 typedef int64_t INT64;\r
112 typedef uint64_t UINT64;\r
113 typedef char CHAR8;\r
114 typedef uint16_t CHAR16;\r
115\r
116#endif\r
117\r
118typedef UINT32 UINTN;\r
119typedef INT32 INTN;\r
120\r
121\r
122//\r
123// Processor specific defines\r
124//\r
125#define MAX_BIT 0x80000000\r
126#define MAX_2_BITS 0xC0000000\r
127\r
30fdf114
LG
128//\r
129// Modifier to ensure that all protocol member functions and EFI intrinsics\r
130// use the correct C calling convention. All protocol member functions and\r
fd171542 131// EFI intrinsics are required to modify their member functions with EFIAPI.\r
30fdf114
LG
132//\r
133#if _MSC_EXTENSIONS\r
134 //\r
fb0b35e0 135 // Microsoft* compiler requires _EFIAPI usage, __cdecl is Microsoft* specific C.\r
f7496d71
LG
136 //\r
137 #define EFIAPI __cdecl\r
30fdf114
LG
138#endif\r
139\r
140#if __GNUC__\r
f7496d71 141 #define EFIAPI __attribute__((cdecl))\r
30fdf114
LG
142#endif\r
143\r
144//\r
145// The Microsoft* C compiler can removed references to unreferenced data items\r
f7496d71 146// if the /OPT:REF linker option is used. We defined a macro as this is a\r
30fdf114
LG
147// a non standard extension\r
148//\r
149#if _MSC_EXTENSIONS\r
150 #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)\r
151#else\r
152 #define GLOBAL_REMOVE_IF_UNREFERENCED\r
153#endif\r
154\r
155#endif\r