123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294 |
- #ifndef __GNUC__
- #pragma pack()
- #endif
- #if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ) && !defined(__cplusplus)
-
- #if defined(_MSC_EXTENSIONS)
-
- typedef unsigned __int64 uint64_t;
- typedef __int64 int64_t;
- typedef unsigned __int32 uint32_t;
- typedef __int32 int32_t;
- typedef unsigned short uint16_t;
- typedef short int16_t;
- typedef unsigned char uint8_t;
- typedef char int8_t;
- #elif defined(__GNUC__)
- typedef int __attribute__((__mode__(__DI__))) int64_t;
- typedef unsigned int __attribute__((__mode__(__DI__))) uint64_t;
- typedef unsigned int uint32_t;
- typedef int int32_t;
- typedef unsigned short uint16_t;
- typedef short int16_t;
- typedef unsigned char uint8_t;
- typedef signed char int8_t;
- #elif defined(UNIX_LP64)
-
- typedef unsigned long uint64_t;
- typedef long int64_t;
- typedef unsigned int uint32_t;
- typedef int int32_t;
- typedef unsigned short uint16_t;
- typedef short int16_t;
- typedef unsigned char uint8_t;
- typedef char int8_t;
- #else
-
- typedef unsigned long long uint64_t __attribute__((aligned (8)));
- typedef long long int64_t __attribute__((aligned (8)));
- typedef unsigned int uint32_t;
- typedef int int32_t;
- typedef unsigned short uint16_t;
- typedef short int16_t;
- typedef unsigned char uint8_t;
- typedef char int8_t;
- #endif
- typedef uint32_t uintptr_t;
- typedef int32_t intptr_t;
- #elif defined(__GNUC__)
- #include <stdint.h>
- #endif
- #include <stddef.h>
- typedef wchar_t CHAR16;
- #define WCHAR CHAR16
- typedef uint64_t UINT64;
- typedef int64_t INT64;
- #ifndef _BASETSD_H_
- typedef uint32_t UINT32;
- typedef int32_t INT32;
- #endif
- typedef uint16_t UINT16;
- typedef int16_t INT16;
- typedef uint8_t UINT8;
- typedef char CHAR8;
- typedef int8_t INT8;
- #undef VOID
- typedef void VOID;
- typedef int32_t INTN;
- typedef uint32_t UINTN;
- #ifdef EFI_NT_EMULATOR
- #define POST_CODE(_Data)
- #else
- #ifdef EFI_DEBUG
- #define POST_CODE(_Data) __asm mov eax,(_Data) __asm out 0x80,al
- #else
- #define POST_CODE(_Data)
- #endif
- #endif
- #define EFIERR(a) (0x80000000 | a)
- #define EFI_ERROR_MASK 0x80000000
- #define EFIERR_OEM(a) (0xc0000000 | a)
- #define BAD_POINTER 0xFBFBFBFB
- #define MAX_ADDRESS 0xFFFFFFFF
- #ifdef EFI_NT_EMULATOR
- #define BREAKPOINT() __asm { int 3 }
- #else
- #define BREAKPOINT() while (TRUE);
- #endif
- #define MIN_ALIGNMENT_SIZE 4
- #define ALIGN_VARIABLE(Value ,Adjustment) \
- (UINTN)Adjustment = 0; \
- if((UINTN)Value % MIN_ALIGNMENT_SIZE) \
- (UINTN)Adjustment = MIN_ALIGNMENT_SIZE - ((UINTN)Value % MIN_ALIGNMENT_SIZE); \
- Value = (UINTN)Value + (UINTN)Adjustment
- #define EFI_SIGNATURE_16(A,B) ((A) | (B<<8))
- #define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16))
- #define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32))
- #ifdef EFI_NT_EMULATOR
- #define EXPORTAPI __declspec( dllexport )
- #else
- #define EXPORTAPI
- #endif
- #ifndef EFIAPI
- #ifdef _MSC_EXTENSIONS
- #define EFIAPI __cdecl
- #else
- #define EFIAPI
- #endif
- #endif
- #define BOOTSERVICE
- #define RUNTIMESERVICE
- #define RUNTIMEFUNCTION
- #define RUNTIME_CODE(a) alloc_text("rtcode", a)
- #define BEGIN_RUNTIME_DATA() data_seg("rtdata")
- #define END_RUNTIME_DATA() data_seg("")
- #define VOLATILE volatile
- #define MEMORY_FENCE()
- #ifdef EFI_NT_EMULATOR
- #define EFI_DRIVER_ENTRY_POINT(InitFunction) \
- UINTN \
- __stdcall \
- _DllMainCRTStartup ( \
- UINTN Inst, \
- UINTN reason_for_call, \
- VOID *rserved \
- ) \
- { \
- return 1; \
- } \
- \
- int \
- EXPORTAPI \
- __cdecl \
- InitializeDriver ( \
- void *ImageHandle, \
- void *SystemTable \
- ) \
- { \
- return InitFunction(ImageHandle, SystemTable); \
- }
- #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
- (_if)->LoadInternal(type, name, NULL)
- #else
- #if defined(_MSC_EXTENSIONS)
- #define EFI_DRIVER_ENTRY_POINT(InitFunction) \
- __pragma(comment(linker, "/ENTRY:" # InitFunction))
- #else
- #define EFI_DRIVER_ENTRY_POINT(InitFunction) \
- UINTN \
- InitializeDriver ( \
- VOID *ImageHandle, \
- VOID *SystemTable \
- ) \
- { \
- return InitFunction(ImageHandle, \
- SystemTable); \
- } \
- \
- EFI_STATUS efi_main( \
- EFI_HANDLE image, \
- EFI_SYSTEM_TABLE *systab \
- ) __attribute__((weak, \
- alias ("InitializeDriver")));
- #endif
- #define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
- (_if)->LoadInternal(type, name, entry)
- #endif
- #ifdef NO_INTERFACE_DECL
- #define INTERFACE_DECL(x)
- #else
- #if defined(__GNUC__) || defined(_MSC_EXTENSIONS)
- #define INTERFACE_DECL(x) struct x
- #else
- #define INTERFACE_DECL(x) typedef struct x
- #endif
- #endif
- #define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__)
- #define EFI_FUNCTION
- #ifdef _MSC_EXTENSIONS
- #pragma warning ( disable : 4731 )
- #endif
|