summaryrefslogtreecommitdiff
path: root/gnu-efi/gnuefi
diff options
context:
space:
mode:
authorSteve McIntyre <steve@einval.com>2022-06-23 00:16:56 +0100
committerSteve McIntyre <steve@einval.com>2022-06-23 00:16:56 +0100
commite6ace38abd705fbe24349152b7c90d473404e86e (patch)
tree50e7a2d6b00d650fcbee8b0c54f0a0eacefc6929 /gnu-efi/gnuefi
parent8529e0f7f70f427a7202815061362eceba6bfc50 (diff)
downloadefi-boot-shim-upstream/15.6.tar.gz
efi-boot-shim-upstream/15.6.zip
New upstream version 15.6upstream/15.6
Diffstat (limited to 'gnu-efi/gnuefi')
-rw-r--r--gnu-efi/gnuefi/crt0-efi-aarch64.S143
-rw-r--r--gnu-efi/gnuefi/crt0-efi-ia32.S8
-rw-r--r--gnu-efi/gnuefi/crt0-efi-x86_64.S10
3 files changed, 23 insertions, 138 deletions
diff --git a/gnu-efi/gnuefi/crt0-efi-aarch64.S b/gnu-efi/gnuefi/crt0-efi-aarch64.S
index a96b5eb8..0fefec0c 100644
--- a/gnu-efi/gnuefi/crt0-efi-aarch64.S
+++ b/gnu-efi/gnuefi/crt0-efi-aarch64.S
@@ -16,136 +16,11 @@
* either version 2 of the License, or (at your option) any later version.
*/
- .section .text.head
-
- /*
- * Magic "MZ" signature for PE/COFF
- */
- .globl ImageBase
-ImageBase:
- .ascii "MZ"
- .skip 58 // 'MZ' + pad + offset == 64
- .long pe_header - ImageBase // Offset to the PE header.
-pe_header:
- .ascii "PE"
- .short 0
-coff_header:
- .short 0xaa64 // AArch64
- .short 4 // nr_sections
- .long 0 // TimeDateStamp
- .long 0 // PointerToSymbolTable
- .long 1 // NumberOfSymbols
- .short section_table - optional_header // SizeOfOptionalHeader
- .short 0x206 // Characteristics.
- // IMAGE_FILE_DEBUG_STRIPPED |
- // IMAGE_FILE_EXECUTABLE_IMAGE |
- // IMAGE_FILE_LINE_NUMS_STRIPPED
-optional_header:
- .short 0x20b // PE32+ format
- .byte 0x02 // MajorLinkerVersion
- .byte 0x14 // MinorLinkerVersion
- .long _text_size // SizeOfCode
- .long _alldata_size // SizeOfInitializedData
- .long 0 // SizeOfUninitializedData
- .long _start - ImageBase // AddressOfEntryPoint
- .long _start - ImageBase // BaseOfCode
-
-extra_header_fields:
- .quad 0 // ImageBase
- .long 0x1000 // SectionAlignment
- .long 0x200 // FileAlignment
- .short 0 // MajorOperatingSystemVersion
- .short 0 // MinorOperatingSystemVersion
- .short 0 // MajorImageVersion
- .short 0 // MinorImageVersion
- .short 0 // MajorSubsystemVersion
- .short 0 // MinorSubsystemVersion
- .long 0 // Win32VersionValue
-
- .long _erodata - ImageBase // SizeOfImage
-
- // Everything before the kernel image is considered part of the header
- .long _start - ImageBase // SizeOfHeaders
- .long 0 // CheckSum
- .short EFI_SUBSYSTEM // Subsystem
- .short 0 // DllCharacteristics
- .quad 0 // SizeOfStackReserve
- .quad 0 // SizeOfStackCommit
- .quad 0 // SizeOfHeapReserve
- .quad 0 // SizeOfHeapCommit
- .long 0 // LoaderFlags
- .long 0x6 // NumberOfRvaAndSizes
-
- .quad 0 // ExportTable
- .quad 0 // ImportTable
- .quad 0 // ResourceTable
- .quad 0 // ExceptionTable
- .quad 0 // CertificationTable
- .quad 0 // BaseRelocationTable
-
- // Section table
-section_table:
- .ascii ".text\0\0\0"
- .long _evtext - _start // VirtualSize
- .long _start - ImageBase // VirtualAddress
- .long _etext - _start // SizeOfRawData
- .long _start - ImageBase // PointerToRawData
-
- .long 0 // PointerToRelocations (0 for executables)
- .long 0 // PointerToLineNumbers (0 for executables)
- .short 0 // NumberOfRelocations (0 for executables)
- .short 0 // NumberOfLineNumbers (0 for executables)
- /*
- * EFI_IMAGE_SCN_MEM_READ | EFI_IMAGE_SCN_MEM_EXECUTE | EFI_IMAGE_SCN_CNT_CODE
- */
- .long 0x60000020 // Characteristics (section flags)
-
- .ascii ".data\0\0\0"
- .long _data_vsize // VirtualSize
- .long _data - ImageBase // VirtualAddress
- .long _data_size // SizeOfRawData
- .long _data - ImageBase // PointerToRawData
-
- .long 0 // PointerToRelocations (0 for executables)
- .long 0 // PointerToLineNumbers (0 for executables)
- .short 0 // NumberOfRelocations (0 for executables)
- .short 0 // NumberOfLineNumbers (0 for executables)
- /*
- * EFI_IMAGE_SCN_MEM_WRITE | EFI_IMAGE_SCN_MEM_READ | EFI_IMAGE_SCN_CNT_INITIALIZED_DATA
- */
- .long 0xc0000040 // Characteristics (section flags)
-
- .ascii ".sbat\0\0\0"
- .long _sbat_vsize // VirtualSize
- .long _sbat - ImageBase // VirtualAddress
- .long _sbat_size // SizeOfRawData
- .long _sbat - ImageBase // PointerToRawData
-
- .long 0 // PointerToRelocations (0 for executables)
- .long 0 // PointerToLineNumbers (0 for executables)
- .short 0 // NumberOfRelocations (0 for executables)
- .short 0 // NumberOfLineNumbers (0 for executables)
- /*
- * EFI_IMAGE_SCN_MEM_READ | EFI_IMAGE_SCN_ALIGN_8BYTES | EFI_IMAGE_SCN_CNT_INITIALIZED_DATA
- */
- .long 0x40400040 // Characteristics (section flags)
-
- .ascii ".rodata\0"
- .long _rodata_vsize // VirtualSize
- .long _rodata - ImageBase // VirtualAddress
- .long _rodata_size // SizeOfRawData
- .long _rodata - ImageBase // PointerToRawData
-
- .long 0 // PointerToRelocations (0 for executables)
- .long 0 // PointerToLineNumbers (0 for executables)
- .short 0 // NumberOfRelocations (0 for executables)
- .short 0 // NumberOfLineNumbers (0 for executables)
- /*
- * EFI_IMAGE_SCN_MEM_READ | EFI_IMAGE_SCN_ALIGN_8BYTES | EFI_IMAGE_SCN_CNT_INITIALIZED_DATA
- */
- .long 0x40400040 // Characteristics (section flags)
+ .text
.align 12
+
+ .globl _start
_start:
stp x29, x30, [sp, #-32]!
mov x29, sp
@@ -164,3 +39,15 @@ _start:
0: ldp x29, x30, [sp], #32
ret
+
+ // hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
+ .data
+.dummy0:
+.dummy1:
+ .4byte 0
+
+#define IMAGE_REL_ABSOLUTE 0
+ .section .reloc, "a"
+ .4byte .dummy1-.dummy0 // Page RVA
+ .4byte 10 // Block Size (2*4+2)
+ .2byte (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy
diff --git a/gnu-efi/gnuefi/crt0-efi-ia32.S b/gnu-efi/gnuefi/crt0-efi-ia32.S
index 2c567461..c9b3ea67 100644
--- a/gnu-efi/gnuefi/crt0-efi-ia32.S
+++ b/gnu-efi/gnuefi/crt0-efi-ia32.S
@@ -68,10 +68,10 @@ _start:
.data
.dummy0:
.dummy1:
- .long 0
+ .4byte 0
#define IMAGE_REL_ABSOLUTE 0
.section .reloc, "a"
- .long .dummy1-.dummy0 // Page RVA
- .long 10 // Block Size (2*4+2)
- .word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy
+ .4byte .dummy1-.dummy0 // Page RVA
+ .4byte 10 // Block Size (2*4+2)
+ .2byte (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy
diff --git a/gnu-efi/gnuefi/crt0-efi-x86_64.S b/gnu-efi/gnuefi/crt0-efi-x86_64.S
index 1a87dbd3..0d99c151 100644
--- a/gnu-efi/gnuefi/crt0-efi-x86_64.S
+++ b/gnu-efi/gnuefi/crt0-efi-x86_64.S
@@ -59,18 +59,16 @@ _start:
call efi_main
addq $8, %rsp
-.exit:
ret
// hand-craft a dummy .reloc section so EFI knows it's a relocatable executable:
.data
.dummy0:
.dummy1:
- .long 0
+ .4byte 0
#define IMAGE_REL_ABSOLUTE 0
.section .reloc, "a"
- .long .dummy1-.dummy0 // Page RVA
- .long 10 // Block Size (2*4+2)
- .word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy
-
+ .4byte .dummy1-.dummy0 // Page RVA
+ .4byte 10 // Block Size (2*4+2)
+ .2byte (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy