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.
11 #include <asm-generic/pe.h>
16 * Magic "MZ" signature for PE/COFF
21 .skip 58 /* 'MZ' + pad + offset == 64 */
22 .long pe_header - image_base /* Offset to the PE header */
27 .short 0x1c2 /* Mixed ARM/Thumb */
28 .short 2 /* nr_sections */
29 .long 0 /* TimeDateStamp */
30 .long 0 /* PointerToSymbolTable */
31 .long 1 /* NumberOfSymbols */
32 .short section_table - optional_header /* SizeOfOptionalHeader */
34 * Characteristics: IMAGE_FILE_32BIT_MACHINE |
35 * IMAGE_FILE_DEBUG_STRIPPED | IMAGE_FILE_EXECUTABLE_IMAGE |
36 * IMAGE_FILE_LINE_NUMS_STRIPPED
40 .short 0x10b /* PE32+ format */
41 .byte 0x02 /* MajorLinkerVersion */
42 .byte 0x14 /* MinorLinkerVersion */
43 .long _edata - _start /* SizeOfCode */
44 .long 0 /* SizeOfInitializedData */
45 .long 0 /* SizeOfUninitializedData */
46 .long _start - image_base /* AddressOfEntryPoint */
47 .long _start - image_base /* BaseOfCode */
48 .long 0 /* BaseOfData */
51 .long 0 /* image_base */
52 .long 0x20 /* SectionAlignment */
53 .long 0x8 /* FileAlignment */
54 .short 0 /* MajorOperatingSystemVersion */
55 .short 0 /* MinorOperatingSystemVersion */
56 .short 0 /* MajorImageVersion */
57 .short 0 /* MinorImageVersion */
58 .short 0 /* MajorSubsystemVersion */
59 .short 0 /* MinorSubsystemVersion */
60 .long 0 /* Win32VersionValue */
62 .long _edata - image_base /* SizeOfImage */
65 * Everything before the kernel image is considered part of the header
67 .long _start - image_base /* SizeOfHeaders */
68 .long 0 /* CheckSum */
69 .short IMAGE_SUBSYSTEM_EFI_APPLICATION /* Subsystem */
70 .short 0 /* DllCharacteristics */
71 .long 0 /* SizeOfStackReserve */
72 .long 0 /* SizeOfStackCommit */
73 .long 0 /* SizeOfHeapReserve */
74 .long 0 /* SizeOfHeapCommit */
75 .long 0 /* LoaderFlags */
76 .long 0x6 /* NumberOfRvaAndSizes */
78 .quad 0 /* ExportTable */
79 .quad 0 /* ImportTable */
80 .quad 0 /* ResourceTable */
81 .quad 0 /* ExceptionTable */
82 .quad 0 /* CertificationTable */
83 .quad 0 /* BaseRelocationTable */
88 * The EFI application loader requires a relocation section
89 * because EFI applications must be relocatable. This is a
90 * dummy section as far as we are concerned.
94 .byte 0 /* end of 0 padding of section name */
97 .long 0 /* SizeOfRawData */
98 .long 0 /* PointerToRawData */
99 .long 0 /* PointerToRelocations */
100 .long 0 /* PointerToLineNumbers */
101 .short 0 /* NumberOfRelocations */
102 .short 0 /* NumberOfLineNumbers */
103 .long 0x42100040 /* Characteristics (section flags) */
108 .byte 0 /* end of 0 padding of section name */
109 .long _edata - _start /* VirtualSize */
110 .long _start - image_base /* VirtualAddress */
111 .long _edata - _start /* SizeOfRawData */
112 .long _start - image_base /* PointerToRawData */
114 .long 0 /* PointerToRelocations (0 for executables) */
115 .long 0 /* PointerToLineNumbers (0 for executables) */
116 .short 0 /* NumberOfRelocations (0 for executables) */
117 .short 0 /* NumberOfLineNumbers (0 for executables) */
118 .long 0xe0500020 /* Characteristics (section flags) */
121 stmfd sp!, {r0-r2, lr}