hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/arch/arm/boot/compressed/efi-header.S
....@@ -1,27 +1,30 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (C) 2013-2017 Linaro Ltd
34 * Authors: Roy Franz <roy.franz@linaro.org>
45 * 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.
96 */
107
118 #include <linux/pe.h>
129 #include <linux/sizes.h>
1310
1411 .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
2312 AR_CLASS( mov r0, r0 )
2413 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
2528 #endif
2629 .endm
2730
....@@ -63,7 +66,7 @@
6366 .long __pecoff_code_size @ SizeOfCode
6467 .long __pecoff_data_size @ SizeOfInitializedData
6568 .long 0 @ SizeOfUninitializedData
66
- .long efi_stub_entry - start @ AddressOfEntryPoint
69
+ .long efi_pe_entry - start @ AddressOfEntryPoint
6770 .long start_offset @ BaseOfCode
6871 .long __pecoff_data_start - start @ BaseOfData
6972
....@@ -73,8 +76,8 @@
7376 .long SZ_512 @ FileAlignment
7477 .short 0 @ MajorOsVersion
7578 .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
7881 .short 0 @ MajorSubsystemVersion
7982 .short 0 @ MinorSubsystemVersion
8083 .long 0 @ Win32VersionValue