@@ -54,6 +54,7 @@ SECTIONS
DECLARE_IMPORT(multiboot_ptr);
DECLARE_IMPORT(pvh_boot);
DECLARE_IMPORT(pvh_start_info_pa);
+ DECLARE_IMPORT(early_boot_opts);
. = . + GAP;
*(.text)
*(.text.*)
@@ -22,6 +22,9 @@
#include <xen/kconfig.h>
#include <xen/macros.h>
#include <xen/types.h>
+#include <xen/multiboot.h>
+
+#include <asm/setup.h>
#include "video.h"
@@ -39,6 +42,8 @@ typedef struct __packed {
#endif
} early_boot_opts_t;
+extern early_boot_opts_t early_boot_opts;
+
/* Avoid pulling in all of ctypes.h for this. */
#define tolower(c) ((c) | 0x20)
@@ -335,10 +340,15 @@ static void vga_parse(const char *cmdline, early_boot_opts_t *ebo)
#endif
/* SAF-1-safe */
-void cmdline_parse_early(const char *cmdline, early_boot_opts_t *ebo)
+void cmdline_parse_early(void)
{
- if ( !cmdline )
+ early_boot_opts_t *ebo = &early_boot_opts;
+ struct multiboot_info *mbi = (void *)multiboot_ptr;
+ const char *cmdline;
+
+ if ( !(mbi->flags & MBI_CMDLINE) || !mbi->cmdline )
return;
+ cmdline = (void *)mbi->cmdline;
ebo->skip_realmode = skip_realmode(cmdline);
ebo->opt_edd = edd_parse(cmdline);
@@ -690,14 +690,7 @@ trampoline_setup:
cmpb $0, sym_esi(efi_platform)
jnz 1f
- /* Bail if there is no command line to parse. */
- mov sym_esi(multiboot_ptr), %ebx
- testl $MBI_CMDLINE,MB_flags(%ebx)
- jz 1f
-
- lea sym_esi(early_boot_opts), %edx
- mov MB_cmdline(%ebx), %eax
- /* cmdline_parse_early(cmdline/eax, opts/edx) using fastcall. */
+ /* cmdline_parse_early using fastcall. */
call cmdline_parse_early
1:
@@ -258,7 +258,7 @@ trampoline_boot_cpu_entry:
.align 2
/* Keep in sync with cmdline.c:early_boot_opts_t type! */
-early_boot_opts:
+GLOBAL(early_boot_opts)
skip_realmode:
.byte 0
opt_edd:
@@ -16,6 +16,8 @@ extern uint64_t boot_tsc_stamp;
extern void *stack_start;
extern unsigned int multiboot_ptr;
+struct domain;
+
void early_cpu_init(bool verbose);
void early_time_init(void);
new file mode 100644
@@ -0,0 +1 @@
+/* Empty. */
new file mode 100644
@@ -0,0 +1,10 @@
+#ifndef BOOT__XEN__STRING_H
+#define BOOT__XEN__STRING_H
+
+#include <xen/types.h> /* for size_t */
+
+void *memset(void *s, int c, size_t n);
+void *memcpy(void *dest, const void *src, size_t n);
+void *memmove(void *dest, const void *src, size_t n);
+
+#endif /* BOOT__XEN__STRING_H */
Move some assembly code to C. Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com> --- xen/arch/x86/boot/build32.lds.S | 1 + xen/arch/x86/boot/cmdline.c | 14 ++++++++++++-- xen/arch/x86/boot/head.S | 9 +-------- xen/arch/x86/boot/trampoline.S | 2 +- xen/arch/x86/include/asm/setup.h | 2 ++ xen/arch/x86/include/boot/xen/cpumask.h | 1 + xen/arch/x86/include/boot/xen/string.h | 10 ++++++++++ 7 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 xen/arch/x86/include/boot/xen/cpumask.h create mode 100644 xen/arch/x86/include/boot/xen/string.h