• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Processor or Compiler specific defines and types for x64.
3 
4   Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
5 
6   This program and the accompanying materials are licensed and made available
7   under the terms and conditions of the BSD License which accompanies this
8   distribution.  The full text of the license may be found at
9     http://opensource.org/licenses/bsd-license.php
10 
11   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 
14 **/
15 
16 #ifndef __PROCESSOR_BIND_H__
17 #define __PROCESSOR_BIND_H__
18 
19 //
20 // Define the processor type so other code can make processor based choices
21 //
22 #define MDE_CPU_IA32
23 
24 //
25 // Make sure we are useing the correct packing rules per EFI specification
26 //
27 #ifndef __GNUC__
28 #pragma pack()
29 #endif
30 
31 #if _MSC_EXTENSIONS
32 
33 //
34 // Disable warning that make it impossible to compile at /W4
35 // This only works for Microsoft* tools
36 //
37 
38 //
39 // Disabling bitfield type checking warnings.
40 //
41 #pragma warning ( disable : 4214 )
42 
43 //
44 // Disabling the unreferenced formal parameter warnings.
45 //
46 #pragma warning ( disable : 4100 )
47 
48 //
49 // Disable slightly different base types warning as CHAR8 * can not be set
50 // to a constant string.
51 //
52 #pragma warning ( disable : 4057 )
53 
54 //
55 // ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
56 //
57 #pragma warning ( disable : 4127 )
58 
59 
60 #endif
61 
62 
63 #if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L)
64   //
65   // No ANSI C 2000 stdint.h integer width declarations, so define equivalents
66   //
67 
68   #if _MSC_EXTENSIONS
69 
70     //
71     // use Microsoft* C complier dependent integer width types
72     //
73     typedef unsigned __int64    UINT64;
74     typedef __int64             INT64;
75     typedef unsigned __int32    UINT32;
76     typedef __int32             INT32;
77     typedef unsigned short      UINT16;
78     typedef unsigned short      CHAR16;
79     typedef short               INT16;
80     typedef unsigned char       BOOLEAN;
81     typedef unsigned char       UINT8;
82     typedef char                CHAR8;
83     typedef char                INT8;
84   #else
85 
86     //
87     // Assume standard IA-32 alignment.
88     // BugBug: Need to check portability of long long
89     //
90     typedef unsigned long long  UINT64;
91     typedef long long           INT64;
92     typedef unsigned int        UINT32;
93     typedef int                 INT32;
94     typedef unsigned short      UINT16;
95     typedef unsigned short      CHAR16;
96     typedef short               INT16;
97     typedef unsigned char       BOOLEAN;
98     typedef unsigned char       UINT8;
99     typedef char                CHAR8;
100     typedef char                INT8;
101   #endif
102 
103   #define UINT8_MAX 0xff
104 
105 #else
106   //
107   // Use ANSI C 2000 stdint.h integer width declarations
108   //
109   #include "stdint.h"
110   typedef uint8_t   BOOLEAN;
111   typedef int8_t    INT8;
112   typedef uint8_t   UINT8;
113   typedef int16_t   INT16;
114   typedef uint16_t  UINT16;
115   typedef int32_t   INT32;
116   typedef uint32_t  UINT32;
117   typedef int64_t   INT64;
118   typedef uint64_t  UINT64;
119   typedef char      CHAR8;
120   typedef uint16_t  CHAR16;
121 
122 #endif
123 
124 typedef UINT32  UINTN;
125 typedef INT32   INTN;
126 
127 
128 //
129 // Processor specific defines
130 //
131 #define MAX_BIT     0x80000000
132 #define MAX_2_BITS  0xC0000000
133 
134 //
135 // Maximum legal IA-32 address
136 //
137 #define MAX_ADDRESS   0xFFFFFFFF
138 
139 //
140 // Modifier to ensure that all protocol member functions and EFI intrinsics
141 // use the correct C calling convention. All protocol member functions and
142 // EFI intrinsics are required to modify their member functions with EFIAPI.
143 //
144 #if _MSC_EXTENSIONS
145   //
146   // Microsoft* compiler requires _EFIAPI useage, __cdecl is Microsoft* specific C.
147   //
148   #define EFIAPI __cdecl
149 #endif
150 
151 #if __GNUC__
152   #define EFIAPI __attribute__((cdecl))
153 #endif
154 
155 //
156 // The Microsoft* C compiler can removed references to unreferenced data items
157 //  if the /OPT:REF linker option is used. We defined a macro as this is a
158 //  a non standard extension
159 //
160 #if _MSC_EXTENSIONS
161   #define GLOBAL_REMOVE_IF_UNREFERENCED __declspec(selectany)
162 #else
163   #define GLOBAL_REMOVE_IF_UNREFERENCED
164 #endif
165 
166 #endif
167