Backport PE32 header changes to all early stage0-uefi programs.

This commit is contained in:
Andrius Štikonas 2022-10-11 00:55:46 +01:00
parent 9876a5e51c
commit d518c45e8d
14 changed files with 35 additions and 32 deletions

View File

@ -1169,4 +1169,4 @@ DEFINE xor_r13,r13 4D31ED
:root_device
%0 %0
:PE32_end
:ELF_end

View File

@ -303,4 +303,4 @@ DEFINE xor_r9,r9 4D31C9
:root_device
%0 %0
:PE32_end
:ELF_end

View File

@ -360,4 +360,4 @@ DEFINE xor_r9,r9 4D31C9
@0x11d2
!0x8e !0x39 !0 !0xa0 !0xc9 !0x69 !0x72 !0x3b
:PE32_end
:ELF_end

View File

@ -289,4 +289,4 @@
D2 11 ; @0x11d2
8E 39 00 A0 C9 69 72 3B ; !0x8e !0x39 !0 !0xa0 !0xc9 !0x69 !0x72 !0x3b
:PE32_end
:ELF_end

View File

@ -488,4 +488,4 @@ DEFINE xor_r9,r9 4D31C9
@0x11d2
!0x8e !0x39 !0 !0xa0 !0xc9 !0x69 !0x72 !0x3b
:PE32_end
:ELF_end

View File

@ -406,4 +406,4 @@
D2 11 ; @0x11d2
8E 39 00 A0 C9 69 72 3B ; !0x8e !0x39 !0 !0xa0 !0xc9 !0x69 !0x72 !0x3b
:PE32_end
:ELF_end

View File

@ -808,4 +808,4 @@ DEFINE xor_r9,r9 4D31C9
:root_device
%0 %0
:PE32_end
:ELF_end

View File

@ -564,4 +564,4 @@ DEFINE xor_r15,r15 4D31FF
:system_out
%0 %0
:PE32_end
:ELF_end

View File

@ -459,4 +459,4 @@
:system_out
00 00 00 00 00 00 00 00
:PE32_end
:ELF_end

View File

@ -3,6 +3,7 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
:PE32_base
# DOS MZ header
4D 5A # Signature
00 00 # Number of bytes in the last page.
@ -26,14 +27,14 @@
40 00 00 00 # Starting address of the PE header
# [0x40]
# PE header
:PE_header
50 45 00 00 # Signature "PE"
64 86 # Machine
01 00 # number of sections
00 00 00 00 # Timestamp supposedly
00 00 00 00 # PointerToSymbolTable
00 00 00 00 # number of symbols
F0 00 # SizeOfOptionalHeader
@OptionalHeader_end>PE_header # SizeOfOptionalHeader
00 00 # 'Characteristics'
# [0x58]
@ -44,16 +45,16 @@ F0 00 # SizeOfOptionalHeader
00 00 00 00 # sizeOfInitializedData
00 00 00 00 # SizeOfUninitializedData
00 10 00 00 # AddressOfEntryPoint
00 10 00 00 # BaseOfCode
00 00 00 80 01 00 00 00 # ImageBase
00 00 00 00 # BaseOfCode
00 00 00 00 00 00 00 00 # ImageBase
01 00 00 00 # SectionAlignment
01 00 00 00 # FileAlignment
00 00 00 00 # OperatingSystemVersion
00 00 00 00 # ImageVersion
00 00 00 00 # SubsystemVersion
00 00 00 00 # Win32VersionValue
00 20 00 00 # SizeOfImage
70 01 00 00 # SizeOfHeaders
00 00 10 00 # SizeOfImage
%PE32_text>PE32_base # SizeOfHeaders
00 00 00 00 # CheckSum (isn't used at all)
0A 00 # Subsystem
00 00 # DllCharacteristics
@ -111,6 +112,9 @@ F0 00 # SizeOfOptionalHeader
00 00 00 00 # CLR Runtime header table
00 00 00 00 # Size of CLR Runtime Header table
# [0x130]
:OptionalHeader_end
00 00 00 00 00 00 00 00 # MUST BE NULL
# no idea what it is yet
@ -119,10 +123,10 @@ F0 00 # SizeOfOptionalHeader
# [0x148]
# Start of section headers
00 00 00 00 00 00 00 00 ; Name of the section (empty) but could set to ".text"
%PE32_end>PE32_text ; VirtualSize
2E 74 65 78 74 00 00 00 ; Name of the section: ".text"
%ELF_end>PE32_text ; VirtualSize
00 10 00 00 ; VirtualAddress
%PE32_end>PE32_text ; SizeOfRawData
%ELF_end>PE32_text ; SizeOfRawData
70 01 00 00 ; PointerToRawData
00 00 00 00 ; PointerToRelocations
00 00 00 00 ; PointerToLinenumbers
@ -131,7 +135,6 @@ F0 00 # SizeOfOptionalHeader
00 00 00 00 ; 'Characteristics'
# [0x170]
:PE32_text
# efi_main(void *image_handle, struct efi_system_table *system)
@ -371,4 +374,4 @@ F0 00 # SizeOfOptionalHeader
:root_device
00000000 00000000
:PE32_end
:ELF_end

