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