Instead of relocate the value at that position compute it
entirely and write it.
During EFI boots sym_offs(SYMBOL) are potentially relocated
causing the values to be corrupted.
For PVH and BIOS the change won't be necessary but keep the
code consistent.
Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
xen/arch/x86/boot/head.S | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 5b82221038..abfa3d82f7 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -132,8 +132,7 @@ multiboot2_header:
gdt_boot_descr:
.word .Ltrampoline_gdt_end - trampoline_gdt - 1
gdt_boot_base:
- .long sym_offs(trampoline_gdt)
- .long 0 /* Needed for 64-bit lgdt */
+ .quad 0 /* Needed for 64-bit lgdt */
vga_text_buffer:
.long 0xb8000
@@ -392,15 +391,16 @@ __efi64_mb2_start:
x86_32_switch:
mov %r15,%rdi
- /* Store Xen image load base address in place accessible for 32-bit code. */
- lea __image_base__(%rip),%esi
-
cli
/* Initialize GDTR. */
- add %esi,gdt_boot_base(%rip)
+ lea trampoline_gdt(%rip),%esi
+ movl %esi,gdt_boot_base(%rip)
lgdt gdt_boot_descr(%rip)
+ /* Store Xen image load base address in place accessible for 32-bit code. */
+ lea __image_base__(%rip),%esi
+
/* Reload code selector. */
pushq $BOOT_CS32
lea cs32_switch(%rip),%edx
@@ -458,7 +458,8 @@ __pvh_start:
movb $-1, sym_esi(opt_console_xen)
/* Prepare gdt and segments */
- add %esi, sym_esi(gdt_boot_base)
+ lea sym_esi(trampoline_gdt), %ecx
+ movl %ecx, sym_esi(gdt_boot_base)
lgdt sym_esi(gdt_boot_descr)
mov $BOOT_DS, %ecx
@@ -562,7 +563,8 @@ trampoline_bios_setup:
*
* Initialize GDTR and basic data segments.
*/
- add %esi,sym_esi(gdt_boot_base)
+ lea sym_esi(trampoline_gdt), %ecx
+ movl %ecx, sym_esi(gdt_boot_base)
lgdt sym_esi(gdt_boot_descr)
mov $BOOT_DS,%ecx
--
2.45.2