|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 2/4] x86/efi: Move the trampoline into .init.data for EFI builds
... but keep it in .init.text for xen.gz
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 later is doable (requires coordinated
effort with the MB2 path), but EDID/EDD are problematic. Both needs to be
written before EBS, but the trampoline cannot be placed prior to EBS in all
cases.
Several of these have plans to be addressed, but require other cleanup first.
Leave a TODO to indicate our intent to move this all back into .init.text
eventually.
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>
v2:
* Adjust commit message and comment per discussion on the x86 maintainers
call.
---
xen/arch/x86/boot/head.S | 17 ++++++++++++++++-
xen/arch/x86/xen.lds.S | 6 ++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 981f262b5ec4..655ab6932def 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -711,7 +711,22 @@ 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.
+ *
+ * TODO: Rework xen.efi to not write into the trampoline while it is
+ * part of the main Xen image.
+ */
+ .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 |