2 * crt0-efi-arm.S - PE/COFF header for ARM EFI applications
4 * Copright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice and this list of conditions, without modification.
11 * 2. The name of the author may not be used to endorse or promote products
12 * derived from this software without specific prior written permission.
14 * Alternatively, this software may be distributed under the terms of the
15 * GNU General Public License as published by the Free Software Foundation;
16 * either version 2 of the License, or (at your option) any later version.
22 * Magic "MZ" signature for PE/COFF
27 .skip 58 // 'MZ' + pad + offset == 64
28 .long pe_header - ImageBase // Offset to the PE header.
33 .short 0x1c2 // Mixed ARM/Thumb
34 .short 2 // nr_sections
35 .long 0 // TimeDateStamp
36 .long 0 // PointerToSymbolTable
37 .long 1 // NumberOfSymbols
38 .short section_table - optional_header // SizeOfOptionalHeader
39 .short 0x306 // Characteristics.
40 // IMAGE_FILE_32BIT_MACHINE |
41 // IMAGE_FILE_DEBUG_STRIPPED |
42 // IMAGE_FILE_EXECUTABLE_IMAGE |
43 // IMAGE_FILE_LINE_NUMS_STRIPPED
45 .short 0x10b // PE32+ format
46 .byte 0x02 // MajorLinkerVersion
47 .byte 0x14 // MinorLinkerVersion
48 .long _edata - _start // SizeOfCode
49 .long 0 // SizeOfInitializedData
50 .long 0 // SizeOfUninitializedData
51 .long _start - ImageBase // AddressOfEntryPoint
52 .long _start - ImageBase // BaseOfCode
57 .long 0x20 // SectionAlignment
58 .long 0x8 // FileAlignment
59 .short 0 // MajorOperatingSystemVersion
60 .short 0 // MinorOperatingSystemVersion
61 .short 0 // MajorImageVersion
62 .short 0 // MinorImageVersion
63 .short 0 // MajorSubsystemVersion
64 .short 0 // MinorSubsystemVersion
65 .long 0 // Win32VersionValue
67 .long _edata - ImageBase // SizeOfImage
69 // Everything before the kernel image is considered part of the header
70 .long _start - ImageBase // SizeOfHeaders
72 .short EFI_SUBSYSTEM // Subsystem
73 .short 0 // DllCharacteristics
74 .long 0 // SizeOfStackReserve
75 .long 0 // SizeOfStackCommit
76 .long 0 // SizeOfHeapReserve
77 .long 0 // SizeOfHeapCommit
78 .long 0 // LoaderFlags
79 .long 0x6 // NumberOfRvaAndSizes
81 .quad 0 // ExportTable
82 .quad 0 // ImportTable
83 .quad 0 // ResourceTable
84 .quad 0 // ExceptionTable
85 .quad 0 // CertificationTable
86 .quad 0 // BaseRelocationTable
92 * The EFI application loader requires a relocation section
93 * because EFI applications must be relocatable. This is a
94 * dummy section as far as we are concerned.
98 .byte 0 // end of 0 padding of section name
101 .long 0 // SizeOfRawData
102 .long 0 // PointerToRawData
103 .long 0 // PointerToRelocations
104 .long 0 // PointerToLineNumbers
105 .short 0 // NumberOfRelocations
106 .short 0 // NumberOfLineNumbers
107 .long 0x42100040 // Characteristics (section flags)
113 .byte 0 // end of 0 padding of section name
114 .long _edata - _start // VirtualSize
115 .long _start - ImageBase // VirtualAddress
116 .long _edata - _start // SizeOfRawData
117 .long _start - ImageBase // PointerToRawData
119 .long 0 // PointerToRelocations (0 for executables)
120 .long 0 // PointerToLineNumbers (0 for executables)
121 .short 0 // NumberOfRelocations (0 for executables)
122 .short 0 // NumberOfLineNumbers (0 for executables)
123 .long 0xe0500020 // Characteristics (section flags)
126 stmfd sp!, {r0-r2, lr}