2 * crt0-efi-mips64el.S - PE/COFF header for MIPS64 EFI applications
4 * Copright (C) 2014 Linaro Ltd. <ard.biesheuvel@linaro.org>
5 * Copright (C) 2017 Heiher <r@hev.cc>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice and this list of conditions, without modification.
12 * 2. The name of the author may not be used to endorse or promote products
13 * derived from this software without specific prior written permission.
15 * Alternatively, this software may be distributed under the terms of the
16 * GNU General Public License as published by the Free Software Foundation;
17 * either version 2 of the License, or (at your option) any later version.
23 * Magic "MZ" signature for PE/COFF
28 .skip 58 // 'MZ' + pad + offset == 64
29 .long pe_header - ImageBase // Offset to the PE header.
34 .short 0x166 // MIPS little endian
35 .short 2 // nr_sections
36 .long 0 // TimeDateStamp
37 .long 0 // PointerToSymbolTable
38 .long 1 // NumberOfSymbols
39 .short section_table - optional_header // SizeOfOptionalHeader
40 .short 0x206 // Characteristics.
41 // IMAGE_FILE_DEBUG_STRIPPED |
42 // IMAGE_FILE_EXECUTABLE_IMAGE |
43 // IMAGE_FILE_LINE_NUMS_STRIPPED
45 .short 0x20b // 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
56 .long 0x20 // SectionAlignment
57 .long 0x8 // FileAlignment
58 .short 0 // MajorOperatingSystemVersion
59 .short 0 // MinorOperatingSystemVersion
60 .short 0 // MajorImageVersion
61 .short 0 // MinorImageVersion
62 .short 0 // MajorSubsystemVersion
63 .short 0 // MinorSubsystemVersion
64 .long 0 // Win32VersionValue
66 .long _edata - ImageBase // SizeOfImage
68 // Everything before the kernel image is considered part of the header
69 .long _start - ImageBase // SizeOfHeaders
71 .short EFI_SUBSYSTEM // Subsystem
72 .short 0 // DllCharacteristics
73 .quad 0 // SizeOfStackReserve
74 .quad 0 // SizeOfStackCommit
75 .quad 0 // SizeOfHeapReserve
76 .quad 0 // SizeOfHeapCommit
77 .long 0 // LoaderFlags
78 .long 0x6 // NumberOfRvaAndSizes
80 .quad 0 // ExportTable
81 .quad 0 // ImportTable
82 .quad 0 // ResourceTable
83 .quad 0 // ExceptionTable
84 .quad 0 // CertificationTable
85 .quad 0 // BaseRelocationTable
91 * The EFI application loader requires a relocation section
92 * because EFI applications must be relocatable. This is a
93 * dummy section as far as we are concerned.
97 .byte 0 // end of 0 padding of section name
100 .long 0 // SizeOfRawData
101 .long 0 // PointerToRawData
102 .long 0 // PointerToRelocations
103 .long 0 // PointerToLineNumbers
104 .short 0 // NumberOfRelocations
105 .short 0 // NumberOfLineNumbers
106 .long 0x42100040 // Characteristics (section flags)
112 .byte 0 // end of 0 padding of section name
113 .long _edata - _start // VirtualSize
114 .long _start - ImageBase // VirtualAddress
115 .long _edata - _start // SizeOfRawData
116 .long _start - ImageBase // PointerToRawData
118 .long 0 // PointerToRelocations (0 for executables)
119 .long 0 // PointerToLineNumbers (0 for executables)
120 .short 0 // NumberOfRelocations (0 for executables)
121 .short 0 // NumberOfLineNumbers (0 for executables)
122 .long 0xe0500020 // Characteristics (section flags)
130 .type _start, @function
158 dli $t1, ImageBase - _pc
160 // a1: DynamicSection