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

[PATCH v2 2/2] x86/boot: Avoid relocations in trampoline code to virtual addresses



Add virt_addr macro to make more clear the address we want and making
symbol search easier.
We don't generate direct absolute symbols to virtual addresses to avoid
linker warnings.

Signed-off-by: Frediano Ziglio <frediano.ziglio@xxxxxxxxx>
---
 xen/arch/x86/boot/trampoline.S | 3 ++-
 xen/arch/x86/boot/wakeup.S     | 2 +-
 xen/arch/x86/xen.lds.S         | 2 ++
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S
index 3a6eb942a7..02c713af91 100644
--- a/xen/arch/x86/boot/trampoline.S
+++ b/xen/arch/x86/boot/trampoline.S
@@ -40,6 +40,7 @@
         .popsection
 
 #define phys_addr(sym) sym ## _PA
+#define virt_addr(sym) (sym ## _PA + __XEN_VIRT_START)
 
 /* Start of the permanent trampoline code. */
 
@@ -120,7 +121,7 @@ trampoline_protmode_entry:
         .code64
 start64:
         /* Jump to high mappings. */
-        movabs  $__high_start, %rdi
+        movabs  $virt_addr(__high_start), %rdi
         jmpq    *%rdi
 
 #include "video.h"
diff --git a/xen/arch/x86/boot/wakeup.S b/xen/arch/x86/boot/wakeup.S
index ae4dd5eb40..5ac8ba1fb6 100644
--- a/xen/arch/x86/boot/wakeup.S
+++ b/xen/arch/x86/boot/wakeup.S
@@ -156,7 +156,7 @@ wakeup_32:
         .code64
 wakeup_64:
         /* Jump to high mappings and the higher-level wakeup code. */
-        movabs  $s3_resume, %rbx
+        movabs  $virt_addr(s3_resume), %rbx
         jmp     *%rbx
 
 bogus_saved_magic:
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 5cfbd2524a..b200606278 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -77,6 +77,8 @@ SECTIONS
   DEFINE_PA_ADDRESS(start);
   DEFINE_PA_ADDRESS(saved_magic);
   DEFINE_PA_ADDRESS(idle_pg_table);
+  DEFINE_PA_ADDRESS(__high_start);
+  DEFINE_PA_ADDRESS(s3_resume);
 
   . = __XEN_VIRT_START + XEN_IMG_OFFSET;
   _start = .;
-- 
2.46.0




 


Rackspace

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