diff options
Diffstat (limited to 'arch/arm64/kernel/head.S')
-rw-r--r-- | arch/arm64/kernel/head.S | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 0fd565000772..738291b5be29 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S | |||
@@ -108,8 +108,18 @@ | |||
108 | /* | 108 | /* |
109 | * DO NOT MODIFY. Image header expected by Linux boot-loaders. | 109 | * DO NOT MODIFY. Image header expected by Linux boot-loaders. |
110 | */ | 110 | */ |
111 | #ifdef CONFIG_EFI | ||
112 | efi_head: | ||
113 | /* | ||
114 | * This add instruction has no meaningful effect except that | ||
115 | * its opcode forms the magic "MZ" signature required by UEFI. | ||
116 | */ | ||
117 | add x13, x18, #0x16 | ||
118 | b stext | ||
119 | #else | ||
111 | b stext // branch to kernel start, magic | 120 | b stext // branch to kernel start, magic |
112 | .long 0 // reserved | 121 | .long 0 // reserved |
122 | #endif | ||
113 | .quad TEXT_OFFSET // Image load offset from start of RAM | 123 | .quad TEXT_OFFSET // Image load offset from start of RAM |
114 | .quad 0 // reserved | 124 | .quad 0 // reserved |
115 | .quad 0 // reserved | 125 | .quad 0 // reserved |
@@ -120,7 +130,109 @@ | |||
120 | .byte 0x52 | 130 | .byte 0x52 |
121 | .byte 0x4d | 131 | .byte 0x4d |
122 | .byte 0x64 | 132 | .byte 0x64 |
133 | #ifdef CONFIG_EFI | ||
134 | .long pe_header - efi_head // Offset to the PE header. | ||
135 | #else | ||
123 | .word 0 // reserved | 136 | .word 0 // reserved |
137 | #endif | ||
138 | |||
139 | #ifdef CONFIG_EFI | ||
140 | .align 3 | ||
141 | pe_header: | ||
142 | .ascii "PE" | ||
143 | .short 0 | ||
144 | coff_header: | ||
145 | .short 0xaa64 // AArch64 | ||
146 | .short 2 // nr_sections | ||
147 | .long 0 // TimeDateStamp | ||
148 | .long 0 // PointerToSymbolTable | ||
149 | .long 1 // NumberOfSymbols | ||
150 | .short section_table - optional_header // SizeOfOptionalHeader | ||
151 | .short 0x206 // Characteristics. | ||
152 | // IMAGE_FILE_DEBUG_STRIPPED | | ||
153 | // IMAGE_FILE_EXECUTABLE_IMAGE | | ||
154 | // IMAGE_FILE_LINE_NUMS_STRIPPED | ||
155 | optional_header: | ||
156 | .short 0x20b // PE32+ format | ||
157 | .byte 0x02 // MajorLinkerVersion | ||
158 | .byte 0x14 // MinorLinkerVersion | ||
159 | .long _edata - stext // SizeOfCode | ||
160 | .long 0 // SizeOfInitializedData | ||
161 | .long 0 // SizeOfUninitializedData | ||
162 | .long efi_stub_entry - efi_head // AddressOfEntryPoint | ||
163 | .long stext - efi_head // BaseOfCode | ||
164 | |||
165 | extra_header_fields: | ||
166 | .quad 0 // ImageBase | ||
167 | .long 0x20 // SectionAlignment | ||
168 | .long 0x8 // FileAlignment | ||
169 | .short 0 // MajorOperatingSystemVersion | ||
170 | .short 0 // MinorOperatingSystemVersion | ||
171 | .short 0 // MajorImageVersion | ||
172 | .short 0 // MinorImageVersion | ||
173 | .short 0 // MajorSubsystemVersion | ||
174 | .short 0 // MinorSubsystemVersion | ||
175 | .long 0 // Win32VersionValue | ||
176 | |||
177 | .long _edata - efi_head // SizeOfImage | ||
178 | |||
179 | // Everything before the kernel image is considered part of the header | ||
180 | .long stext - efi_head // SizeOfHeaders | ||
181 | .long 0 // CheckSum | ||
182 | .short 0xa // Subsystem (EFI application) | ||
183 | .short 0 // DllCharacteristics | ||
184 | .quad 0 // SizeOfStackReserve | ||
185 | .quad 0 // SizeOfStackCommit | ||
186 | .quad 0 // SizeOfHeapReserve | ||
187 | .quad 0 // SizeOfHeapCommit | ||
188 | .long 0 // LoaderFlags | ||
189 | .long 0x6 // NumberOfRvaAndSizes | ||
190 | |||
191 | .quad 0 // ExportTable | ||
192 | .quad 0 // ImportTable | ||
193 | .quad 0 // ResourceTable | ||
194 | .quad 0 // ExceptionTable | ||
195 | .quad 0 // CertificationTable | ||
196 | .quad 0 // BaseRelocationTable | ||
197 | |||
198 | // Section table | ||
199 | section_table: | ||
200 | |||
201 | /* | ||
202 | * The EFI application loader requires a relocation section | ||
203 | * because EFI applications must be relocatable. This is a | ||
204 | * dummy section as far as we are concerned. | ||
205 | */ | ||
206 | .ascii ".reloc" | ||
207 | .byte 0 | ||
208 | .byte 0 // end of 0 padding of section name | ||
209 | .long 0 | ||
210 | .long 0 | ||
211 | .long 0 // SizeOfRawData | ||
212 | .long 0 // PointerToRawData | ||
213 | .long 0 // PointerToRelocations | ||
214 | .long 0 // PointerToLineNumbers | ||
215 | .short 0 // NumberOfRelocations | ||
216 | .short 0 // NumberOfLineNumbers | ||
217 | .long 0x42100040 // Characteristics (section flags) | ||
218 | |||
219 | |||
220 | .ascii ".text" | ||
221 | .byte 0 | ||
222 | .byte 0 | ||
223 | .byte 0 // end of 0 padding of section name | ||
224 | .long _edata - stext // VirtualSize | ||
225 | .long stext - efi_head // VirtualAddress | ||
226 | .long _edata - stext // SizeOfRawData | ||
227 | .long stext - efi_head // PointerToRawData | ||
228 | |||
229 | .long 0 // PointerToRelocations (0 for executables) | ||
230 | .long 0 // PointerToLineNumbers (0 for executables) | ||
231 | .short 0 // NumberOfRelocations (0 for executables) | ||
232 | .short 0 // NumberOfLineNumbers (0 for executables) | ||
233 | .long 0xe0500020 // Characteristics (section flags) | ||
234 | .align 5 | ||
235 | #endif | ||
124 | 236 | ||
125 | ENTRY(stext) | 237 | ENTRY(stext) |
126 | mov x21, x0 // x21=FDT | 238 | mov x21, x0 // x21=FDT |