@@ -51,6 +51,9 @@ SECTIONS
DECLARE_IMPORT(__trampoline_seg_stop);
DECLARE_IMPORT(trampoline_phys);
DECLARE_IMPORT(boot_vid_info);
+ DECLARE_IMPORT(multiboot_ptr);
+ DECLARE_IMPORT(pvh_boot);
+ DECLARE_IMPORT(pvh_start_info_pa);
. = . + GAP;
*(.text)
*(.text.*)
@@ -515,16 +515,6 @@ trampoline_setup:
/* reloc(magic/eax, info/edx) using fastcall. */
call reloc
-#ifdef CONFIG_PVH_GUEST
- cmpb $0, sym_esi(pvh_boot)
- je 1f
- mov %eax, sym_esi(pvh_start_info_pa)
- jmp 2f
-#endif
-1:
- mov %eax, sym_esi(multiboot_ptr)
-2:
-
/*
* Now trampoline_phys points to the following structure (lowest address
* is at the bottom):
@@ -17,13 +17,15 @@
#include <xen/types.h>
#include <xen/kconfig.h>
-#include <xen/multiboot.h>
#include <xen/multiboot2.h>
#include <xen/page-size.h>
+#include <xen/bug.h>
#include <asm/trampoline.h>
+#include <asm/setup.h>
#include <public/arch-x86/hvm/start_info.h>
+#include <asm/guest/pvh-boot.h>
#ifdef CONFIG_VIDEO
# include "video.h"
@@ -347,28 +349,42 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, memctx *ctx)
}
/* SAF-1-safe */
-void *reloc(uint32_t magic, uint32_t in)
+void reloc(uint32_t magic, uint32_t in)
{
/* Get bottom-most low-memory stack address. */
memctx ctx = { trampoline_phys + TRAMPOLINE_SPACE };
+ void *res;
+
switch ( magic )
{
case MULTIBOOT_BOOTLOADER_MAGIC:
- return mbi_reloc(in, &ctx);
+ res = mbi_reloc(in, &ctx);
+ break;
case MULTIBOOT2_BOOTLOADER_MAGIC:
- return mbi2_reloc(in, &ctx);
+ res = mbi2_reloc(in, &ctx);
+ break;
case XEN_HVM_START_MAGIC_VALUE:
if ( IS_ENABLED(CONFIG_PVH_GUEST) )
- return pvh_info_reloc(in, &ctx);
+ {
+ res = pvh_info_reloc(in, &ctx);
+ break;
+ }
/* Fallthrough */
default:
/* Nothing we can do */
- return NULL;
+ res = NULL;
}
+
+#ifdef CONFIG_PVH_GUEST
+ if ( pvh_boot )
+ pvh_start_info_pa = (unsigned long)res;
+#endif
+
+ multiboot_ptr = (unsigned long)res;
}
/*
@@ -13,6 +13,7 @@
#ifdef CONFIG_PVH_GUEST
extern bool pvh_boot;
+extern uint32_t pvh_start_info_pa;
void pvh_init(multiboot_info_t **mbi, module_t **mod);
void pvh_print_info(void);
Initialise multiboot_ptr and pvh_start_info_pa from C code. Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com> --- xen/arch/x86/boot/build32.lds.S | 3 +++ xen/arch/x86/boot/head.S | 10 -------- xen/arch/x86/boot/reloc.c | 28 ++++++++++++++++++----- xen/arch/x86/include/asm/guest/pvh-boot.h | 1 + 4 files changed, 26 insertions(+), 16 deletions(-)