.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2013-2017 Linaro Ltd |
---|
3 | 4 | * Authors: Roy Franz <roy.franz@linaro.org> |
---|
4 | 5 | * Ard Biesheuvel <ard.biesheuvel@linaro.org> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License version 2 as |
---|
8 | | - * published by the Free Software Foundation. |
---|
9 | 6 | */ |
---|
10 | 7 | |
---|
11 | 8 | #include <linux/pe.h> |
---|
12 | 9 | #include <linux/sizes.h> |
---|
13 | 10 | |
---|
14 | 11 | .macro __nop |
---|
15 | | -#ifdef CONFIG_EFI_STUB |
---|
16 | | - @ This is almost but not quite a NOP, since it does clobber the |
---|
17 | | - @ condition flags. But it is the best we can do for EFI, since |
---|
18 | | - @ PE/COFF expects the magic string "MZ" at offset 0, while the |
---|
19 | | - @ ARM/Linux boot protocol expects an executable instruction |
---|
20 | | - @ there. |
---|
21 | | - .inst MZ_MAGIC | (0x1310 << 16) @ tstne r0, #0x4d000 |
---|
22 | | -#else |
---|
23 | 12 | AR_CLASS( mov r0, r0 ) |
---|
24 | 13 | M_CLASS( nop.w ) |
---|
| 14 | + .endm |
---|
| 15 | + |
---|
| 16 | + .macro __initial_nops |
---|
| 17 | +#ifdef CONFIG_EFI_STUB |
---|
| 18 | + @ This is a two-instruction NOP, which happens to bear the |
---|
| 19 | + @ PE/COFF signature "MZ" in the first two bytes, so the kernel |
---|
| 20 | + @ is accepted as an EFI binary. Booting via the UEFI stub |
---|
| 21 | + @ will not execute those instructions, but the ARM/Linux |
---|
| 22 | + @ boot protocol does, so we need some NOPs here. |
---|
| 23 | + .inst MZ_MAGIC | (0xe225 << 16) @ eor r5, r5, 0x4d000 |
---|
| 24 | + eor r5, r5, 0x4d000 @ undo previous insn |
---|
| 25 | +#else |
---|
| 26 | + __nop |
---|
| 27 | + __nop |
---|
25 | 28 | #endif |
---|
26 | 29 | .endm |
---|
27 | 30 | |
---|
.. | .. |
---|
63 | 66 | .long __pecoff_code_size @ SizeOfCode |
---|
64 | 67 | .long __pecoff_data_size @ SizeOfInitializedData |
---|
65 | 68 | .long 0 @ SizeOfUninitializedData |
---|
66 | | - .long efi_stub_entry - start @ AddressOfEntryPoint |
---|
| 69 | + .long efi_pe_entry - start @ AddressOfEntryPoint |
---|
67 | 70 | .long start_offset @ BaseOfCode |
---|
68 | 71 | .long __pecoff_data_start - start @ BaseOfData |
---|
69 | 72 | |
---|
.. | .. |
---|
73 | 76 | .long SZ_512 @ FileAlignment |
---|
74 | 77 | .short 0 @ MajorOsVersion |
---|
75 | 78 | .short 0 @ MinorOsVersion |
---|
76 | | - .short 0 @ MajorImageVersion |
---|
77 | | - .short 0 @ MinorImageVersion |
---|
| 79 | + .short LINUX_EFISTUB_MAJOR_VERSION @ MajorImageVersion |
---|
| 80 | + .short LINUX_EFISTUB_MINOR_VERSION @ MinorImageVersion |
---|
78 | 81 | .short 0 @ MajorSubsystemVersion |
---|
79 | 82 | .short 0 @ MinorSubsystemVersion |
---|
80 | 83 | .long 0 @ Win32VersionValue |
---|