2 * crt0-efi-aarch64.S - PE/COFF header for aarch64 EFI applications
4 * Copright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
6 * SPDX-License-Identifier: GPL-2.0+ BSD-2-Clause
8 * This file is taken and modified from the gnu-efi project.
14 * Magic "MZ" signature for PE/COFF
19 .skip 58 /* 'MZ' + pad + offset == 64 */
20 .long pe_header - ImageBase /* Offset to the PE header */
25 .short 0xaa64 /* AArch64 */
26 .short 2 /* nr_sections */
27 .long 0 /* TimeDateStamp */
28 .long 0 /* PointerToSymbolTable */
29 .long 1 /* NumberOfSymbols */
30 .short section_table - optional_header /* SizeOfOptionalHeader */
32 * Characteristics: IMAGE_FILE_DEBUG_STRIPPED |
33 * IMAGE_FILE_EXECUTABLE_IMAGE | IMAGE_FILE_LINE_NUMS_STRIPPED
37 .short 0x20b /* PE32+ format */
38 .byte 0x02 /* MajorLinkerVersion */
39 .byte 0x14 /* MinorLinkerVersion */
40 .long _edata - _start /* SizeOfCode */
41 .long 0 /* SizeOfInitializedData */
42 .long 0 /* SizeOfUninitializedData */
43 .long _start - ImageBase /* AddressOfEntryPoint */
44 .long _start - ImageBase /* BaseOfCode */
47 .quad 0 /* ImageBase */
48 .long 0x20 /* SectionAlignment */
49 .long 0x8 /* FileAlignment */
50 .short 0 /* MajorOperatingSystemVersion */
51 .short 0 /* MinorOperatingSystemVersion */
52 .short 0 /* MajorImageVersion */
53 .short 0 /* MinorImageVersion */
54 .short 0 /* MajorSubsystemVersion */
55 .short 0 /* MinorSubsystemVersion */
56 .long 0 /* Win32VersionValue */
58 .long _edata - ImageBase /* SizeOfImage */
61 * Everything before the kernel image is considered part of the header
63 .long _start - ImageBase /* SizeOfHeaders */
64 .long 0 /* CheckSum */
65 .short EFI_SUBSYSTEM /* Subsystem */
66 .short 0 /* DllCharacteristics */
67 .quad 0 /* SizeOfStackReserve */
68 .quad 0 /* SizeOfStackCommit */
69 .quad 0 /* SizeOfHeapReserve */
70 .quad 0 /* SizeOfHeapCommit */
71 .long 0 /* LoaderFlags */
72 .long 0x6 /* NumberOfRvaAndSizes */
74 .quad 0 /* ExportTable */
75 .quad 0 /* ImportTable */
76 .quad 0 /* ResourceTable */
77 .quad 0 /* ExceptionTable */
78 .quad 0 /* CertificationTable */
79 .quad 0 /* BaseRelocationTable */
85 * The EFI application loader requires a relocation section
86 * because EFI applications must be relocatable. This is a
87 * dummy section as far as we are concerned.
91 .byte 0 /* end of 0 padding of section name */
94 .long 0 /* SizeOfRawData */
95 .long 0 /* PointerToRawData */
96 .long 0 /* PointerToRelocations */
97 .long 0 /* PointerToLineNumbers */
98 .short 0 /* NumberOfRelocations */
99 .short 0 /* NumberOfLineNumbers */
100 .long 0x42100040 /* Characteristics (section flags) */
106 .byte 0 /* end of 0 padding of section name */
107 .long _edata - _start /* VirtualSize */
108 .long _start - ImageBase /* VirtualAddress */
109 .long _edata - _start /* SizeOfRawData */
110 .long _start - ImageBase /* PointerToRawData */
112 .long 0 /* PointerToRelocations (0 for executables) */
113 .long 0 /* PointerToLineNumbers (0 for executables) */
114 .short 0 /* NumberOfRelocations (0 for executables) */
115 .short 0 /* NumberOfLineNumbers (0 for executables) */
116 .long 0xe0500020 /* Characteristics (section flags) */
119 stp x29, x30, [sp, #-32]!
122 stp x0, x1, [sp, #16]
127 add x1, x1, #:lo12:_DYNAMIC
131 ldp x0, x1, [sp, #16]
134 0: ldp x29, x30, [sp], #32