2 * crt0-efi-arm.S - PE/COFF header for ARM 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 - image_base /* Offset to the PE header */
25 .short 0x1c2 /* Mixed ARM/Thumb */
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_32BIT_MACHINE |
33 * IMAGE_FILE_DEBUG_STRIPPED | IMAGE_FILE_EXECUTABLE_IMAGE |
34 * IMAGE_FILE_LINE_NUMS_STRIPPED
38 .short 0x10b /* PE32+ format */
39 .byte 0x02 /* MajorLinkerVersion */
40 .byte 0x14 /* MinorLinkerVersion */
41 .long _edata - _start /* SizeOfCode */
42 .long 0 /* SizeOfInitializedData */
43 .long 0 /* SizeOfUninitializedData */
44 .long _start - image_base /* AddressOfEntryPoint */
45 .long _start - image_base /* BaseOfCode */
46 .long 0 /* BaseOfData */
49 .long 0 /* image_base */
50 .long 0x20 /* SectionAlignment */
51 .long 0x8 /* FileAlignment */
52 .short 0 /* MajorOperatingSystemVersion */
53 .short 0 /* MinorOperatingSystemVersion */
54 .short 0 /* MajorImageVersion */
55 .short 0 /* MinorImageVersion */
56 .short 0 /* MajorSubsystemVersion */
57 .short 0 /* MinorSubsystemVersion */
58 .long 0 /* Win32VersionValue */
60 .long _edata - image_base /* SizeOfImage */
63 * Everything before the kernel image is considered part of the header
65 .long _start - image_base /* SizeOfHeaders */
66 .long 0 /* CheckSum */
67 .short EFI_SUBSYSTEM /* Subsystem */
68 .short 0 /* DllCharacteristics */
69 .long 0 /* SizeOfStackReserve */
70 .long 0 /* SizeOfStackCommit */
71 .long 0 /* SizeOfHeapReserve */
72 .long 0 /* SizeOfHeapCommit */
73 .long 0 /* LoaderFlags */
74 .long 0x6 /* NumberOfRvaAndSizes */
76 .quad 0 /* ExportTable */
77 .quad 0 /* ImportTable */
78 .quad 0 /* ResourceTable */
79 .quad 0 /* ExceptionTable */
80 .quad 0 /* CertificationTable */
81 .quad 0 /* BaseRelocationTable */
86 * The EFI application loader requires a relocation section
87 * because EFI applications must be relocatable. This is a
88 * dummy section as far as we are concerned.
92 .byte 0 /* end of 0 padding of section name */
95 .long 0 /* SizeOfRawData */
96 .long 0 /* PointerToRawData */
97 .long 0 /* PointerToRelocations */
98 .long 0 /* PointerToLineNumbers */
99 .short 0 /* NumberOfRelocations */
100 .short 0 /* NumberOfLineNumbers */
101 .long 0x42100040 /* Characteristics (section flags) */
106 .byte 0 /* end of 0 padding of section name */
107 .long _edata - _start /* VirtualSize */
108 .long _start - image_base /* VirtualAddress */
109 .long _edata - _start /* SizeOfRawData */
110 .long _start - image_base /* 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 stmfd sp!, {r0-r2, lr}