2013-01-31 01:25:25 +04:00
|
|
|
/*++
|
|
|
|
|
|
|
|
Copyright (c) 1998 Intel Corporation
|
|
|
|
|
|
|
|
Module Name:
|
|
|
|
|
|
|
|
efefind.h
|
|
|
|
|
|
|
|
Abstract:
|
|
|
|
|
|
|
|
EFI to compile bindings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Revision History
|
|
|
|
|
|
|
|
--*/
|
|
|
|
|
|
|
|
#ifndef __GNUC__
|
|
|
|
#pragma pack()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
|
|
|
// Basic int types of various widths
|
|
|
|
//
|
|
|
|
|
2019-11-28 02:03:42 +03:00
|
|
|
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L ) && !defined(__cplusplus)
|
2013-01-31 01:25:25 +04:00
|
|
|
|
|
|
|
// No ANSI C 1999/2000 stdint.h integer width declarations
|
|
|
|
|
|
|
|
#if defined(_MSC_EXTENSIONS)
|
|
|
|
|
|
|
|
// Use Microsoft C compiler integer width declarations
|
|
|
|
|
|
|
|
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__)
|
- Removes the ElfW() macro usage from reloc_ia32.c and reloc_x86_64.c. These
macros only exist in link.h on Linux. On FreeBSD, the equivalent macro is
__ElfN(). But the macro usage is redundant. You're only going to compile the
ia32 file for IA32 binaries and the x86_64 file for X64 binaries. If you had
just one file built for both cases, then using the macro might make more
sense.
- Removes the "#define foo_t efi_foo_t" macros from reloc_ia32.c and
reloc_x86_64.c.
- Modifies inc/x86_64/efibind.h and inc/ia32/efibind.h to use the new
definitions for uint64_t, int64_t and int8_t. The 64-bit types are now defined
as:
typedef int __attribute__((__mode__(__DI__))) int64_t;
typedef unsigned int __attribute__((__mode__(__DI__))) uint64_t;
This removes the conflict between the host types dragged in by elf.h and the
type definitions in efibind.h that made the #define foo_t efi_foo_t" hack
necessary. Also, int8_t is now defined as signed char instead of just char
(assuming char == signed char is apparently not good enough).
- Also modifies these files to use stdint.h instead of stdint-gcc.h. It's
unclear if this is completely correct, but stdint-gcc.h is not present with
all GCC installs, and if you use -std=c99 or later you will force this case to
be hit. This also can break clang, which doesn't have a stdint-gcc.h at all.
- Removes the #include of <link.h> from reloc_ia32.c and reloc_x86_64.c (since
with the previous changes it's not needed anymore).
- Places the #include of <elf.h> after #include <efi>/#include <efilib.h> so
that we know the types will always be defined properly, in case you build on a
system where <elf.h> doesn't automatically pull in the right header files to
define all the needed types. (This actually happens on VxWorks. It's harmless
elsewhere. If you don't care about VxWorks, you can leave this out.)
- Modifies setjmp_ia32.S and setjmp_x86_64.S so to change "function" to
@function. The clang compiler doesn't like the former. Clang and GCC both like
the latter.
- Modifles Make.defaults so that if ARCH is detected as "amd64," it's changed
to "x86_64." It happens that uname -m on 64-bit FreeBSD reports the former
rather than the latter, which breaks the build. This may also be the case on
some other OSes. There's a way to force uname(1) to return x86_64 as the
machine type, but this way is a little friendlier.
- Creates gnuefi/elf_ia32_fbsd_efi.lds which specifies the object file type as
elf-ia32-freebsd. This is required for building on FreeBSD/i386, not just
FreeBSD/amd64.
- Modifies apps/Makefile to always use
$(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds when building on either 32-bit or
64-bit FreeBSD instead of just for the x86_64 case.
- Changed LDFLAGS in Make.defaults to include --no-undefined. This will cause
linking to fail if there are any unsatisfied symbols when creating foo.so
during any of the app builds, as opposed to just silently succeeding and
producing an unusable binary.
- Changed CFLAGS to include -ffreestanding -fno-stack-protector -fno-stack-
check. This prevents clang from inserting a call to memset() when compiling
the RtZeroMem() and RtSetMem() routines in lib/runtime/efirtlib.c and guards
against the native compiler in some Linux distros from adding in stack
checking code which relies on libc help that isn't present in the EFI runtime
environment.
This does the following:
- Cleans up the ia32 and x86-64 relocation code a bit (tries to break the
dependency between the host ELF headers and the EFI runtime environment)
- Avoids the dependency on stdint-gcc.h which may not always be available
- Allows GNU EFI to build out of the box on both FreeBSD/i386 and
FreeBSD/amd64
- Allows GNU EFI to build out of the box with either GCC or clang on
FreeBSD/i386 and FreeBSD/amd64 9.0 and later.
- Makes things a little easier to port to VxWorks
- Avoids creating un-runable binaries with unresolved symbol definitions
(which can be very confusing to debug)
2013-05-15 23:26:16 +04:00
|
|
|
typedef int __attribute__((__mode__(__DI__))) int64_t;
|
|
|
|
typedef unsigned int __attribute__((__mode__(__DI__))) uint64_t;
|
2013-01-31 01:25:25 +04:00
|
|
|
typedef unsigned int uint32_t;
|
|
|
|
typedef int int32_t;
|
|
|
|
typedef unsigned short uint16_t;
|
|
|
|
typedef short int16_t;
|
|
|
|
typedef unsigned char uint8_t;
|
- Removes the ElfW() macro usage from reloc_ia32.c and reloc_x86_64.c. These
macros only exist in link.h on Linux. On FreeBSD, the equivalent macro is
__ElfN(). But the macro usage is redundant. You're only going to compile the
ia32 file for IA32 binaries and the x86_64 file for X64 binaries. If you had
just one file built for both cases, then using the macro might make more
sense.
- Removes the "#define foo_t efi_foo_t" macros from reloc_ia32.c and
reloc_x86_64.c.
- Modifies inc/x86_64/efibind.h and inc/ia32/efibind.h to use the new
definitions for uint64_t, int64_t and int8_t. The 64-bit types are now defined
as:
typedef int __attribute__((__mode__(__DI__))) int64_t;
typedef unsigned int __attribute__((__mode__(__DI__))) uint64_t;
This removes the conflict between the host types dragged in by elf.h and the
type definitions in efibind.h that made the #define foo_t efi_foo_t" hack
necessary. Also, int8_t is now defined as signed char instead of just char
(assuming char == signed char is apparently not good enough).
- Also modifies these files to use stdint.h instead of stdint-gcc.h. It's
unclear if this is completely correct, but stdint-gcc.h is not present with
all GCC installs, and if you use -std=c99 or later you will force this case to
be hit. This also can break clang, which doesn't have a stdint-gcc.h at all.
- Removes the #include of <link.h> from reloc_ia32.c and reloc_x86_64.c (since
with the previous changes it's not needed anymore).
- Places the #include of <elf.h> after #include <efi>/#include <efilib.h> so
that we know the types will always be defined properly, in case you build on a
system where <elf.h> doesn't automatically pull in the right header files to
define all the needed types. (This actually happens on VxWorks. It's harmless
elsewhere. If you don't care about VxWorks, you can leave this out.)
- Modifies setjmp_ia32.S and setjmp_x86_64.S so to change "function" to
@function. The clang compiler doesn't like the former. Clang and GCC both like
the latter.
- Modifles Make.defaults so that if ARCH is detected as "amd64," it's changed
to "x86_64." It happens that uname -m on 64-bit FreeBSD reports the former
rather than the latter, which breaks the build. This may also be the case on
some other OSes. There's a way to force uname(1) to return x86_64 as the
machine type, but this way is a little friendlier.
- Creates gnuefi/elf_ia32_fbsd_efi.lds which specifies the object file type as
elf-ia32-freebsd. This is required for building on FreeBSD/i386, not just
FreeBSD/amd64.
- Modifies apps/Makefile to always use
$(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds when building on either 32-bit or
64-bit FreeBSD instead of just for the x86_64 case.
- Changed LDFLAGS in Make.defaults to include --no-undefined. This will cause
linking to fail if there are any unsatisfied symbols when creating foo.so
during any of the app builds, as opposed to just silently succeeding and
producing an unusable binary.
- Changed CFLAGS to include -ffreestanding -fno-stack-protector -fno-stack-
check. This prevents clang from inserting a call to memset() when compiling
the RtZeroMem() and RtSetMem() routines in lib/runtime/efirtlib.c and guards
against the native compiler in some Linux distros from adding in stack
checking code which relies on libc help that isn't present in the EFI runtime
environment.
This does the following:
- Cleans up the ia32 and x86-64 relocation code a bit (tries to break the
dependency between the host ELF headers and the EFI runtime environment)
- Avoids the dependency on stdint-gcc.h which may not always be available
- Allows GNU EFI to build out of the box on both FreeBSD/i386 and
FreeBSD/amd64
- Allows GNU EFI to build out of the box with either GCC or clang on
FreeBSD/i386 and FreeBSD/amd64 9.0 and later.
- Makes things a little easier to port to VxWorks
- Avoids creating un-runable binaries with unresolved symbol definitions
(which can be very confusing to debug)
2013-05-15 23:26:16 +04:00
|
|
|
typedef signed char int8_t;
|
2013-01-31 01:25:25 +04:00
|
|
|
#elif defined(UNIX_LP64)
|
|
|
|
|
|
|
|
/* Use LP64 programming model from C_FLAGS for integer width declarations */
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
/* Assume P64 programming model from C_FLAGS for integer width declarations */
|
|
|
|
|
|
|
|
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
|
2019-03-15 13:57:51 +03:00
|
|
|
typedef uint32_t uintptr_t;
|
|
|
|
typedef int32_t intptr_t;
|
2013-02-21 19:44:23 +04:00
|
|
|
#elif defined(__GNUC__)
|
- Removes the ElfW() macro usage from reloc_ia32.c and reloc_x86_64.c. These
macros only exist in link.h on Linux. On FreeBSD, the equivalent macro is
__ElfN(). But the macro usage is redundant. You're only going to compile the
ia32 file for IA32 binaries and the x86_64 file for X64 binaries. If you had
just one file built for both cases, then using the macro might make more
sense.
- Removes the "#define foo_t efi_foo_t" macros from reloc_ia32.c and
reloc_x86_64.c.
- Modifies inc/x86_64/efibind.h and inc/ia32/efibind.h to use the new
definitions for uint64_t, int64_t and int8_t. The 64-bit types are now defined
as:
typedef int __attribute__((__mode__(__DI__))) int64_t;
typedef unsigned int __attribute__((__mode__(__DI__))) uint64_t;
This removes the conflict between the host types dragged in by elf.h and the
type definitions in efibind.h that made the #define foo_t efi_foo_t" hack
necessary. Also, int8_t is now defined as signed char instead of just char
(assuming char == signed char is apparently not good enough).
- Also modifies these files to use stdint.h instead of stdint-gcc.h. It's
unclear if this is completely correct, but stdint-gcc.h is not present with
all GCC installs, and if you use -std=c99 or later you will force this case to
be hit. This also can break clang, which doesn't have a stdint-gcc.h at all.
- Removes the #include of <link.h> from reloc_ia32.c and reloc_x86_64.c (since
with the previous changes it's not needed anymore).
- Places the #include of <elf.h> after #include <efi>/#include <efilib.h> so
that we know the types will always be defined properly, in case you build on a
system where <elf.h> doesn't automatically pull in the right header files to
define all the needed types. (This actually happens on VxWorks. It's harmless
elsewhere. If you don't care about VxWorks, you can leave this out.)
- Modifies setjmp_ia32.S and setjmp_x86_64.S so to change "function" to
@function. The clang compiler doesn't like the former. Clang and GCC both like
the latter.
- Modifles Make.defaults so that if ARCH is detected as "amd64," it's changed
to "x86_64." It happens that uname -m on 64-bit FreeBSD reports the former
rather than the latter, which breaks the build. This may also be the case on
some other OSes. There's a way to force uname(1) to return x86_64 as the
machine type, but this way is a little friendlier.
- Creates gnuefi/elf_ia32_fbsd_efi.lds which specifies the object file type as
elf-ia32-freebsd. This is required for building on FreeBSD/i386, not just
FreeBSD/amd64.
- Modifies apps/Makefile to always use
$(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds when building on either 32-bit or
64-bit FreeBSD instead of just for the x86_64 case.
- Changed LDFLAGS in Make.defaults to include --no-undefined. This will cause
linking to fail if there are any unsatisfied symbols when creating foo.so
during any of the app builds, as opposed to just silently succeeding and
producing an unusable binary.
- Changed CFLAGS to include -ffreestanding -fno-stack-protector -fno-stack-
check. This prevents clang from inserting a call to memset() when compiling
the RtZeroMem() and RtSetMem() routines in lib/runtime/efirtlib.c and guards
against the native compiler in some Linux distros from adding in stack
checking code which relies on libc help that isn't present in the EFI runtime
environment.
This does the following:
- Cleans up the ia32 and x86-64 relocation code a bit (tries to break the
dependency between the host ELF headers and the EFI runtime environment)
- Avoids the dependency on stdint-gcc.h which may not always be available
- Allows GNU EFI to build out of the box on both FreeBSD/i386 and
FreeBSD/amd64
- Allows GNU EFI to build out of the box with either GCC or clang on
FreeBSD/i386 and FreeBSD/amd64 9.0 and later.
- Makes things a little easier to port to VxWorks
- Avoids creating un-runable binaries with unresolved symbol definitions
(which can be very confusing to debug)
2013-05-15 23:26:16 +04:00
|
|
|
#include <stdint.h>
|
2013-01-31 01:25:25 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
|
|
|
// Basic EFI types of various widths
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef __WCHAR_TYPE__
|
|
|
|
# define __WCHAR_TYPE__ short
|
|
|
|
#endif
|
2019-08-27 20:44:15 +03:00
|
|
|
#ifndef __CHAR16_TYPE__
|
|
|
|
# define __CHAR16_TYPE__ unsigned short
|
|
|
|
#endif
|
2013-01-31 01:25:25 +04:00
|
|
|
|
|
|
|
typedef uint64_t UINT64;
|
|
|
|
typedef int64_t INT64;
|
|
|
|
|
|
|
|
#ifndef _BASETSD_H_
|
|
|
|
typedef uint32_t UINT32;
|
|
|
|
typedef int32_t INT32;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef uint16_t UINT16;
|
2019-08-27 20:44:15 +03:00
|
|
|
typedef __CHAR16_TYPE__ CHAR16;
|
2013-01-31 01:25:25 +04:00
|
|
|
typedef int16_t INT16;
|
2019-08-27 20:44:15 +03:00
|
|
|
|
2013-01-31 01:25:25 +04:00
|
|
|
typedef uint8_t UINT8;
|
2019-08-27 20:44:15 +03:00
|
|
|
typedef char CHAR8;
|
2013-01-31 01:25:25 +04:00
|
|
|
typedef int8_t INT8;
|
2019-08-27 20:44:15 +03:00
|
|
|
|
2013-01-31 01:25:25 +04:00
|
|
|
typedef __WCHAR_TYPE__ WCHAR;
|
|
|
|
|
|
|
|
#undef VOID
|
|
|
|
#define 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); // Make it hang on Bios[Dbg]32
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//
|
|
|
|
// Pointers must be aligned to these address to function
|
|
|
|
//
|
|
|
|
|
|
|
|
#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 macros to build data structure signatures from characters.
|
|
|
|
//
|
|
|
|
|
|
|
|
#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))
|
|
|
|
//
|
|
|
|
// To export & import functions in the EFI emulator environment
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifdef EFI_NT_EMULATOR
|
|
|
|
#define EXPORTAPI __declspec( dllexport )
|
|
|
|
#else
|
|
|
|
#define EXPORTAPI
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// EFIAPI - prototype calling convention for EFI function pointers
|
|
|
|
// BOOTSERVICE - prototype for implementation of a boot service interface
|
|
|
|
// RUNTIMESERVICE - prototype for implementation of a runtime service interface
|
|
|
|
// RUNTIMEFUNCTION - prototype for implementation of a runtime function that is not a service
|
|
|
|
// RUNTIME_CODE - pragma macro for declaring runtime code
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef EFIAPI // Forces EFI calling conventions reguardless of compiler options
|
|
|
|
#ifdef _MSC_EXTENSIONS
|
|
|
|
#define EFIAPI __cdecl // Force C calling convention for Microsoft C compiler
|
|
|
|
#else
|
|
|
|
#define EFIAPI // Substitute expresion to force C calling convention
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define BOOTSERVICE
|
|
|
|
//#define RUNTIMESERVICE(proto,a) alloc_text("rtcode",a); proto a
|
|
|
|
//#define RUNTIMEFUNCTION(proto,a) alloc_text("rtcode",a); proto a
|
|
|
|
#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
|
|
|
|
|
|
|
|
//
|
|
|
|
// To help ensure proper coding of integrated drivers, they are
|
|
|
|
// compiled as DLLs. In NT they require a dll init entry pointer.
|
|
|
|
// The macro puts a stub entry point into the DLL so it will load.
|
|
|
|
//
|
|
|
|
|
|
|
|
#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 // EFI_NT_EMULATOR
|
|
|
|
|
|
|
|
//
|
|
|
|
// When build similiar to FW, then link everything together as
|
2015-01-05 21:13:22 +03:00
|
|
|
// one big module. For the MSVC toolchain, we simply tell the
|
|
|
|
// linker what our driver init function is using /ENTRY.
|
2013-01-31 01:25:25 +04:00
|
|
|
//
|
2015-01-05 21:13:22 +03:00
|
|
|
#if defined(_MSC_EXTENSIONS)
|
|
|
|
#define EFI_DRIVER_ENTRY_POINT(InitFunction) \
|
|
|
|
__pragma(comment(linker, "/ENTRY:" # InitFunction))
|
|
|
|
#else
|
2013-01-31 01:25:25 +04:00
|
|
|
#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")));
|
2015-01-05 21:13:22 +03:00
|
|
|
#endif
|
2013-01-31 01:25:25 +04:00
|
|
|
|
|
|
|
#define LOAD_INTERNAL_DRIVER(_if, type, name, entry) \
|
|
|
|
(_if)->LoadInternal(type, name, entry)
|
|
|
|
|
|
|
|
#endif // EFI_FW_NT
|
|
|
|
|
|
|
|
//
|
|
|
|
// Some compilers don't support the forward reference construct:
|
|
|
|
// typedef struct XXXXX
|
|
|
|
//
|
|
|
|
// The following macro provide a workaround for such cases.
|
|
|
|
//
|
|
|
|
#ifdef NO_INTERFACE_DECL
|
|
|
|
#define INTERFACE_DECL(x)
|
|
|
|
#else
|
2015-09-17 15:22:39 +03:00
|
|
|
#if defined(__GNUC__) || defined(_MSC_EXTENSIONS)
|
2013-01-31 01:25:25 +04:00
|
|
|
#define INTERFACE_DECL(x) struct x
|
|
|
|
#else
|
|
|
|
#define INTERFACE_DECL(x) typedef struct x
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* No efi call wrapper for IA32 architecture */
|
|
|
|
#define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__)
|
|
|
|
#define EFI_FUNCTION
|
|
|
|
|
|
|
|
#ifdef _MSC_EXTENSIONS
|
|
|
|
#pragma warning ( disable : 4731 ) // Suppress warnings about modification of EBP
|
|
|
|
#endif
|
|
|
|
|