[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 4/5] x86: Compensate relocation in case of EFI



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@xxxxxxxxx>
---
 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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.