mirror of https://github.com/acidanthera/audk.git
Clean up PeImage.h according to code review comments.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6199 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
76d9959482
commit
1f76500ee9
|
@ -1,12 +1,13 @@
|
||||||
/** @file
|
/** @file
|
||||||
EFI image format for PE32 and PE32+. Please note some data structures are
|
EFI image format for PE32, PE32+ and TE. Please note some data structures are
|
||||||
different for PE32 and PE32+. EFI_IMAGE_NT_HEADERS32 is for PE32 and
|
different for PE32 and PE32+. EFI_IMAGE_NT_HEADERS32 is for PE32 and
|
||||||
EFI_IMAGE_NT_HEADERS64 is for PE32+.
|
EFI_IMAGE_NT_HEADERS64 is for PE32+.
|
||||||
|
|
||||||
This file is coded to the Visual Studio, Microsoft Portable Executable and
|
This file is coded to the Visual Studio, Microsoft Portable Executable and
|
||||||
Common Object File Format Specification, Revision 8.0 - May 16, 2006.
|
Common Object File Format Specification, Revision 8.0 - May 16, 2006.
|
||||||
|
This file also includes some definitions in PI Specification, Revision 1.0.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2007, Intel Corporation
|
Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -17,23 +18,23 @@
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef __EFI_IMAGE_H__
|
#ifndef __PE_IMAGE_H__
|
||||||
#define __EFI_IMAGE_H__
|
#define __PE_IMAGE_H__
|
||||||
|
|
||||||
//
|
///
|
||||||
// PE32+ Subsystem type for EFI images
|
/// PE32+ Subsystem type for EFI images
|
||||||
//
|
///
|
||||||
#define EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION 10
|
#define EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION 10
|
||||||
#define EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
|
#define EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
|
||||||
#define EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
|
#define EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
|
||||||
#define EFI_IMAGE_SUBSYSTEM_EFI_EFI_ROM 13
|
#define EFI_IMAGE_SUBSYSTEM_EFI_EFI_ROM 13
|
||||||
|
|
||||||
#define EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER 13
|
#define EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER 13 ///< defined PI Specification, 1.0
|
||||||
|
|
||||||
|
|
||||||
//
|
///
|
||||||
// PE32+ Machine type for EFI images
|
/// PE32+ Machine type for EFI images
|
||||||
//
|
///
|
||||||
#define IMAGE_FILE_MACHINE_I386 0x014c
|
#define IMAGE_FILE_MACHINE_I386 0x014c
|
||||||
#define IMAGE_FILE_MACHINE_IA64 0x0200
|
#define IMAGE_FILE_MACHINE_IA64 0x0200
|
||||||
#define IMAGE_FILE_MACHINE_EBC 0x0EBC
|
#define IMAGE_FILE_MACHINE_EBC 0x0EBC
|
||||||
|
@ -47,39 +48,42 @@
|
||||||
#define EFI_IMAGE_MACHINE_EBC IMAGE_FILE_MACHINE_EBC
|
#define EFI_IMAGE_MACHINE_EBC IMAGE_FILE_MACHINE_EBC
|
||||||
#define EFI_IMAGE_MACHINE_X64 IMAGE_FILE_MACHINE_X64
|
#define EFI_IMAGE_MACHINE_X64 IMAGE_FILE_MACHINE_X64
|
||||||
|
|
||||||
#define EFI_IMAGE_DOS_SIGNATURE 0x5A4D // MZ
|
///
|
||||||
#define EFI_IMAGE_OS2_SIGNATURE 0x454E // NE
|
/// EXE file formats
|
||||||
#define EFI_IMAGE_OS2_SIGNATURE_LE 0x454C // LE
|
///
|
||||||
#define EFI_IMAGE_NT_SIGNATURE 0x00004550 // PE00
|
#define EFI_IMAGE_DOS_SIGNATURE 0x5A4D ///< MZ
|
||||||
|
#define EFI_IMAGE_OS2_SIGNATURE 0x454E ///< NE
|
||||||
|
#define EFI_IMAGE_OS2_SIGNATURE_LE 0x454C ///< LE
|
||||||
|
#define EFI_IMAGE_NT_SIGNATURE 0x00004550 ///< PE00
|
||||||
|
|
||||||
///
|
///
|
||||||
/// PE images can start with an optional DOS header, so if an image is run
|
/// PE images can start with an optional DOS header, so if an image is run
|
||||||
/// under DOS it can print an error message.
|
/// under DOS it can print an error message.
|
||||||
///
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT16 e_magic; // Magic number
|
UINT16 e_magic; ///< Magic number
|
||||||
UINT16 e_cblp; // Bytes on last page of file
|
UINT16 e_cblp; ///< Bytes on last page of file
|
||||||
UINT16 e_cp; // Pages in file
|
UINT16 e_cp; ///< Pages in file
|
||||||
UINT16 e_crlc; // Relocations
|
UINT16 e_crlc; ///< Relocations
|
||||||
UINT16 e_cparhdr; // Size of header in paragraphs
|
UINT16 e_cparhdr; ///< Size of header in paragraphs
|
||||||
UINT16 e_minalloc; // Minimum extra paragraphs needed
|
UINT16 e_minalloc; ///< Minimum extra paragraphs needed
|
||||||
UINT16 e_maxalloc; // Maximum extra paragraphs needed
|
UINT16 e_maxalloc; ///< Maximum extra paragraphs needed
|
||||||
UINT16 e_ss; // Initial (relative) SS value
|
UINT16 e_ss; ///< Initial (relative) SS value
|
||||||
UINT16 e_sp; // Initial SP value
|
UINT16 e_sp; ///< Initial SP value
|
||||||
UINT16 e_csum; // Checksum
|
UINT16 e_csum; ///< Checksum
|
||||||
UINT16 e_ip; // Initial IP value
|
UINT16 e_ip; ///< Initial IP value
|
||||||
UINT16 e_cs; // Initial (relative) CS value
|
UINT16 e_cs; ///< Initial (relative) CS value
|
||||||
UINT16 e_lfarlc; // File address of relocation table
|
UINT16 e_lfarlc; ///< File address of relocation table
|
||||||
UINT16 e_ovno; // Overlay number
|
UINT16 e_ovno; ///< Overlay number
|
||||||
UINT16 e_res[4]; // Reserved words
|
UINT16 e_res[4]; ///< Reserved words
|
||||||
UINT16 e_oemid; // OEM identifier (for e_oeminfo)
|
UINT16 e_oemid; ///< OEM identifier (for e_oeminfo)
|
||||||
UINT16 e_oeminfo; // OEM information; e_oemid specific
|
UINT16 e_oeminfo; ///< OEM information; e_oemid specific
|
||||||
UINT16 e_res2[10]; // Reserved words
|
UINT16 e_res2[10]; ///< Reserved words
|
||||||
UINT32 e_lfanew; // File address of new exe header
|
UINT32 e_lfanew; ///< File address of new exe header
|
||||||
} EFI_IMAGE_DOS_HEADER;
|
} EFI_IMAGE_DOS_HEADER;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// File header format.
|
/// COFF File Header (Object and Image)
|
||||||
///
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT16 Machine;
|
UINT16 Machine;
|
||||||
|
@ -91,62 +95,63 @@ typedef struct {
|
||||||
UINT16 Characteristics;
|
UINT16 Characteristics;
|
||||||
} EFI_IMAGE_FILE_HEADER;
|
} EFI_IMAGE_FILE_HEADER;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Size of EFI_IMAGE_FILE_HEADER
|
||||||
|
///
|
||||||
#define EFI_IMAGE_SIZEOF_FILE_HEADER 20
|
#define EFI_IMAGE_SIZEOF_FILE_HEADER 20
|
||||||
|
|
||||||
#define EFI_IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file.
|
///
|
||||||
#define EFI_IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references).
|
/// Characteristics
|
||||||
#define EFI_IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file.
|
///
|
||||||
#define EFI_IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file.
|
#define EFI_IMAGE_FILE_RELOCS_STRIPPED BIT0 ///< 0x0001 Relocation info stripped from file.
|
||||||
#define EFI_IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed.
|
#define EFI_IMAGE_FILE_EXECUTABLE_IMAGE BIT1 ///< 0x0002 File is executable (i.e. no unresolved externel references).
|
||||||
#define EFI_IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine.
|
#define EFI_IMAGE_FILE_LINE_NUMS_STRIPPED BIT2 ///< 0x0004 Line nunbers stripped from file.
|
||||||
#define EFI_IMAGE_FILE_DEBUG_STRIPPED 0x0200 // Debugging info stripped from file in .DBG file
|
#define EFI_IMAGE_FILE_LOCAL_SYMS_STRIPPED BIT3 ///< 0x0008 Local symbols stripped from file.
|
||||||
#define EFI_IMAGE_FILE_SYSTEM 0x1000 // System File.
|
#define EFI_IMAGE_FILE_BYTES_REVERSED_LO BIT7 ///< 0x0080 Bytes of machine word are reversed.
|
||||||
#define EFI_IMAGE_FILE_DLL 0x2000 // File is a DLL.
|
#define EFI_IMAGE_FILE_32BIT_MACHINE BIT8 ///< 0x0100 32 bit word machine.
|
||||||
#define EFI_IMAGE_FILE_BYTES_REVERSED_HI 0x8000 // Bytes of machine word are reversed.
|
#define EFI_IMAGE_FILE_DEBUG_STRIPPED BIT9 ///< 0x0200 Debugging info stripped from file in .DBG file
|
||||||
#define EFI_IMAGE_FILE_MACHINE_UNKNOWN 0
|
#define EFI_IMAGE_FILE_SYSTEM BIT12 ///< 0x1000 System File.
|
||||||
#define EFI_IMAGE_FILE_MACHINE_I386 0x14c // Intel 386.
|
#define EFI_IMAGE_FILE_DLL BIT13 ///< 0x2000 File is a DLL.
|
||||||
#define EFI_IMAGE_FILE_MACHINE_R3000 0x162 // MIPS* little-endian, 0540 big-endian
|
#define EFI_IMAGE_FILE_BYTES_REVERSED_HI BIT15 ///< 0x8000 Bytes of machine word are reversed.
|
||||||
#define EFI_IMAGE_FILE_MACHINE_R4000 0x166 // MIPS* little-endian
|
|
||||||
#define EFI_IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP*
|
///
|
||||||
#define EFI_IMAGE_FILE_MACHINE_POWERPC 0x1F0 // IBM* PowerPC Little-Endian
|
/// Other Machine Types
|
||||||
#define EFI_IMAGE_FILE_MACHINE_TAHOE 0x7cc // Intel EM machine
|
///
|
||||||
|
#define EFI_IMAGE_FILE_MACHINE_UNKNOWN 0 ///< Any machine type
|
||||||
|
#define EFI_IMAGE_FILE_MACHINE_I386 0x14c ///< Intel 386.
|
||||||
|
#define EFI_IMAGE_FILE_MACHINE_R3000 0x162 ///< MIPS* little-endian, 0540 big-endian
|
||||||
|
#define EFI_IMAGE_FILE_MACHINE_R4000 0x166 ///< MIPS* little-endian
|
||||||
|
#define EFI_IMAGE_FILE_MACHINE_POWERPC 0x1F0 ///< IBM* PowerPC Little-Endian
|
||||||
//
|
//
|
||||||
// * Other names and brands may be claimed as the property of others.
|
// * Other names and brands may be claimed as the property of others.
|
||||||
//
|
//
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Directory format.
|
/// Header Data Directories
|
||||||
///
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT32 VirtualAddress;
|
UINT32 VirtualAddress;
|
||||||
UINT32 Size;
|
UINT32 Size;
|
||||||
} EFI_IMAGE_DATA_DIRECTORY;
|
} EFI_IMAGE_DATA_DIRECTORY;
|
||||||
|
|
||||||
#define EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES 16
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT16 Magic;
|
|
||||||
UINT8 MajorLinkerVersion;
|
|
||||||
UINT8 MinorLinkerVersion;
|
|
||||||
UINT32 SizeOfCode;
|
|
||||||
UINT32 SizeOfInitializedData;
|
|
||||||
UINT32 SizeOfUninitializedData;
|
|
||||||
UINT32 AddressOfEntryPoint;
|
|
||||||
UINT32 BaseOfCode;
|
|
||||||
UINT32 BaseOfData;
|
|
||||||
UINT32 BaseOfBss;
|
|
||||||
UINT32 GprMask;
|
|
||||||
UINT32 CprMask[4];
|
|
||||||
UINT32 GpValue;
|
|
||||||
} EFI_IMAGE_ROM_OPTIONAL_HEADER;
|
|
||||||
|
|
||||||
#define EFI_IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
|
#define EFI_IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
|
||||||
#define EFI_IMAGE_SIZEOF_ROM_OPTIONAL_HEADER sizeof (EFI_IMAGE_ROM_OPTIONAL_HEADER)
|
|
||||||
|
|
||||||
typedef struct {
|
///
|
||||||
EFI_IMAGE_FILE_HEADER FileHeader;
|
/// Directory Entries
|
||||||
EFI_IMAGE_ROM_OPTIONAL_HEADER OptionalHeader;
|
///
|
||||||
} EFI_IMAGE_ROM_HEADERS;
|
#define EFI_IMAGE_DIRECTORY_ENTRY_EXPORT 0
|
||||||
|
#define EFI_IMAGE_DIRECTORY_ENTRY_IMPORT 1
|
||||||
|
#define EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE 2
|
||||||
|
#define EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
|
||||||
|
#define EFI_IMAGE_DIRECTORY_ENTRY_SECURITY 4
|
||||||
|
#define EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC 5
|
||||||
|
#define EFI_IMAGE_DIRECTORY_ENTRY_DEBUG 6
|
||||||
|
#define EFI_IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
|
||||||
|
#define EFI_IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
|
||||||
|
#define EFI_IMAGE_DIRECTORY_ENTRY_TLS 9
|
||||||
|
#define EFI_IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
|
||||||
|
|
||||||
|
#define EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES 16
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @attention
|
/// @attention
|
||||||
|
@ -168,7 +173,7 @@ typedef struct {
|
||||||
UINT32 SizeOfUninitializedData;
|
UINT32 SizeOfUninitializedData;
|
||||||
UINT32 AddressOfEntryPoint;
|
UINT32 AddressOfEntryPoint;
|
||||||
UINT32 BaseOfCode;
|
UINT32 BaseOfCode;
|
||||||
UINT32 BaseOfData;
|
UINT32 BaseOfData; ///< PE32 contains this additional field, which is absent in PE32+
|
||||||
///
|
///
|
||||||
/// NT additional fields.
|
/// NT additional fields.
|
||||||
///
|
///
|
||||||
|
@ -266,11 +271,11 @@ typedef struct {
|
||||||
#define EFI_IMAGE_SIZEOF_NT_OPTIONAL64_HEADER sizeof (EFI_IMAGE_NT_HEADERS64)
|
#define EFI_IMAGE_SIZEOF_NT_OPTIONAL64_HEADER sizeof (EFI_IMAGE_NT_HEADERS64)
|
||||||
|
|
||||||
|
|
||||||
//
|
///
|
||||||
// Processor specific definition of EFI_IMAGE_OPTIONAL_HEADER so the
|
/// Processor specific definition of EFI_IMAGE_OPTIONAL_HEADER so the
|
||||||
// type name EFI_IMAGE_OPTIONAL_HEADER is appropriate to the build. Same for
|
/// type name EFI_IMAGE_OPTIONAL_HEADER is appropriate to the build. Same for
|
||||||
// EFI_IMAGE_NT_HEADERS. These definitions MUST be used by ALL EFI code.
|
/// EFI_IMAGE_NT_HEADERS. These definitions MUST be used by ALL EFI code.
|
||||||
//
|
///
|
||||||
#if defined (MDE_CPU_IA32)
|
#if defined (MDE_CPU_IA32)
|
||||||
|
|
||||||
#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
|
#define EFI_IMAGE_MACHINE_TYPE_SUPPORTED(Machine) \
|
||||||
|
@ -278,9 +283,6 @@ typedef struct {
|
||||||
|
|
||||||
#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_X64)
|
#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_X64)
|
||||||
|
|
||||||
//
|
|
||||||
// @bug - Remove me when other package updated.
|
|
||||||
//
|
|
||||||
typedef EFI_IMAGE_NT_HEADERS32 EFI_IMAGE_NT_HEADERS;
|
typedef EFI_IMAGE_NT_HEADERS32 EFI_IMAGE_NT_HEADERS;
|
||||||
|
|
||||||
#elif defined (MDE_CPU_IPF)
|
#elif defined (MDE_CPU_IPF)
|
||||||
|
@ -290,9 +292,6 @@ typedef EFI_IMAGE_NT_HEADERS32 EFI_IMAGE_NT_HEADERS;
|
||||||
|
|
||||||
#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
|
#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
|
||||||
|
|
||||||
//
|
|
||||||
// @bug - Remove me when other package updated.
|
|
||||||
//
|
|
||||||
typedef EFI_IMAGE_NT_HEADERS64 EFI_IMAGE_NT_HEADERS;
|
typedef EFI_IMAGE_NT_HEADERS64 EFI_IMAGE_NT_HEADERS;
|
||||||
|
|
||||||
#elif defined (MDE_CPU_X64)
|
#elif defined (MDE_CPU_X64)
|
||||||
|
@ -302,9 +301,6 @@ typedef EFI_IMAGE_NT_HEADERS64 EFI_IMAGE_NT_HEADERS;
|
||||||
|
|
||||||
#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_IA32)
|
#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) ((Machine) == EFI_IMAGE_MACHINE_IA32)
|
||||||
|
|
||||||
//
|
|
||||||
// @bug - Remove me when other package updated.
|
|
||||||
//
|
|
||||||
typedef EFI_IMAGE_NT_HEADERS64 EFI_IMAGE_NT_HEADERS;
|
typedef EFI_IMAGE_NT_HEADERS64 EFI_IMAGE_NT_HEADERS;
|
||||||
|
|
||||||
#elif defined (MDE_CPU_EBC)
|
#elif defined (MDE_CPU_EBC)
|
||||||
|
@ -318,9 +314,6 @@ typedef EFI_IMAGE_NT_HEADERS64 EFI_IMAGE_NT_HEADERS;
|
||||||
|
|
||||||
#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
|
#define EFI_IMAGE_MACHINE_CROSS_TYPE_SUPPORTED(Machine) (FALSE)
|
||||||
|
|
||||||
//
|
|
||||||
// @bug - Remove me when other package updated.
|
|
||||||
//
|
|
||||||
typedef EFI_IMAGE_NT_HEADERS64 EFI_IMAGE_NT_HEADERS;
|
typedef EFI_IMAGE_NT_HEADERS64 EFI_IMAGE_NT_HEADERS;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -338,34 +331,19 @@ typedef EFI_IMAGE_NT_HEADERS64 EFI_IMAGE_NT_HEADERS;
|
||||||
) \
|
) \
|
||||||
)
|
)
|
||||||
|
|
||||||
//
|
///
|
||||||
// Subsystem Values
|
/// Other Windows Subsystem Values
|
||||||
//
|
///
|
||||||
#define EFI_IMAGE_SUBSYSTEM_UNKNOWN 0
|
#define EFI_IMAGE_SUBSYSTEM_UNKNOWN 0
|
||||||
#define EFI_IMAGE_SUBSYSTEM_NATIVE 1
|
#define EFI_IMAGE_SUBSYSTEM_NATIVE 1
|
||||||
#define EFI_IMAGE_SUBSYSTEM_WINDOWS_GUI 2
|
#define EFI_IMAGE_SUBSYSTEM_WINDOWS_GUI 2
|
||||||
#define EFI_IMAGE_SUBSYSTEM_WINDOWS_CUI 3.
|
#define EFI_IMAGE_SUBSYSTEM_WINDOWS_CUI 3
|
||||||
#define EFI_IMAGE_SUBSYSTEM_OS2_CUI 5
|
#define EFI_IMAGE_SUBSYSTEM_OS2_CUI 5
|
||||||
#define EFI_IMAGE_SUBSYSTEM_POSIX_CUI 7
|
#define EFI_IMAGE_SUBSYSTEM_POSIX_CUI 7
|
||||||
|
|
||||||
//
|
///
|
||||||
// Directory Entries
|
/// Section header format.
|
||||||
//
|
///
|
||||||
#define EFI_IMAGE_DIRECTORY_ENTRY_EXPORT 0
|
|
||||||
#define EFI_IMAGE_DIRECTORY_ENTRY_IMPORT 1
|
|
||||||
#define EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE 2
|
|
||||||
#define EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
|
|
||||||
#define EFI_IMAGE_DIRECTORY_ENTRY_SECURITY 4
|
|
||||||
#define EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC 5
|
|
||||||
#define EFI_IMAGE_DIRECTORY_ENTRY_DEBUG 6
|
|
||||||
#define EFI_IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
|
|
||||||
#define EFI_IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
|
|
||||||
#define EFI_IMAGE_DIRECTORY_ENTRY_TLS 9
|
|
||||||
#define EFI_IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
|
|
||||||
|
|
||||||
//
|
|
||||||
// Section header format.
|
|
||||||
//
|
|
||||||
#define EFI_IMAGE_SIZEOF_SHORT_NAME 8
|
#define EFI_IMAGE_SIZEOF_SHORT_NAME 8
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -384,80 +362,85 @@ typedef struct {
|
||||||
UINT32 Characteristics;
|
UINT32 Characteristics;
|
||||||
} EFI_IMAGE_SECTION_HEADER;
|
} EFI_IMAGE_SECTION_HEADER;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Size of EFI_IMAGE_SECTION_HEADER
|
||||||
|
///
|
||||||
#define EFI_IMAGE_SIZEOF_SECTION_HEADER 40
|
#define EFI_IMAGE_SIZEOF_SECTION_HEADER 40
|
||||||
|
|
||||||
#define EFI_IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved.
|
///
|
||||||
#define EFI_IMAGE_SCN_CNT_CODE 0x00000020
|
/// Section Flags Values
|
||||||
#define EFI_IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
|
///
|
||||||
#define EFI_IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
|
#define EFI_IMAGE_SCN_TYPE_NO_PAD BIT3 ///< 0x00000008 ///< Reserved.
|
||||||
|
#define EFI_IMAGE_SCN_CNT_CODE BIT5 ///< 0x00000020
|
||||||
|
#define EFI_IMAGE_SCN_CNT_INITIALIZED_DATA BIT6 ///< 0x00000040
|
||||||
|
#define EFI_IMAGE_SCN_CNT_UNINITIALIZED_DATA BIT7 ///< 0x00000080
|
||||||
|
|
||||||
#define EFI_IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved.
|
#define EFI_IMAGE_SCN_LNK_OTHER BIT8 ///< 0x00000100 ///< Reserved.
|
||||||
#define EFI_IMAGE_SCN_LNK_INFO 0x00000200 // Section contains comments or some other type of information.
|
#define EFI_IMAGE_SCN_LNK_INFO BIT9 ///< 0x00000200 ///< Section contains comments or some other type of information.
|
||||||
#define EFI_IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents will not become part of image.
|
#define EFI_IMAGE_SCN_LNK_REMOVE BIT10 ///< 0x00000800 ///< Section contents will not become part of image.
|
||||||
#define EFI_IMAGE_SCN_LNK_COMDAT 0x00001000
|
#define EFI_IMAGE_SCN_LNK_COMDAT BIT12 ///< 0x00001000
|
||||||
|
|
||||||
#define EFI_IMAGE_SCN_ALIGN_1BYTES 0x00100000
|
#define EFI_IMAGE_SCN_ALIGN_1BYTES BIT20 ///< 0x00100000
|
||||||
#define EFI_IMAGE_SCN_ALIGN_2BYTES 0x00200000
|
#define EFI_IMAGE_SCN_ALIGN_2BYTES BIT21 ///< 0x00200000
|
||||||
#define EFI_IMAGE_SCN_ALIGN_4BYTES 0x00300000
|
#define EFI_IMAGE_SCN_ALIGN_4BYTES (BIT20|BIT21) ///< 0x00300000
|
||||||
#define EFI_IMAGE_SCN_ALIGN_8BYTES 0x00400000
|
#define EFI_IMAGE_SCN_ALIGN_8BYTES BIT22 ///< 0x00400000
|
||||||
#define EFI_IMAGE_SCN_ALIGN_16BYTES 0x00500000
|
#define EFI_IMAGE_SCN_ALIGN_16BYTES (BIT20|BIT22) ///< 0x00500000
|
||||||
#define EFI_IMAGE_SCN_ALIGN_32BYTES 0x00600000
|
#define EFI_IMAGE_SCN_ALIGN_32BYTES (BIT21|BIT22) ///< 0x00600000
|
||||||
#define EFI_IMAGE_SCN_ALIGN_64BYTES 0x00700000
|
#define EFI_IMAGE_SCN_ALIGN_64BYTES (BIT20|BIT21|BIT22) ///< 0x00700000
|
||||||
|
|
||||||
#define EFI_IMAGE_SCN_MEM_DISCARDABLE 0x02000000
|
#define EFI_IMAGE_SCN_MEM_DISCARDABLE BIT25 ///< 0x02000000
|
||||||
#define EFI_IMAGE_SCN_MEM_NOT_CACHED 0x04000000
|
#define EFI_IMAGE_SCN_MEM_NOT_CACHED BIT26 ///< 0x04000000
|
||||||
#define EFI_IMAGE_SCN_MEM_NOT_PAGED 0x08000000
|
#define EFI_IMAGE_SCN_MEM_NOT_PAGED BIT27 ///< 0x08000000
|
||||||
#define EFI_IMAGE_SCN_MEM_SHARED 0x10000000
|
#define EFI_IMAGE_SCN_MEM_SHARED BIT28 ///< 0x10000000
|
||||||
#define EFI_IMAGE_SCN_MEM_EXECUTE 0x20000000
|
#define EFI_IMAGE_SCN_MEM_EXECUTE BIT29 ///< 0x20000000
|
||||||
#define EFI_IMAGE_SCN_MEM_READ 0x40000000
|
#define EFI_IMAGE_SCN_MEM_READ BIT30 ///< 0x40000000
|
||||||
#define EFI_IMAGE_SCN_MEM_WRITE 0x80000000
|
#define EFI_IMAGE_SCN_MEM_WRITE BIT31 ///< 0x80000000
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Symbol format.
|
/// Size of a Symbol Table Record
|
||||||
///
|
///
|
||||||
#define EFI_IMAGE_SIZEOF_SYMBOL 18
|
#define EFI_IMAGE_SIZEOF_SYMBOL 18
|
||||||
|
|
||||||
//
|
///
|
||||||
// Section values.
|
/// Symbols have a section number of the section in which they are
|
||||||
//
|
/// defined. Otherwise, section numbers have the following meanings:
|
||||||
// Symbols have a section number of the section in which they are
|
///
|
||||||
// defined. Otherwise, section numbers have the following meanings:
|
#define EFI_IMAGE_SYM_UNDEFINED (UINT16) 0 ///< Symbol is undefined or is common.
|
||||||
//
|
#define EFI_IMAGE_SYM_ABSOLUTE (UINT16) -1 ///< Symbol is an absolute value.
|
||||||
#define EFI_IMAGE_SYM_UNDEFINED (UINT16) 0 // Symbol is undefined or is common.
|
#define EFI_IMAGE_SYM_DEBUG (UINT16) -2 ///< Symbol is a special debug item.
|
||||||
#define EFI_IMAGE_SYM_ABSOLUTE (UINT16) -1 // Symbol is an absolute value.
|
|
||||||
#define EFI_IMAGE_SYM_DEBUG (UINT16) -2 // Symbol is a special debug item.
|
///
|
||||||
//
|
/// Symbol Type (fundamental) values.
|
||||||
// Type (fundamental) values.
|
///
|
||||||
//
|
#define EFI_IMAGE_SYM_TYPE_NULL 0 ///< no type.
|
||||||
#define EFI_IMAGE_SYM_TYPE_NULL 0 // no type.
|
#define EFI_IMAGE_SYM_TYPE_VOID 1 ///< no valid type.
|
||||||
#define EFI_IMAGE_SYM_TYPE_VOID 1 //
|
#define EFI_IMAGE_SYM_TYPE_CHAR 2 ///< type character.
|
||||||
#define EFI_IMAGE_SYM_TYPE_CHAR 2 // type character.
|
#define EFI_IMAGE_SYM_TYPE_SHORT 3 ///< type short integer.
|
||||||
#define EFI_IMAGE_SYM_TYPE_SHORT 3 // type short integer.
|
|
||||||
#define EFI_IMAGE_SYM_TYPE_INT 4
|
#define EFI_IMAGE_SYM_TYPE_INT 4
|
||||||
#define EFI_IMAGE_SYM_TYPE_LONG 5
|
#define EFI_IMAGE_SYM_TYPE_LONG 5
|
||||||
#define EFI_IMAGE_SYM_TYPE_FLOAT 6
|
#define EFI_IMAGE_SYM_TYPE_FLOAT 6
|
||||||
#define EFI_IMAGE_SYM_TYPE_DOUBLE 7
|
#define EFI_IMAGE_SYM_TYPE_DOUBLE 7
|
||||||
#define EFI_IMAGE_SYM_TYPE_STRUCT 8
|
#define EFI_IMAGE_SYM_TYPE_STRUCT 8
|
||||||
#define EFI_IMAGE_SYM_TYPE_UNION 9
|
#define EFI_IMAGE_SYM_TYPE_UNION 9
|
||||||
#define EFI_IMAGE_SYM_TYPE_ENUM 10 // enumeration.
|
#define EFI_IMAGE_SYM_TYPE_ENUM 10 ///< enumeration.
|
||||||
#define EFI_IMAGE_SYM_TYPE_MOE 11 // member of enumeration.
|
#define EFI_IMAGE_SYM_TYPE_MOE 11 ///< member of enumeration.
|
||||||
#define EFI_IMAGE_SYM_TYPE_BYTE 12
|
#define EFI_IMAGE_SYM_TYPE_BYTE 12
|
||||||
#define EFI_IMAGE_SYM_TYPE_WORD 13
|
#define EFI_IMAGE_SYM_TYPE_WORD 13
|
||||||
#define EFI_IMAGE_SYM_TYPE_UINT 14
|
#define EFI_IMAGE_SYM_TYPE_UINT 14
|
||||||
#define EFI_IMAGE_SYM_TYPE_DWORD 15
|
#define EFI_IMAGE_SYM_TYPE_DWORD 15
|
||||||
|
|
||||||
//
|
///
|
||||||
// Type (derived) values.
|
/// Symbol Type (derived) values.
|
||||||
//
|
///
|
||||||
#define EFI_IMAGE_SYM_DTYPE_NULL 0 // no derived type.
|
#define EFI_IMAGE_SYM_DTYPE_NULL 0 ///< no derived type.
|
||||||
#define EFI_IMAGE_SYM_DTYPE_POINTER 1
|
#define EFI_IMAGE_SYM_DTYPE_POINTER 1
|
||||||
#define EFI_IMAGE_SYM_DTYPE_FUNCTION 2
|
#define EFI_IMAGE_SYM_DTYPE_FUNCTION 2
|
||||||
#define EFI_IMAGE_SYM_DTYPE_ARRAY 3
|
#define EFI_IMAGE_SYM_DTYPE_ARRAY 3
|
||||||
|
|
||||||
//
|
///
|
||||||
// Storage classes.
|
/// Storage classes.
|
||||||
//
|
///
|
||||||
#define EFI_IMAGE_SYM_CLASS_END_OF_FUNCTION (UINT8) -1
|
#define EFI_IMAGE_SYM_CLASS_END_OF_FUNCTION ((UINT8) -1)
|
||||||
#define EFI_IMAGE_SYM_CLASS_NULL 0
|
#define EFI_IMAGE_SYM_CLASS_NULL 0
|
||||||
#define EFI_IMAGE_SYM_CLASS_AUTOMATIC 1
|
#define EFI_IMAGE_SYM_CLASS_AUTOMATIC 1
|
||||||
#define EFI_IMAGE_SYM_CLASS_EXTERNAL 2
|
#define EFI_IMAGE_SYM_CLASS_EXTERNAL 2
|
||||||
|
@ -494,15 +477,18 @@ typedef struct {
|
||||||
#define EFI_IMAGE_N_BTSHFT 4
|
#define EFI_IMAGE_N_BTSHFT 4
|
||||||
#define EFI_IMAGE_N_TSHIFT 2
|
#define EFI_IMAGE_N_TSHIFT 2
|
||||||
|
|
||||||
//
|
///
|
||||||
// Communal selection types.
|
/// Communal selection types.
|
||||||
//
|
///
|
||||||
#define EFI_IMAGE_COMDAT_SELECT_NODUPLICATES 1
|
#define EFI_IMAGE_COMDAT_SELECT_NODUPLICATES 1
|
||||||
#define EFI_IMAGE_COMDAT_SELECT_ANY 2
|
#define EFI_IMAGE_COMDAT_SELECT_ANY 2
|
||||||
#define EFI_IMAGE_COMDAT_SELECT_SAME_SIZE 3
|
#define EFI_IMAGE_COMDAT_SELECT_SAME_SIZE 3
|
||||||
#define EFI_IMAGE_COMDAT_SELECT_EXACT_MATCH 4
|
#define EFI_IMAGE_COMDAT_SELECT_EXACT_MATCH 4
|
||||||
#define EFI_IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
|
#define EFI_IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
|
||||||
|
|
||||||
|
///
|
||||||
|
/// the following values only be referred in PeCoff, not defined in PECOFF.
|
||||||
|
///
|
||||||
#define EFI_IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
|
#define EFI_IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
|
||||||
#define EFI_IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
|
#define EFI_IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
|
||||||
#define EFI_IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
|
#define EFI_IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
|
||||||
|
@ -516,24 +502,27 @@ typedef struct {
|
||||||
UINT16 Type;
|
UINT16 Type;
|
||||||
} EFI_IMAGE_RELOCATION;
|
} EFI_IMAGE_RELOCATION;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Size of EFI_IMAGE_RELOCATION
|
||||||
|
///
|
||||||
#define EFI_IMAGE_SIZEOF_RELOCATION 10
|
#define EFI_IMAGE_SIZEOF_RELOCATION 10
|
||||||
|
|
||||||
//
|
///
|
||||||
// I386 relocation types.
|
/// I386 relocation types.
|
||||||
//
|
///
|
||||||
#define EFI_IMAGE_REL_I386_ABSOLUTE 0x0000 // Reference is absolute, no relocation is necessary
|
#define EFI_IMAGE_REL_I386_ABSOLUTE 0x0000 ///< Reference is absolute, no relocation is necessary
|
||||||
#define EFI_IMAGE_REL_I386_DIR16 0x0001 // Direct 16-bit reference to the symbols virtual address
|
#define EFI_IMAGE_REL_I386_DIR16 0x0001 ///< Direct 16-bit reference to the symbols virtual address
|
||||||
#define EFI_IMAGE_REL_I386_REL16 0x0002 // PC-relative 16-bit reference to the symbols virtual address
|
#define EFI_IMAGE_REL_I386_REL16 0x0002 ///< PC-relative 16-bit reference to the symbols virtual address
|
||||||
#define EFI_IMAGE_REL_I386_DIR32 0x0006 // Direct 32-bit reference to the symbols virtual address
|
#define EFI_IMAGE_REL_I386_DIR32 0x0006 ///< Direct 32-bit reference to the symbols virtual address
|
||||||
#define EFI_IMAGE_REL_I386_DIR32NB 0x0007 // Direct 32-bit reference to the symbols virtual address, base not included
|
#define EFI_IMAGE_REL_I386_DIR32NB 0x0007 ///< Direct 32-bit reference to the symbols virtual address, base not included
|
||||||
#define EFI_IMAGE_REL_I386_SEG12 0x0009 // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address
|
#define EFI_IMAGE_REL_I386_SEG12 0x0009 ///< Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address
|
||||||
#define EFI_IMAGE_REL_I386_SECTION 0x001a
|
#define EFI_IMAGE_REL_I386_SECTION 0x000A
|
||||||
#define EFI_IMAGE_REL_I386_SECREL 0x000b
|
#define EFI_IMAGE_REL_I386_SECREL 0x000B
|
||||||
#define EFI_IMAGE_REL_I386_REL32 0x0014 // PC-relative 32-bit reference to the symbols virtual address
|
#define EFI_IMAGE_REL_I386_REL32 0x0014 ///< PC-relative 32-bit reference to the symbols virtual address
|
||||||
|
|
||||||
//
|
///
|
||||||
// x64 processor relocation types.
|
/// x64 processor relocation types.
|
||||||
//
|
///
|
||||||
#define IMAGE_REL_AMD64_ABSOLUTE 0x0000
|
#define IMAGE_REL_AMD64_ABSOLUTE 0x0000
|
||||||
#define IMAGE_REL_AMD64_ADDR64 0x0001
|
#define IMAGE_REL_AMD64_ADDR64 0x0001
|
||||||
#define IMAGE_REL_AMD64_ADDR32 0x0002
|
#define IMAGE_REL_AMD64_ADDR32 0x0002
|
||||||
|
@ -560,11 +549,14 @@ typedef struct {
|
||||||
UINT32 SizeOfBlock;
|
UINT32 SizeOfBlock;
|
||||||
} EFI_IMAGE_BASE_RELOCATION;
|
} EFI_IMAGE_BASE_RELOCATION;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Size of EFI_IMAGE_BASE_RELOCATION
|
||||||
|
///
|
||||||
#define EFI_IMAGE_SIZEOF_BASE_RELOCATION 8
|
#define EFI_IMAGE_SIZEOF_BASE_RELOCATION 8
|
||||||
|
|
||||||
//
|
///
|
||||||
// Based relocation types.
|
/// Based relocation types.
|
||||||
//
|
///
|
||||||
#define EFI_IMAGE_REL_BASED_ABSOLUTE 0
|
#define EFI_IMAGE_REL_BASED_ABSOLUTE 0
|
||||||
#define EFI_IMAGE_REL_BASED_HIGH 1
|
#define EFI_IMAGE_REL_BASED_HIGH 1
|
||||||
#define EFI_IMAGE_REL_BASED_LOW 2
|
#define EFI_IMAGE_REL_BASED_LOW 2
|
||||||
|
@ -572,6 +564,7 @@ typedef struct {
|
||||||
#define EFI_IMAGE_REL_BASED_HIGHADJ 4
|
#define EFI_IMAGE_REL_BASED_HIGHADJ 4
|
||||||
#define EFI_IMAGE_REL_BASED_MIPS_JMPADDR 5
|
#define EFI_IMAGE_REL_BASED_MIPS_JMPADDR 5
|
||||||
#define EFI_IMAGE_REL_BASED_IA64_IMM64 9
|
#define EFI_IMAGE_REL_BASED_IA64_IMM64 9
|
||||||
|
#define IMAGE_REL_BASED_MIPS_JMPADDR16 9
|
||||||
#define EFI_IMAGE_REL_BASED_DIR64 10
|
#define EFI_IMAGE_REL_BASED_DIR64 10
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@ -585,11 +578,14 @@ typedef struct {
|
||||||
UINT16 Linenumber; // Line number.
|
UINT16 Linenumber; // Line number.
|
||||||
} EFI_IMAGE_LINENUMBER;
|
} EFI_IMAGE_LINENUMBER;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Size of EFI_IMAGE_LINENUMBER
|
||||||
|
///
|
||||||
#define EFI_IMAGE_SIZEOF_LINENUMBER 6
|
#define EFI_IMAGE_SIZEOF_LINENUMBER 6
|
||||||
|
|
||||||
//
|
///
|
||||||
// Archive format.
|
/// Archive format.
|
||||||
//
|
///
|
||||||
#define EFI_IMAGE_ARCHIVE_START_SIZE 8
|
#define EFI_IMAGE_ARCHIVE_START_SIZE 8
|
||||||
#define EFI_IMAGE_ARCHIVE_START "!<arch>\n"
|
#define EFI_IMAGE_ARCHIVE_START "!<arch>\n"
|
||||||
#define EFI_IMAGE_ARCHIVE_END "`\n"
|
#define EFI_IMAGE_ARCHIVE_END "`\n"
|
||||||
|
@ -598,23 +594,27 @@ typedef struct {
|
||||||
#define EFI_IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
|
#define EFI_IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT8 Name[16]; // File member name - `/' terminated.
|
UINT8 Name[16]; ///< File member name - `/' terminated.
|
||||||
UINT8 Date[12]; // File member date - decimal.
|
UINT8 Date[12]; ///< File member date - decimal.
|
||||||
UINT8 UserID[6]; // File member user id - decimal.
|
UINT8 UserID[6]; ///< File member user id - decimal.
|
||||||
UINT8 GroupID[6]; // File member group id - decimal.
|
UINT8 GroupID[6]; ///< File member group id - decimal.
|
||||||
UINT8 Mode[8]; // File member mode - octal.
|
UINT8 Mode[8]; ///< File member mode - octal.
|
||||||
UINT8 Size[10]; // File member size - decimal.
|
UINT8 Size[10]; ///< File member size - decimal.
|
||||||
UINT8 EndHeader[2]; // String to end header.
|
UINT8 EndHeader[2]; ///< String to end header. (0x60 0x0A)
|
||||||
} EFI_IMAGE_ARCHIVE_MEMBER_HEADER;
|
} EFI_IMAGE_ARCHIVE_MEMBER_HEADER;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Size of EFI_IMAGE_ARCHIVE_MEMBER_HEADER
|
||||||
|
///
|
||||||
#define EFI_IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
|
#define EFI_IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
|
||||||
|
|
||||||
//
|
|
||||||
// DLL support.
|
|
||||||
//
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// DLL Export Format
|
/// DLL Support
|
||||||
|
///
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Export Directory Table
|
||||||
///
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT32 Characteristics;
|
UINT32 Characteristics;
|
||||||
|
@ -631,8 +631,7 @@ typedef struct {
|
||||||
} EFI_IMAGE_EXPORT_DIRECTORY;
|
} EFI_IMAGE_EXPORT_DIRECTORY;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// DLL support.
|
/// Hint/Name Table
|
||||||
/// Import Format
|
|
||||||
///
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT16 Hint;
|
UINT16 Hint;
|
||||||
|
@ -647,10 +646,13 @@ typedef struct {
|
||||||
} u1;
|
} u1;
|
||||||
} EFI_IMAGE_THUNK_DATA;
|
} EFI_IMAGE_THUNK_DATA;
|
||||||
|
|
||||||
#define EFI_IMAGE_ORDINAL_FLAG 0x80000000
|
#define EFI_IMAGE_ORDINAL_FLAG BIT31 ///< Flag for PE32
|
||||||
#define EFI_IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & EFI_IMAGE_ORDINAL_FLAG) != 0)
|
#define EFI_IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & EFI_IMAGE_ORDINAL_FLAG) != 0)
|
||||||
#define EFI_IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
|
#define EFI_IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Import Directory Table
|
||||||
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT32 Characteristics;
|
UINT32 Characteristics;
|
||||||
UINT32 TimeDateStamp;
|
UINT32 TimeDateStamp;
|
||||||
|
@ -659,11 +661,10 @@ typedef struct {
|
||||||
EFI_IMAGE_THUNK_DATA *FirstThunk;
|
EFI_IMAGE_THUNK_DATA *FirstThunk;
|
||||||
} EFI_IMAGE_IMPORT_DESCRIPTOR;
|
} EFI_IMAGE_IMPORT_DESCRIPTOR;
|
||||||
|
|
||||||
///
|
|
||||||
/// Debug Format
|
|
||||||
///
|
|
||||||
#define EFI_IMAGE_DEBUG_TYPE_CODEVIEW 2
|
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Debug Direcotry Format
|
||||||
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT32 Characteristics;
|
UINT32 Characteristics;
|
||||||
UINT32 TimeDateStamp;
|
UINT32 TimeDateStamp;
|
||||||
|
@ -671,13 +672,18 @@ typedef struct {
|
||||||
UINT16 MinorVersion;
|
UINT16 MinorVersion;
|
||||||
UINT32 Type;
|
UINT32 Type;
|
||||||
UINT32 SizeOfData;
|
UINT32 SizeOfData;
|
||||||
UINT32 RVA;
|
UINT32 RVA; ///< The address of the debug data when loaded, relative to the image base
|
||||||
UINT32 FileOffset;
|
UINT32 FileOffset; ///< The file pointer to the debug data
|
||||||
} EFI_IMAGE_DEBUG_DIRECTORY_ENTRY;
|
} EFI_IMAGE_DEBUG_DIRECTORY_ENTRY;
|
||||||
|
|
||||||
|
#define EFI_IMAGE_DEBUG_TYPE_CODEVIEW 2 ///< The Visual C++ debug information
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Debug Data Structure defined in Microsoft C++
|
||||||
|
///
|
||||||
#define CODEVIEW_SIGNATURE_NB10 0x3031424E // "NB10"
|
#define CODEVIEW_SIGNATURE_NB10 0x3031424E // "NB10"
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT32 Signature; // "NB10"
|
UINT32 Signature; ///< "NB10"
|
||||||
UINT32 Unknown;
|
UINT32 Unknown;
|
||||||
UINT32 Unknown2;
|
UINT32 Unknown2;
|
||||||
UINT32 Unknown3;
|
UINT32 Unknown3;
|
||||||
|
@ -686,9 +692,12 @@ typedef struct {
|
||||||
//
|
//
|
||||||
} EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY;
|
} EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY;
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Debug Data Structure defined in Microsoft C++
|
||||||
|
///
|
||||||
#define CODEVIEW_SIGNATURE_RSDS 0x53445352 // "RSDS"
|
#define CODEVIEW_SIGNATURE_RSDS 0x53445352 // "RSDS"
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT32 Signature; // "RSDS"
|
UINT32 Signature; ///< "RSDS"
|
||||||
UINT32 Unknown;
|
UINT32 Unknown;
|
||||||
UINT32 Unknown2;
|
UINT32 Unknown2;
|
||||||
UINT32 Unknown3;
|
UINT32 Unknown3;
|
||||||
|
@ -700,21 +709,22 @@ typedef struct {
|
||||||
} EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY;
|
} EFI_IMAGE_DEBUG_CODEVIEW_RSDS_ENTRY;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Header format for TE images
|
/// Header format for TE images, defined in PI Specification, 1.0
|
||||||
///
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT16 Signature; // signature for TE format = "VZ"
|
UINT16 Signature; ///< signature for TE format = "VZ"
|
||||||
UINT16 Machine; // from the original file header
|
UINT16 Machine; ///< from the original file header
|
||||||
UINT8 NumberOfSections; // from the original file header
|
UINT8 NumberOfSections; ///< from the original file header
|
||||||
UINT8 Subsystem; // from original optional header
|
UINT8 Subsystem; ///< from original optional header
|
||||||
UINT16 StrippedSize; // how many bytes we removed from the header
|
UINT16 StrippedSize; ///< how many bytes we removed from the header
|
||||||
UINT32 AddressOfEntryPoint; // offset to entry point -- from original optional header
|
UINT32 AddressOfEntryPoint; ///< offset to entry point -- from original optional header
|
||||||
UINT32 BaseOfCode; // from original image -- required for ITP debug
|
UINT32 BaseOfCode; ///< from original image -- required for ITP debug
|
||||||
UINT64 ImageBase; // from original file header
|
UINT64 ImageBase; ///< from original file header
|
||||||
EFI_IMAGE_DATA_DIRECTORY DataDirectory[2]; // only base relocation and debug directory
|
EFI_IMAGE_DATA_DIRECTORY DataDirectory[2]; ///< only base relocation and debug directory
|
||||||
} EFI_TE_IMAGE_HEADER;
|
} EFI_TE_IMAGE_HEADER;
|
||||||
|
|
||||||
#define EFI_TE_IMAGE_HEADER_SIGNATURE 0x5A56 // "VZ"
|
|
||||||
|
#define EFI_TE_IMAGE_HEADER_SIGNATURE 0x5A56 ///< "VZ"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Data directory indexes in our TE image header
|
// Data directory indexes in our TE image header
|
||||||
|
|
Loading…
Reference in New Issue