| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
#include <check_for_wrapper.h> |
| 46 |
|
| 47 |
#ifndef _PORTING_H_ |
| 48 |
#define _PORTING_H_ |
| 49 |
|
| 50 |
#if defined (_MSC_VER) |
| 51 |
#include <intrin.h> |
| 52 |
void _disable (void); |
| 53 |
void _enable (void); |
| 54 |
#pragma warning(disable: 4103 4001 4733) |
| 55 |
#pragma intrinsic (_disable, _enable) |
| 56 |
#pragma warning(push) |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
#define MAKE_AS_A_STRING(arg) #arg |
| 61 |
|
| 62 |
#define CODE_GROUP(arg) __pragma (code_seg (MAKE_AS_A_STRING (.t##arg))) |
| 63 |
|
| 64 |
#define RDATA_GROUP(arg) __pragma (const_seg (MAKE_AS_A_STRING (.d##arg))) |
| 65 |
#define FUNC_ATTRIBUTE(arg) __declspec(arg) |
| 66 |
|
| 67 |
|
| 68 |
#if _MSC_VER < 900 |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
typedef void VOID; |
| 79 |
|
| 80 |
|
| 81 |
typedef unsigned long UINTN; |
| 82 |
typedef long INT32; |
| 83 |
typedef unsigned long UINT32; |
| 84 |
typedef int INT16; |
| 85 |
typedef unsigned int UINT16; |
| 86 |
typedef char INT8; |
| 87 |
typedef unsigned char UINT8; |
| 88 |
typedef char CHAR8; |
| 89 |
typedef unsigned short CHAR16; |
| 90 |
|
| 91 |
|
| 92 |
typedef struct _UINT64 { |
| 93 |
IN OUT UINT32 lo; |
| 94 |
IN OUT UINT32 hi; |
| 95 |
} UINT64; |
| 96 |
|
| 97 |
|
| 98 |
#define TRUE 1 |
| 99 |
#define FALSE 0 |
| 100 |
typedef unsigned char BOOLEAN; |
| 101 |
|
| 102 |
#define CONST const |
| 103 |
#define STATIC static |
| 104 |
#define VOLATILE volatile |
| 105 |
#define CALLCONV __pascal |
| 106 |
#define ROMDATA __based( __segname( "_CODE" ) ) |
| 107 |
#define _16BYTE_ALIGN __declspec(align(16)) |
| 108 |
#define _8BYTE_ALIGN __declspec(align(8)) |
| 109 |
#define _4BYTE_ALIGN __declspec(align(4)) |
| 110 |
#define _2BYTE_ALIGN __declspec(align(2)) |
| 111 |
#define _1BYTE_ALIGN __declspec(align(1)) |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
#pragma warning( disable : 4103 ) // Disable '#pragma pack' in .h warning |
| 116 |
#pragma pack(1) |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
#pragma warning( disable : 4761 ) |
| 128 |
|
| 129 |
#else |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
#if defined (_M_IX86) |
| 141 |
#pragma warning (disable: 4100 4276 4214 4001 4142 4305 4306) |
| 142 |
|
| 143 |
#ifndef VOID |
| 144 |
typedef void VOID; |
| 145 |
#endif |
| 146 |
|
| 147 |
#ifndef UINTN |
| 148 |
typedef unsigned __w64 UINTN; |
| 149 |
#endif |
| 150 |
typedef __int64 INT64; |
| 151 |
typedef unsigned __int64 UINT64; |
| 152 |
typedef int INT32; |
| 153 |
typedef unsigned int UINT32; |
| 154 |
typedef short INT16; |
| 155 |
typedef unsigned short UINT16; |
| 156 |
typedef char INT8; |
| 157 |
typedef unsigned char UINT8; |
| 158 |
typedef char CHAR8; |
| 159 |
typedef unsigned short CHAR16; |
| 160 |
|
| 161 |
|
| 162 |
#ifndef TRUE |
| 163 |
#define TRUE 1 |
| 164 |
#endif |
| 165 |
#ifndef FALSE |
| 166 |
#define FALSE 0 |
| 167 |
#endif |
| 168 |
typedef unsigned char BOOLEAN; |
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
#pragma pack(1) |
| 173 |
|
| 174 |
#define CONST const |
| 175 |
#define STATIC static |
| 176 |
#define VOLATILE volatile |
| 177 |
#define CALLCONV |
| 178 |
#define ROMDATA |
| 179 |
#define _16BYTE_ALIGN __declspec(align(64)) |
| 180 |
#define _8BYTE_ALIGN __declspec(align(8)) |
| 181 |
#define _4BYTE_ALIGN __declspec(align(4)) |
| 182 |
#define _2BYTE_ALIGN __declspec(align(2)) |
| 183 |
#define _1BYTE_ALIGN __declspec(align(1)) |
| 184 |
|
| 185 |
#if _MSC_VER >= 1400 |
| 186 |
#define VA_ARGS_SUPPORTED |
| 187 |
#endif |
| 188 |
|
| 189 |
#else |
| 190 |
#pragma warning (disable: 4100 4276 4214 4001 4142 4305 4306 4366) |
| 191 |
|
| 192 |
#ifndef VOID |
| 193 |
typedef void VOID; |
| 194 |
#endif |
| 195 |
|
| 196 |
#ifndef UINTN |
| 197 |
typedef unsigned __int64 UINTN; |
| 198 |
#endif |
| 199 |
typedef __int64 INT64; |
| 200 |
typedef unsigned __int64 UINT64; |
| 201 |
typedef int INT32; |
| 202 |
typedef unsigned int UINT32; |
| 203 |
typedef short INT16; |
| 204 |
typedef unsigned short UINT16; |
| 205 |
typedef char INT8; |
| 206 |
typedef unsigned char UINT8; |
| 207 |
typedef char CHAR8; |
| 208 |
typedef unsigned short CHAR16; |
| 209 |
|
| 210 |
|
| 211 |
#ifndef TRUE |
| 212 |
#define TRUE 1 |
| 213 |
#endif |
| 214 |
#ifndef FALSE |
| 215 |
#define FALSE 0 |
| 216 |
#endif |
| 217 |
typedef unsigned char BOOLEAN; |
| 218 |
#define _16BYTE_ALIGN __declspec(align(16)) |
| 219 |
#define _8BYTE_ALIGN __declspec(align(8)) |
| 220 |
#define _4BYTE_ALIGN __declspec(align(4)) |
| 221 |
#define _2BYTE_ALIGN __declspec(align(2)) |
| 222 |
#define _1BYTE_ALIGN __declspec(align(1)) |
| 223 |
|
| 224 |
|
| 225 |
#pragma pack(1) |
| 226 |
|
| 227 |
#define CONST const |
| 228 |
#define STATIC static |
| 229 |
#define VOLATILE volatile |
| 230 |
#define CALLCONV |
| 231 |
#define ROMDATA |
| 232 |
#endif |
| 233 |
#endif |
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
#elif defined __GNUC__ |
| 238 |
|
| 239 |
#include <stdint.h> |
| 240 |
|
| 241 |
#define IN |
| 242 |
#define OUT |
| 243 |
#define STATIC static |
| 244 |
#define VOLATILE volatile |
| 245 |
#define TRUE 1 |
| 246 |
#define FALSE 0 |
| 247 |
#define CONST const |
| 248 |
#define ROMDATA |
| 249 |
#define CALLCONV |
| 250 |
#define _16BYTE_ALIGN __attribute__((aligned (16))) |
| 251 |
#define _8BYTE_ALIGN __attribute__((aligned (8))) |
| 252 |
#define _4BYTE_ALIGN __attribute__((aligned (4))) |
| 253 |
#define _2BYTE_ALIGN __attribute__((aligned (2))) |
| 254 |
#define _1BYTE_ALIGN __attribute__((aligned (1))) |
| 255 |
|
| 256 |
typedef uintptr_t UINTN; |
| 257 |
typedef int64_t INT64; |
| 258 |
typedef uint64_t UINT64; |
| 259 |
typedef int32_t INT32; |
| 260 |
typedef uint32_t UINT32; |
| 261 |
typedef int16_t INT16; |
| 262 |
typedef uint16_t UINT16; |
| 263 |
typedef int8_t INT8; |
| 264 |
typedef uint8_t UINT8; |
| 265 |
typedef char CHAR8; |
| 266 |
typedef unsigned short CHAR16; |
| 267 |
typedef unsigned char BOOLEAN; |
| 268 |
typedef void VOID; |
| 269 |
|
| 270 |
#define CODE_GROUP(arg) |
| 271 |
#define RDATA_GROUP(arg) |
| 272 |
|
| 273 |
#pragma pack(1) |
| 274 |
|
| 275 |
#define FUNC_ATTRIBUTE(arg) __attribute__((arg)) |
| 276 |
#define MAKE_AS_A_STRING(arg) #arg |
| 277 |
#include <stddef.h> |
| 278 |
#include <gcc-intrin.h> |
| 279 |
|
| 280 |
#include <assert.h> |
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
#ifndef NULL |
| 285 |
#define NULL ((void *)0) |
| 286 |
#endif |
| 287 |
|
| 288 |
#else |
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
#error "Unknown compiler in use" |
| 293 |
#endif |
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
#define AGESA_FORWARD_DECLARATION(x) typedef struct _##x x |
| 301 |
|
| 302 |
|
| 303 |
#define IN |
| 304 |
#define OUT |
| 305 |
|
| 306 |
#endif |