|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 2/4] x86/efi: Move the trampoline into .init.data for EFI builds
... but keep it in .init.text for xen.gz
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Anthony PERARD <anthony.perard@xxxxxxxxxx>
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Michal Orzel <michal.orzel@xxxxxxx>
CC: Doug Goldstein <cardoe@xxxxxxxxxx>
CC: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
CC: Jan Beulich <jbeulich@xxxxxxxx>
CC: Roger Pau Monné <roger@xxxxxxxxxxxxxx>
CC: Teddy Astie <teddy.astie@xxxxxxxxxx>
CC: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
CC: Frediano Ziglio <freddy77@xxxxxxxxx>
In an ideal world, we'd remove all xen.efi writes into the trampoline while
it's part of the Xen image. Two (trampoline_efer, trampoline_xen_phys_start)
are easy to fix. Applying relocations is doable (requires coordinated effort
with the MB2 path), but EDID is problem write. EDID needs to be written
before EBS, but the trampoline cannot be placed prior to EBS in all cases.
It isn't completely ideal to use "a" rather than "ax" or "aw" but it is
necessary given that head.S is built only once. It means that the trampoline
is only disassemblable in xen-syms, not head.o.
I admit that this justification is getting a little flimsy, yet I do
disassemble the trampoline on a concerningly frequent basis.
---
xen/arch/x86/boot/head.S | 14 +++++++++++++-
xen/arch/x86/xen.lds.S | 6 ++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 981f262b5ec4..3c396cd952c3 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -711,7 +711,19 @@ trampoline_setup:
/* Jump into the relocated trampoline. */
lret
- .section .init.text, "ax", @progbits
+ /*
+ * In an ideal world, the trampoline would live in .init.text, as it
+ * is necessary to disassemble during development.
+ *
+ * However, xen.efi writes into the trampoline while it's part of the
+ * main Xen image. xen.efi needs to be StrictNX compatible
+ * (i.e. writable sections must not be executable), so must have the
+ * trampoline in a data section.
+ *
+ * Put the trampoline in a dedicated section so the final link can
+ * place it appropriately.
+ */
+ .section .init.trampoline, "a", @progbits
ENTRY(trampoline_start)
#include "trampoline.S"
ENTRY(trampoline_end)
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 888d5293f3d6..cef3d404a1a8 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -200,6 +200,9 @@ SECTIONS
_sinittext = .;
*(.init.multiboot)
*(.init.text)
+#ifndef EFI /* Non-EFI wants the trampoline in .init.text for disassembly. */
+ *(.init.trampoline)
+#endif
*(.text.startup)
_einittext = .;
/*
@@ -232,6 +235,9 @@ SECTIONS
*(.init.data.multiboot)
*(.init.data)
+#ifdef EFI /* EFI needs the trampoline in .init.data for StrictNX
compatibility. */
+ *(.init.trampoline)
+#endif
*(.init.data.rel)
*(.init.data.rel.*)
. = ALIGN(4);
--
2.39.5
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |