summaryrefslogtreecommitdiffstats
path: root/arch/x86/boot/header.S
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2020-02-12 12:18:17 +0100
committerArd Biesheuvel <ardb@kernel.org>2020-02-23 21:59:42 +0100
commit97aa276579b28b86f4a3e235b50762c0191c2ac3 (patch)
tree3a596783c9cb995088e7d2b6c6c815150e0cfff9 /arch/x86/boot/header.S
parent17054f492dfd4d91e093ebb87013807812ec42a4 (diff)
downloadlinux-97aa276579b28b86f4a3e235b50762c0191c2ac3.tar.gz
linux-97aa276579b28b86f4a3e235b50762c0191c2ac3.tar.bz2
linux-97aa276579b28b86f4a3e235b50762c0191c2ac3.zip
efi/x86: Add true mixed mode entry point into .compat section
Currently, mixed mode is closely tied to the EFI handover protocol and relies on intimate knowledge of the bootparams structure, setup header etc, all of which are rather byzantine and entirely specific to x86. Even though no other EFI supported architectures are currently known that could support something like mixed mode, it still makes sense to abstract a bit from this, and make it part of a generic Linux on EFI boot protocol. To that end, add a .compat section to the mixed mode binary, and populate it with the PE machine type and entry point address, allowing firmware implementations to match it to their native machine type, and invoke non-native binaries using a secondary entry point. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'arch/x86/boot/header.S')
-rw-r--r--arch/x86/boot/header.S20
1 files changed, 19 insertions, 1 deletions
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index d59f6604bb42..44aeb63ca6ae 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -106,7 +106,7 @@ coff_header:
#else
.word 0x8664 # x86-64
#endif
- .word 3 # nr_sections
+ .word section_count # nr_sections
.long 0 # TimeDateStamp
.long 0 # PointerToSymbolTable
.long 1 # NumberOfSymbols
@@ -230,6 +230,23 @@ section_table:
.word 0 # NumberOfLineNumbers
.long 0x42100040 # Characteristics (section flags)
+#ifdef CONFIG_EFI_MIXED
+ #
+ # The offset & size fields are filled in by build.c.
+ #
+ .asciz ".compat"
+ .long 0
+ .long 0x0
+ .long 0 # Size of initialized data
+ # on disk
+ .long 0x0
+ .long 0 # PointerToRelocations
+ .long 0 # PointerToLineNumbers
+ .word 0 # NumberOfRelocations
+ .word 0 # NumberOfLineNumbers
+ .long 0x42100040 # Characteristics (section flags)
+#endif
+
#
# The offset & size fields are filled in by build.c.
#
@@ -248,6 +265,7 @@ section_table:
.word 0 # NumberOfLineNumbers
.long 0x60500020 # Characteristics (section flags)
+ .set section_count, (. - section_table) / 40
#endif /* CONFIG_EFI_STUB */
# Kernel attributes; used by setup. This is part 1 of the