View File

@ -52,8 +52,8 @@ F0 00 # SizeOfOptionalHeader
00 00 00 00 # sizeOfInitializedData
00 00 00 00 # SizeOfUninitializedData
00 10 00 00 # AddressOfEntryPoint
00 10 00 00 # BaseOfCode
00 00 00 80 01 00 00 00 # ImageBase
00 00 00 00 # BaseOfCode
00 00 00 00 00 00 00 00 # ImageBase
01 00 00 00 # SectionAlignment
01 00 00 00 # FileAlignment
00 00 00 00 # OperatingSystemVersion
@ -418,4 +418,4 @@ D1 01 00 00 ; SizeOfRawData
D2 11 ; @0x11d2
8E 39 00 A0 C9 69 72 3B ; !0x8e !0x39 !0 !0xa0 !0xc9 !0x69 !0x72 !0x3b
# :PE32_end [_start+0x1D1]
# :ELF_end [_start+0x1D1]

View File

@ -47,8 +47,8 @@ F0 00 # SizeOfOptionalHeader
00 00 00 00 # sizeOfInitializedData
00 00 00 00 # SizeOfUninitializedData
00 10 00 00 # AddressOfEntryPoint
00 10 00 00 # BaseOfCode
00 00 00 80 01 00 00 00 # ImageBase
00 00 00 00 # BaseOfCode
00 00 00 00 00 00 00 00 # ImageBase
01 00 00 00 # SectionAlignment
01 00 00 00 # FileAlignment
00 00 00 00 # OperatingSystemVersion
@ -536,4 +536,4 @@ CF 03 00 00 ; SizeOfRawData
D2 11 ; @0x11d2
8E 39 00 A0 C9 69 72 3B ; !0x8e !0x39 !0 !0xa0 !0xc9 !0x69 !0x72 !0x3b
# :PE32_end [_start+0x3CF]
# :ELF_end [_start+0x3CF]

View File

@ -56,8 +56,8 @@ F0 00 # SizeOfOptionalHeader
00 00 00 00 # sizeOfInitializedData
00 00 00 00 # SizeOfUninitializedData
00 10 00 00 # AddressOfEntryPoint
00 10 00 00 # BaseOfCode
00 00 00 80 01 00 00 00 # ImageBase
00 00 00 00 # BaseOfCode
00 00 00 00 00 00 00 00 # ImageBase
01 00 00 00 # SectionAlignment
01 00 00 00 # FileAlignment
00 00 00 00 # OperatingSystemVersion
@ -825,4 +825,4 @@ DD 06 00 00 ; SizeOfRawData
:6 #:root_device
00000000 00000000
# :PE32_end
# :ELF_end

View File

@ -44,8 +44,8 @@ F0 00 # SizeOfOptionalHeader
00 00 00 00 # sizeOfInitializedData
2B 00 00 00 # SizeOfUninitializedData
00 10 00 00 # AddressOfEntryPoint
00 10 00 00 # BaseOfCode
00 00 00 80 01 00 00 00 # ImageBase
00 00 00 00 # BaseOfCode
00 00 00 00 00 00 00 00 # ImageBase
01 00 00 00 # SectionAlignment
01 00 00 00 # FileAlignment
00 00 00 00 # OperatingSystemVersion
@ -576,7 +576,7 @@ EE 03 00 00 ; SizeOfRawData
# :suffix [_start+0x3EB]
0A 00 0D ; L"Subprocess error\n\r"
# :PE32_end [_start+0x3EE]
# :ELF_end [_start+0x3EE]
# :image_handle [_start+0x3F1]
# :image [_start+0x3F9]
# :rootdir [_start+0x401]