If code is loaded by EFI the loader will relocate the image
under 4GB. This causes offsets in x86 code generated by
sym_offs(SYMBOL) to be relocated too (basically they won't be
offsets from image base). In order to get wanted address
when using sym_offs an sym_esi compensate the difference
in %esi.
Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
xen/arch/x86/boot/head.S | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
Changes since v1:
- Completely different way to cope with the issue, much more easier.
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 666e341bc5..86805389f9 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -380,7 +380,8 @@ x86_32_switch:
lgdt gdt_boot_descr(%rip)
/* Store Xen image load base address in place accessible for 32-bit code. */
- lea __image_base__(%rip),%esi
+ lea __image_base__(%rip), %esi
+ sub $sym_offs(__image_base__), %esi
/* Reload code selector. */
pushq $BOOT_CS32
--
2.45.2