TianoCore EDK2 master
Loading...
Searching...
No Matches
PeImage.h
Go to the documentation of this file.
1
19#ifndef __PE_IMAGE_H__
20#define __PE_IMAGE_H__
21
22//
23// PE32+ Subsystem type for EFI images
24//
25#define EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION 10
26#define EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
27#define EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
28#define EFI_IMAGE_SUBSYSTEM_SAL_RUNTIME_DRIVER 13
29
30//
31// PE32+ Machine type for EFI images
32//
33#define IMAGE_FILE_MACHINE_I386 0x014c
34#define IMAGE_FILE_MACHINE_IA64 0x0200
35#define IMAGE_FILE_MACHINE_EBC 0x0EBC
36#define IMAGE_FILE_MACHINE_X64 0x8664
37#define IMAGE_FILE_MACHINE_ARMTHUMB_MIXED 0x01c2
38#define IMAGE_FILE_MACHINE_ARM64 0xAA64
39#define IMAGE_FILE_MACHINE_RISCV32 0x5032
40#define IMAGE_FILE_MACHINE_RISCV64 0x5064
41#define IMAGE_FILE_MACHINE_RISCV128 0x5128
42#define IMAGE_FILE_MACHINE_LOONGARCH32 0x6232
43#define IMAGE_FILE_MACHINE_LOONGARCH64 0x6264
44
45//
46// EXE file formats
47//
48#define EFI_IMAGE_DOS_SIGNATURE SIGNATURE_16('M', 'Z')
49#define EFI_IMAGE_OS2_SIGNATURE SIGNATURE_16('N', 'E')
50#define EFI_IMAGE_OS2_SIGNATURE_LE SIGNATURE_16('L', 'E')
51#define EFI_IMAGE_NT_SIGNATURE SIGNATURE_32('P', 'E', '\0', '\0')
52
57typedef struct {
58 UINT16 e_magic;
59 UINT16 e_cblp;
60 UINT16 e_cp;
61 UINT16 e_crlc;
62 UINT16 e_cparhdr;
63 UINT16 e_minalloc;
64 UINT16 e_maxalloc;
65 UINT16 e_ss;
66 UINT16 e_sp;
67 UINT16 e_csum;
68 UINT16 e_ip;
69 UINT16 e_cs;
70 UINT16 e_lfarlc;
71 UINT16 e_ovno;
72 UINT16 e_res[4];
73 UINT16 e_oemid;
74 UINT16 e_oeminfo;
75 UINT16 e_res2[10];
76 UINT32 e_lfanew;
78
82typedef struct {
83 UINT16 Machine;
84 UINT16 NumberOfSections;
85 UINT32 TimeDateStamp;
86 UINT32 PointerToSymbolTable;
87 UINT32 NumberOfSymbols;
88 UINT16 SizeOfOptionalHeader;
89 UINT16 Characteristics;
91
95#define EFI_IMAGE_SIZEOF_FILE_HEADER 20
96
97//
98// Characteristics
99//
100#define EFI_IMAGE_FILE_RELOCS_STRIPPED BIT0
101#define EFI_IMAGE_FILE_EXECUTABLE_IMAGE BIT1
102#define EFI_IMAGE_FILE_LINE_NUMS_STRIPPED BIT2
103#define EFI_IMAGE_FILE_LOCAL_SYMS_STRIPPED BIT3
104#define EFI_IMAGE_FILE_LARGE_ADDRESS_AWARE BIT5
105#define EFI_IMAGE_FILE_BYTES_REVERSED_LO BIT7
106#define EFI_IMAGE_FILE_32BIT_MACHINE BIT8
107#define EFI_IMAGE_FILE_DEBUG_STRIPPED BIT9
108#define EFI_IMAGE_FILE_SYSTEM BIT12
109#define EFI_IMAGE_FILE_DLL BIT13
110#define EFI_IMAGE_FILE_BYTES_REVERSED_HI BIT15
111
115typedef struct {
116 UINT32 VirtualAddress;
117 UINT32 Size;
119
120//
121// Directory Entries
122//
123#define EFI_IMAGE_DIRECTORY_ENTRY_EXPORT 0
124#define EFI_IMAGE_DIRECTORY_ENTRY_IMPORT 1
125#define EFI_IMAGE_DIRECTORY_ENTRY_RESOURCE 2
126#define EFI_IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
127#define EFI_IMAGE_DIRECTORY_ENTRY_SECURITY 4
128#define EFI_IMAGE_DIRECTORY_ENTRY_BASERELOC 5
129#define EFI_IMAGE_DIRECTORY_ENTRY_DEBUG 6
130#define EFI_IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
131#define EFI_IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
132#define EFI_IMAGE_DIRECTORY_ENTRY_TLS 9
133#define EFI_IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
134
135#define EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES 16
136
143#define EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
144
148typedef struct {
152 UINT16 Magic;
153 UINT8 MajorLinkerVersion;
154 UINT8 MinorLinkerVersion;
155 UINT32 SizeOfCode;
156 UINT32 SizeOfInitializedData;
157 UINT32 SizeOfUninitializedData;
158 UINT32 AddressOfEntryPoint;
159 UINT32 BaseOfCode;
160 UINT32 BaseOfData;
164 UINT32 ImageBase;
165 UINT32 SectionAlignment;
166 UINT32 FileAlignment;
167 UINT16 MajorOperatingSystemVersion;
168 UINT16 MinorOperatingSystemVersion;
169 UINT16 MajorImageVersion;
170 UINT16 MinorImageVersion;
171 UINT16 MajorSubsystemVersion;
172 UINT16 MinorSubsystemVersion;
173 UINT32 Win32VersionValue;
174 UINT32 SizeOfImage;
175 UINT32 SizeOfHeaders;
176 UINT32 CheckSum;
177 UINT16 Subsystem;
178 UINT16 DllCharacteristics;
179 UINT32 SizeOfStackReserve;
180 UINT32 SizeOfStackCommit;
181 UINT32 SizeOfHeapReserve;
182 UINT32 SizeOfHeapCommit;
183 UINT32 LoaderFlags;
184 UINT32 NumberOfRvaAndSizes;
185 EFI_IMAGE_DATA_DIRECTORY DataDirectory[EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES];
187
194#define EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
195
199typedef struct {
203 UINT16 Magic;
204 UINT8 MajorLinkerVersion;
205 UINT8 MinorLinkerVersion;
206 UINT32 SizeOfCode;
207 UINT32 SizeOfInitializedData;
208 UINT32 SizeOfUninitializedData;
209 UINT32 AddressOfEntryPoint;
210 UINT32 BaseOfCode;
214 UINT64 ImageBase;
215 UINT32 SectionAlignment;
216 UINT32 FileAlignment;
217 UINT16 MajorOperatingSystemVersion;
218 UINT16 MinorOperatingSystemVersion;
219 UINT16 MajorImageVersion;
220 UINT16 MinorImageVersion;
221 UINT16 MajorSubsystemVersion;
222 UINT16 MinorSubsystemVersion;
223 UINT32 Win32VersionValue;
224 UINT32 SizeOfImage;
225 UINT32 SizeOfHeaders;
226 UINT32 CheckSum;
227 UINT16 Subsystem;
228 UINT16 DllCharacteristics;
229 UINT64 SizeOfStackReserve;
230 UINT64 SizeOfStackCommit;
231 UINT64 SizeOfHeapReserve;
232 UINT64 SizeOfHeapCommit;
233 UINT32 LoaderFlags;
234 UINT32 NumberOfRvaAndSizes;
235 EFI_IMAGE_DATA_DIRECTORY DataDirectory[EFI_IMAGE_NUMBER_OF_DIRECTORY_ENTRIES];
237
242typedef struct {
243 UINT32 Signature;
244 EFI_IMAGE_FILE_HEADER FileHeader;
245 EFI_IMAGE_OPTIONAL_HEADER32 OptionalHeader;
247
248#define EFI_IMAGE_SIZEOF_NT_OPTIONAL32_HEADER sizeof (EFI_IMAGE_NT_HEADERS32)
249
254typedef struct {
255 UINT32 Signature;
256 EFI_IMAGE_FILE_HEADER FileHeader;
257 EFI_IMAGE_OPTIONAL_HEADER64 OptionalHeader;
259
260#define EFI_IMAGE_SIZEOF_NT_OPTIONAL64_HEADER sizeof (EFI_IMAGE_NT_HEADERS64)
261
262//
263// Other Windows Subsystem Values
264//
265#define EFI_IMAGE_SUBSYSTEM_UNKNOWN 0
266#define EFI_IMAGE_SUBSYSTEM_NATIVE 1
267#define EFI_IMAGE_SUBSYSTEM_WINDOWS_GUI 2
268#define EFI_IMAGE_SUBSYSTEM_WINDOWS_CUI 3
269#define EFI_IMAGE_SUBSYSTEM_OS2_CUI 5
270#define EFI_IMAGE_SUBSYSTEM_POSIX_CUI 7
271
272//
273// DLL Characteristics
274//
275#define IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA 0x0020
276#define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
277#define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
278#define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
279#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
280#define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
281#define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
282#define IMAGE_DLLCHARACTERISTICS_APPCONTAINER 0x1000
283#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
284#define IMAGE_DLLCHARACTERISTICS_GUARD_CF 0x4000
285#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
286
290#define EFI_IMAGE_SIZEOF_SHORT_NAME 8
291
295typedef struct {
296 UINT8 Name[EFI_IMAGE_SIZEOF_SHORT_NAME];
297 union {
298 UINT32 PhysicalAddress;
299 UINT32 VirtualSize;
300 } Misc;
301 UINT32 VirtualAddress;
302 UINT32 SizeOfRawData;
303 UINT32 PointerToRawData;
304 UINT32 PointerToRelocations;
305 UINT32 PointerToLinenumbers;
306 UINT16 NumberOfRelocations;
307 UINT16 NumberOfLinenumbers;
308 UINT32 Characteristics;
310
314#define EFI_IMAGE_SIZEOF_SECTION_HEADER 40
315
316//
317// Section Flags Values
318//
319#define EFI_IMAGE_SCN_TYPE_NO_PAD BIT3
320#define EFI_IMAGE_SCN_CNT_CODE BIT5
321#define EFI_IMAGE_SCN_CNT_INITIALIZED_DATA BIT6
322#define EFI_IMAGE_SCN_CNT_UNINITIALIZED_DATA BIT7
323
324#define EFI_IMAGE_SCN_LNK_OTHER BIT8
325#define EFI_IMAGE_SCN_LNK_INFO BIT9
326#define EFI_IMAGE_SCN_LNK_REMOVE BIT11
327#define EFI_IMAGE_SCN_LNK_COMDAT BIT12
328
329#define EFI_IMAGE_SCN_ALIGN_1BYTES BIT20
330#define EFI_IMAGE_SCN_ALIGN_2BYTES BIT21
331#define EFI_IMAGE_SCN_ALIGN_4BYTES (BIT20|BIT21)
332#define EFI_IMAGE_SCN_ALIGN_8BYTES BIT22
333#define EFI_IMAGE_SCN_ALIGN_16BYTES (BIT20|BIT22)
334#define EFI_IMAGE_SCN_ALIGN_32BYTES (BIT21|BIT22)
335#define EFI_IMAGE_SCN_ALIGN_64BYTES (BIT20|BIT21|BIT22)
336
337#define EFI_IMAGE_SCN_MEM_DISCARDABLE BIT25
338#define EFI_IMAGE_SCN_MEM_NOT_CACHED BIT26
339#define EFI_IMAGE_SCN_MEM_NOT_PAGED BIT27
340#define EFI_IMAGE_SCN_MEM_SHARED BIT28
341#define EFI_IMAGE_SCN_MEM_EXECUTE BIT29
342#define EFI_IMAGE_SCN_MEM_READ BIT30
343#define EFI_IMAGE_SCN_MEM_WRITE BIT31
344
348#define EFI_IMAGE_SIZEOF_SYMBOL 18
349
350//
351// Symbols have a section number of the section in which they are
352// defined. Otherwise, section numbers have the following meanings:
353//
354#define EFI_IMAGE_SYM_UNDEFINED (UINT16) 0
355#define EFI_IMAGE_SYM_ABSOLUTE (UINT16) -1
356#define EFI_IMAGE_SYM_DEBUG (UINT16) -2
357
358//
359// Symbol Type (fundamental) values.
360//
361#define EFI_IMAGE_SYM_TYPE_NULL 0
362#define EFI_IMAGE_SYM_TYPE_VOID 1
363#define EFI_IMAGE_SYM_TYPE_CHAR 2
364#define EFI_IMAGE_SYM_TYPE_SHORT 3
365#define EFI_IMAGE_SYM_TYPE_INT 4
366#define EFI_IMAGE_SYM_TYPE_LONG 5
367#define EFI_IMAGE_SYM_TYPE_FLOAT 6
368#define EFI_IMAGE_SYM_TYPE_DOUBLE 7
369#define EFI_IMAGE_SYM_TYPE_STRUCT 8
370#define EFI_IMAGE_SYM_TYPE_UNION 9
371#define EFI_IMAGE_SYM_TYPE_ENUM 10
372#define EFI_IMAGE_SYM_TYPE_MOE 11
373#define EFI_IMAGE_SYM_TYPE_BYTE 12
374#define EFI_IMAGE_SYM_TYPE_WORD 13
375#define EFI_IMAGE_SYM_TYPE_UINT 14
376#define EFI_IMAGE_SYM_TYPE_DWORD 15
377
378//
379// Symbol Type (derived) values.
380//
381#define EFI_IMAGE_SYM_DTYPE_NULL 0
382#define EFI_IMAGE_SYM_DTYPE_POINTER 1
383#define EFI_IMAGE_SYM_DTYPE_FUNCTION 2
384#define EFI_IMAGE_SYM_DTYPE_ARRAY 3
385
386//
387// Storage classes.
388//
389#define EFI_IMAGE_SYM_CLASS_END_OF_FUNCTION ((UINT8) -1)
390#define EFI_IMAGE_SYM_CLASS_NULL 0
391#define EFI_IMAGE_SYM_CLASS_AUTOMATIC 1
392#define EFI_IMAGE_SYM_CLASS_EXTERNAL 2
393#define EFI_IMAGE_SYM_CLASS_STATIC 3
394#define EFI_IMAGE_SYM_CLASS_REGISTER 4
395#define EFI_IMAGE_SYM_CLASS_EXTERNAL_DEF 5
396#define EFI_IMAGE_SYM_CLASS_LABEL 6
397#define EFI_IMAGE_SYM_CLASS_UNDEFINED_LABEL 7
398#define EFI_IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8
399#define EFI_IMAGE_SYM_CLASS_ARGUMENT 9
400#define EFI_IMAGE_SYM_CLASS_STRUCT_TAG 10
401#define EFI_IMAGE_SYM_CLASS_MEMBER_OF_UNION 11
402#define EFI_IMAGE_SYM_CLASS_UNION_TAG 12
403#define EFI_IMAGE_SYM_CLASS_TYPE_DEFINITION 13
404#define EFI_IMAGE_SYM_CLASS_UNDEFINED_STATIC 14
405#define EFI_IMAGE_SYM_CLASS_ENUM_TAG 15
406#define EFI_IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16
407#define EFI_IMAGE_SYM_CLASS_REGISTER_PARAM 17
408#define EFI_IMAGE_SYM_CLASS_BIT_FIELD 18
409#define EFI_IMAGE_SYM_CLASS_BLOCK 100
410#define EFI_IMAGE_SYM_CLASS_FUNCTION 101
411#define EFI_IMAGE_SYM_CLASS_END_OF_STRUCT 102
412#define EFI_IMAGE_SYM_CLASS_FILE 103
413#define EFI_IMAGE_SYM_CLASS_SECTION 104
414#define EFI_IMAGE_SYM_CLASS_WEAK_EXTERNAL 105
415
416//
417// type packing constants
418//
419#define EFI_IMAGE_N_BTMASK 017
420#define EFI_IMAGE_N_TMASK 060
421#define EFI_IMAGE_N_TMASK1 0300
422#define EFI_IMAGE_N_TMASK2 0360
423#define EFI_IMAGE_N_BTSHFT 4
424#define EFI_IMAGE_N_TSHIFT 2
425
426//
427// Communal selection types.
428//
429#define EFI_IMAGE_COMDAT_SELECT_NODUPLICATES 1
430#define EFI_IMAGE_COMDAT_SELECT_ANY 2
431#define EFI_IMAGE_COMDAT_SELECT_SAME_SIZE 3
432#define EFI_IMAGE_COMDAT_SELECT_EXACT_MATCH 4
433#define EFI_IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
434
435//
436// the following values only be referred in PeCoff, not defined in PECOFF.
437//
438#define EFI_IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
439#define EFI_IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
440#define EFI_IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
441
445typedef struct {
446 UINT32 VirtualAddress;
447 UINT32 SymbolTableIndex;
448 UINT16 Type;
450
454#define EFI_IMAGE_SIZEOF_RELOCATION 10
455
456//
457// I386 relocation types.
458//
459#define EFI_IMAGE_REL_I386_ABSOLUTE 0x0000
460#define EFI_IMAGE_REL_I386_DIR16 0x0001
461#define EFI_IMAGE_REL_I386_REL16 0x0002
462#define EFI_IMAGE_REL_I386_DIR32 0x0006
463#define EFI_IMAGE_REL_I386_DIR32NB 0x0007
464#define EFI_IMAGE_REL_I386_SEG12 0x0009
465#define EFI_IMAGE_REL_I386_SECTION 0x000A
466#define EFI_IMAGE_REL_I386_SECREL 0x000B
467#define EFI_IMAGE_REL_I386_REL32 0x0014
468
469//
470// x64 processor relocation types.
471//
472#define IMAGE_REL_AMD64_ABSOLUTE 0x0000
473#define IMAGE_REL_AMD64_ADDR64 0x0001
474#define IMAGE_REL_AMD64_ADDR32 0x0002
475#define IMAGE_REL_AMD64_ADDR32NB 0x0003
476#define IMAGE_REL_AMD64_REL32 0x0004
477#define IMAGE_REL_AMD64_REL32_1 0x0005
478#define IMAGE_REL_AMD64_REL32_2 0x0006
479#define IMAGE_REL_AMD64_REL32_3 0x0007
480#define IMAGE_REL_AMD64_REL32_4 0x0008
481#define IMAGE_REL_AMD64_REL32_5 0x0009
482#define IMAGE_REL_AMD64_SECTION 0x000A
483#define IMAGE_REL_AMD64_SECREL 0x000B
484#define IMAGE_REL_AMD64_SECREL7 0x000C
485#define IMAGE_REL_AMD64_TOKEN 0x000D
486#define IMAGE_REL_AMD64_SREL32 0x000E
487#define IMAGE_REL_AMD64_PAIR 0x000F
488#define IMAGE_REL_AMD64_SSPAN32 0x0010
489
493typedef struct {
494 UINT32 VirtualAddress;
495 UINT32 SizeOfBlock;
497
501#define EFI_IMAGE_SIZEOF_BASE_RELOCATION 8
502
503//
504// Based relocation types.
505//
506#define EFI_IMAGE_REL_BASED_ABSOLUTE 0
507#define EFI_IMAGE_REL_BASED_HIGH 1
508#define EFI_IMAGE_REL_BASED_LOW 2
509#define EFI_IMAGE_REL_BASED_HIGHLOW 3
510#define EFI_IMAGE_REL_BASED_HIGHADJ 4
511#define EFI_IMAGE_REL_BASED_MIPS_JMPADDR 5
512#define EFI_IMAGE_REL_BASED_ARM_MOV32A 5
513#define EFI_IMAGE_REL_BASED_ARM_MOV32T 7
514#define EFI_IMAGE_REL_BASED_IA64_IMM64 9
515#define EFI_IMAGE_REL_BASED_MIPS_JMPADDR16 9
516#define EFI_IMAGE_REL_BASED_DIR64 10
517
521#define EFI_IMAGE_REL_BASED_RISCV_HI20 5
522#define EFI_IMAGE_REL_BASED_RISCV_LOW12I 7
523#define EFI_IMAGE_REL_BASED_RISCV_LOW12S 8
524
525//
526// Relocation types of LoongArch processor.
527//
528#define EFI_IMAGE_REL_BASED_LOONGARCH32_MARK_LA 8
529#define EFI_IMAGE_REL_BASED_LOONGARCH64_MARK_LA 8
530
534typedef struct {
535 union {
538 } Type;
539 UINT16 Linenumber;
541
545#define EFI_IMAGE_SIZEOF_LINENUMBER 6
546
547//
548// Archive format.
549//
550#define EFI_IMAGE_ARCHIVE_START_SIZE 8
551#define EFI_IMAGE_ARCHIVE_START "!<arch>\n"
552#define EFI_IMAGE_ARCHIVE_END "`\n"
553#define EFI_IMAGE_ARCHIVE_PAD "\n"
554#define EFI_IMAGE_ARCHIVE_LINKER_MEMBER "/ "
555#define EFI_IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
556
560typedef struct {
561 UINT8 Name[16];
562 UINT8 Date[12];
563 UINT8 UserID[6];
564 UINT8 GroupID[6];
565 UINT8 Mode[8];
566 UINT8 Size[10];
567 UINT8 EndHeader[2];
569
573#define EFI_IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
574
575//
576// DLL Support
577//
578
582typedef struct {
583 UINT32 Characteristics;
584 UINT32 TimeDateStamp;
585 UINT16 MajorVersion;
586 UINT16 MinorVersion;
587 UINT32 Name;
588 UINT32 Base;
589 UINT32 NumberOfFunctions;
590 UINT32 NumberOfNames;
591 UINT32 AddressOfFunctions;
592 UINT32 AddressOfNames;
593 UINT32 AddressOfNameOrdinals;
595
596//
597// Based export types.
598//
599#define EFI_IMAGE_EXPORT_ORDINAL_BASE 1
600#define EFI_IMAGE_EXPORT_ADDR_SIZE 4
601#define EFI_IMAGE_EXPORT_ORDINAL_SIZE 2
602
606typedef struct {
607 UINT16 Hint;
608 UINT8 Name[1];
610
614typedef struct {
615 union {
616 UINT32 Function;
617 UINT32 Ordinal;
618 EFI_IMAGE_IMPORT_BY_NAME *AddressOfData;
619 } u1;
621
622#define EFI_IMAGE_ORDINAL_FLAG BIT31
623#define EFI_IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & EFI_IMAGE_ORDINAL_FLAG) != 0)
624#define EFI_IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
625
629typedef struct {
630 UINT32 Characteristics;
631 UINT32 TimeDateStamp;
632 UINT32 ForwarderChain;
633 UINT32 Name;
634 EFI_IMAGE_THUNK_DATA *FirstThunk;
636
640typedef struct {
641 UINT32 Characteristics;
642 UINT32 TimeDateStamp;
643 UINT16 MajorVersion;
644 UINT16 MinorVersion;
645 UINT32 Type;
646 UINT32 SizeOfData;
647 UINT32 RVA;
648 UINT32 FileOffset;
650
651#define EFI_IMAGE_DEBUG_TYPE_CODEVIEW 2
652#define EFI_IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS 20
653
657#define CODEVIEW_SIGNATURE_NB10 SIGNATURE_32('N', 'B', '1', '0')
658typedef struct {
659 UINT32 Signature;
660 UINT32 Unknown;
661 UINT32 Unknown2;
662 UINT32 Unknown3;
663 //
664 // Filename of .PDB goes here
665 //
667
671#define CODEVIEW_SIGNATURE_RSDS SIGNATURE_32('R', 'S', 'D', 'S')
672typedef struct {
673 UINT32 Signature;
674 UINT32 Unknown;
675 UINT32 Unknown2;
676 UINT32 Unknown3;
677 UINT32 Unknown4;
678 UINT32 Unknown5;
679 //
680 // Filename of .PDB goes here
681 //
683
687#define CODEVIEW_SIGNATURE_MTOC SIGNATURE_32('M', 'T', 'O', 'C')
688typedef struct {
689 UINT32 Signature;
690 GUID MachOUuid;
691 //
692 // Filename of .DLL (Mach-O with debug info) goes here
693 //
695
696//
697// .pdata entries for X64
698//
699typedef struct {
700 UINT32 FunctionStartAddress;
701 UINT32 FunctionEndAddress;
702 UINT32 UnwindInfoAddress;
704
705typedef struct {
706 UINT8 Version : 3;
707 UINT8 Flags : 5;
708 UINT8 SizeOfProlog;
709 UINT8 CountOfUnwindCodes;
710 UINT8 FrameRegister : 4;
711 UINT8 FrameRegisterOffset : 4;
713
717#define EFI_IMAGE_DLLCHARACTERISTICS_EX_CET_COMPAT 0x0001
718#define EFI_IMAGE_DLLCHARACTERISTICS_EX_FORWARD_CFI_COMPAT 0x0040
719
720typedef struct {
721 UINT32 DllCharacteristicsEx;
723
727typedef struct {
728 UINT32 Characteristics;
729 UINT32 TimeDateStamp;
730 UINT16 MajorVersion;
731 UINT16 MinorVersion;
732 UINT16 NumberOfNamedEntries;
733 UINT16 NumberOfIdEntries;
734 //
735 // Array of EFI_IMAGE_RESOURCE_DIRECTORY_ENTRY entries goes here.
736 //
738
742typedef struct {
743 union {
744 struct {
745 UINT32 NameOffset : 31;
746 UINT32 NameIsString : 1;
747 } s;
748 UINT32 Id;
749 } u1;
750 union {
751 UINT32 OffsetToData;
752 struct {
753 UINT32 OffsetToDirectory : 31;
754 UINT32 DataIsDirectory : 1;
755 } s;
756 } u2;
758
762typedef struct {
763 UINT16 Length;
764 CHAR16 String[1];
766
770typedef struct {
771 UINT32 OffsetToData;
772 UINT32 Size;
773 UINT32 CodePage;
774 UINT32 Reserved;
776
780typedef struct {
781 UINT16 Signature;
782 UINT16 Machine;
784 UINT8 Subsystem;
787 UINT32 BaseOfCode;
788 UINT64 ImageBase;
789 EFI_IMAGE_DATA_DIRECTORY DataDirectory[2];
791
792#define EFI_TE_IMAGE_HEADER_SIGNATURE SIGNATURE_16('V', 'Z')
793
794//
795// Data directory indexes in our TE image header
796//
797#define EFI_TE_IMAGE_DIRECTORY_ENTRY_BASERELOC 0
798#define EFI_TE_IMAGE_DIRECTORY_ENTRY_DEBUG 1
799
803typedef union {
805 EFI_IMAGE_NT_HEADERS64 Pe32Plus;
808
809typedef union {
811 EFI_IMAGE_NT_HEADERS64 *Pe32Plus;
815
816#endif
#define EFI_IMAGE_SIZEOF_SHORT_NAME
Definition: PeImage.h:290
UINT32 FileOffset
The file pointer to the debug data.
Definition: PeImage.h:648
UINT32 RVA
The address of the debug data when loaded, relative to the image base.
Definition: PeImage.h:647
UINT16 e_oemid
OEM identifier (for e_oeminfo).
Definition: PeImage.h:73
UINT16 e_oeminfo
OEM information; e_oemid specific.
Definition: PeImage.h:74
UINT16 e_maxalloc
Maximum extra paragraphs needed.
Definition: PeImage.h:64
UINT32 e_lfanew
File address of new exe header.
Definition: PeImage.h:76
UINT16 e_crlc
Relocations.
Definition: PeImage.h:61
UINT16 e_ip
Initial IP value.
Definition: PeImage.h:68
UINT16 e_cparhdr
Size of header in paragraphs.
Definition: PeImage.h:62
UINT16 e_magic
Magic number.
Definition: PeImage.h:58
UINT16 e_minalloc
Minimum extra paragraphs needed.
Definition: PeImage.h:63
UINT16 e_csum
Checksum.
Definition: PeImage.h:67
UINT16 e_sp
Initial SP value.
Definition: PeImage.h:66
UINT16 e_cblp
Bytes on last page of file.
Definition: PeImage.h:59
UINT16 e_ss
Initial (relative) SS value.
Definition: PeImage.h:65
UINT16 e_ovno
Overlay number.
Definition: PeImage.h:71
UINT16 e_cp
Pages in file.
Definition: PeImage.h:60
UINT16 e_lfarlc
File address of relocation table.
Definition: PeImage.h:70
UINT16 e_cs
Initial (relative) CS value.
Definition: PeImage.h:69
UINT32 SymbolTableIndex
Symbol table index of function name if Linenumber is 0.
Definition: PeImage.h:536
UINT32 VirtualAddress
Virtual address of line number.
Definition: PeImage.h:537
UINT16 Linenumber
Line number.
Definition: PeImage.h:539
UINT32 AddressOfEntryPoint
Offset to entry point – from original optional header.
Definition: PeImage.h:786
UINT16 Signature
The signature for TE format = "VZ".
Definition: PeImage.h:781
UINT8 Subsystem
From original optional header.
Definition: PeImage.h:784
UINT64 ImageBase
From original file header.
Definition: PeImage.h:788
UINT32 BaseOfCode
From original image – required for ITP debug.
Definition: PeImage.h:787
UINT16 StrippedSize
Number of bytes we removed from the header.
Definition: PeImage.h:785
UINT8 NumberOfSections
From the original file header.
Definition: PeImage.h:783
UINT16 Machine
From the original file header.
Definition: PeImage.h:782
Definition: Base.h:213