:p
atchew
Login
As a continuation of this series start sorting out the issue of headers not compatible with 32 bit. Instead of having to change headers which are almost only used for 64 bit allows to override headers or move reusable definitions to new shared headers. This results in less changes. Frediano Ziglio (4): Use an include/boot directory to override headers for boot code x86/boot: Use header to allows inclusion of public xen.h header x86/boot: Move some settings to C x86/boot: Use external symbols from cmdline_parse_early xen/arch/x86/boot/Makefile | 2 +- xen/arch/x86/boot/build32.lds.S | 4 ++++ xen/arch/x86/boot/cmdline.c | 14 ++++++++++-- xen/arch/x86/boot/head.S | 19 +-------------- xen/arch/x86/boot/reloc.c | 28 ++++++++++++++++++----- xen/arch/x86/boot/trampoline.S | 2 +- xen/arch/x86/include/asm/guest/pvh-boot.h | 1 + xen/arch/x86/include/asm/setup.h | 2 ++ xen/arch/x86/include/boot/public/xen.h | 28 +++++++++++++++++++++++ xen/arch/x86/include/boot/xen/cpumask.h | 1 + xen/arch/x86/include/boot/xen/string.h | 10 ++++++++ 11 files changed, 83 insertions(+), 28 deletions(-) create mode 100644 xen/arch/x86/include/boot/public/xen.h create mode 100644 xen/arch/x86/include/boot/xen/cpumask.h create mode 100644 xen/arch/x86/include/boot/xen/string.h -- 2.34.1
Not all headers can be used by 32 bit boot code. Allows to override some headers, we don't want to mess up with main headers as most of the code is only 64 bit so the easy stuff should be done for 64 bit declarations. Boot headers should be 64 bit compatibles to avoid having multiple declarations. Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com> --- xen/arch/x86/boot/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/boot/Makefile +++ b/xen/arch/x86/boot/Makefile @@ -XXX,XX +XXX,XX @@ CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS)) $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS)) CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3 CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS)) -CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS)) -D__XEN__ +CFLAGS_x86_32 += -I$(srctree)/arch/x86/include/boot $(filter -I% -O%,$(XEN_CFLAGS)) -D__XEN__ # override for 32bit binaries $(obj32): CFLAGS_stack_boundary := -- 2.34.1
This allows to include other headers and avoid duplicated declarations. Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com> --- xen/arch/x86/include/boot/public/xen.h | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 xen/arch/x86/include/boot/public/xen.h diff --git a/xen/arch/x86/include/boot/public/xen.h b/xen/arch/x86/include/boot/public/xen.h new file mode 100644 index XXXXXXX..XXXXXXX --- /dev/null +++ b/xen/arch/x86/include/boot/public/xen.h @@ -XXX,XX +XXX,XX @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +/* This header allows the inclusion of public xen.h */ + +#ifndef BOOT__PUBLIC__XEN_H +#define BOOT__PUBLIC__XEN_H + +#if !defined(__XEN__) || defined(__XEN_TOOLS__) || __XEN__ != 1 +#error Unexpected defines +#endif + +#include <xen/types.h> + +#ifdef __i386__ + +# define __XEN_TOOLS__ 1 +# undef __XEN__ +# include <public/arch-x86/xen.h> +# define __XEN__ 1 +# undef __XEN_TOOLS__ + +#else + +# include <public/arch-x86/xen.h> + +#endif + +#endif /* BOOT__PUBLIC__XEN_H */ -- 2.34.1
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(-) diff --git a/xen/arch/x86/boot/build32.lds.S b/xen/arch/x86/boot/build32.lds.S index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/boot/build32.lds.S +++ b/xen/arch/x86/boot/build32.lds.S @@ -XXX,XX +XXX,XX @@ 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.*) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -XXX,XX +XXX,XX @@ 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): diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -XXX,XX +XXX,XX @@ #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" @@ -XXX,XX +XXX,XX @@ 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; } /* diff --git a/xen/arch/x86/include/asm/guest/pvh-boot.h b/xen/arch/x86/include/asm/guest/pvh-boot.h index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/include/asm/guest/pvh-boot.h +++ b/xen/arch/x86/include/asm/guest/pvh-boot.h @@ -XXX,XX +XXX,XX @@ #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); -- 2.34.1
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 diff --git a/xen/arch/x86/boot/build32.lds.S b/xen/arch/x86/boot/build32.lds.S index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/boot/build32.lds.S +++ b/xen/arch/x86/boot/build32.lds.S @@ -XXX,XX +XXX,XX @@ SECTIONS DECLARE_IMPORT(multiboot_ptr); DECLARE_IMPORT(pvh_boot); DECLARE_IMPORT(pvh_start_info_pa); + DECLARE_IMPORT(early_boot_opts); . = . + GAP; *(.text) *(.text.*) diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/boot/cmdline.c +++ b/xen/arch/x86/boot/cmdline.c @@ -XXX,XX +XXX,XX @@ #include <xen/kconfig.h> #include <xen/macros.h> #include <xen/types.h> +#include <xen/multiboot.h> + +#include <asm/setup.h> #include "video.h" @@ -XXX,XX +XXX,XX @@ 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) @@ -XXX,XX +XXX,XX @@ 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); diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -XXX,XX +XXX,XX @@ 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: diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/boot/trampoline.S +++ b/xen/arch/x86/boot/trampoline.S @@ -XXX,XX +XXX,XX @@ 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: diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/include/asm/setup.h +++ b/xen/arch/x86/include/asm/setup.h @@ -XXX,XX +XXX,XX @@ 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); diff --git a/xen/arch/x86/include/boot/xen/cpumask.h b/xen/arch/x86/include/boot/xen/cpumask.h new file mode 100644 index XXXXXXX..XXXXXXX --- /dev/null +++ b/xen/arch/x86/include/boot/xen/cpumask.h @@ -0,0 +1 @@ +/* Empty. */ diff --git a/xen/arch/x86/include/boot/xen/string.h b/xen/arch/x86/include/boot/xen/string.h new file mode 100644 index XXXXXXX..XXXXXXX --- /dev/null +++ b/xen/arch/x86/include/boot/xen/string.h @@ -XXX,XX +XXX,XX @@ +#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 */ -- 2.34.1
As a continuation of this series start sorting out the issue of headers not compatible with 32 bit. Instead of having to change headers which are almost only used for 64 bit allows to override headers or move reusable definitions to new shared headers. This results in less changes. Changes since v1: - rebased (with conflicts). Frediano Ziglio (4): Use an include/boot directory to override headers for boot code x86/boot: Use header to allows inclusion of public xen.h header x86/boot: Move some settings to C x86/boot: Use external symbols from cmdline_parse_early xen/arch/x86/boot/Makefile | 2 +- xen/arch/x86/boot/build32.lds.S | 4 ++++ xen/arch/x86/boot/cmdline.c | 14 ++++++++++-- xen/arch/x86/boot/head.S | 19 +-------------- xen/arch/x86/boot/reloc.c | 28 ++++++++++++++++++----- xen/arch/x86/boot/trampoline.S | 2 +- xen/arch/x86/include/asm/guest/pvh-boot.h | 1 + xen/arch/x86/include/asm/setup.h | 2 ++ xen/arch/x86/include/boot/public/xen.h | 28 +++++++++++++++++++++++ xen/arch/x86/include/boot/xen/cpumask.h | 1 + xen/arch/x86/include/boot/xen/string.h | 10 ++++++++ 11 files changed, 83 insertions(+), 28 deletions(-) create mode 100644 xen/arch/x86/include/boot/public/xen.h create mode 100644 xen/arch/x86/include/boot/xen/cpumask.h create mode 100644 xen/arch/x86/include/boot/xen/string.h -- 2.34.1
Not all headers can be used by 32 bit boot code. Allows to override some headers, we don't want to mess up with main headers as most of the code is only 64 bit so the easy stuff should be done for 64 bit declarations. Boot headers should be 64 bit compatibles to avoid having multiple declarations. Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com> --- xen/arch/x86/boot/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/boot/Makefile +++ b/xen/arch/x86/boot/Makefile @@ -XXX,XX +XXX,XX @@ CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS)) $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS)) CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3 CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS)) -CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS)) -D__XEN__ +CFLAGS_x86_32 += -I$(srctree)/arch/x86/include/boot $(filter -I% -O%,$(XEN_CFLAGS)) -D__XEN__ # override for 32bit binaries $(obj32): CFLAGS_stack_boundary := -- 2.34.1
This allows to include other headers and avoid duplicated declarations. Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com> --- xen/arch/x86/include/boot/public/xen.h | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 xen/arch/x86/include/boot/public/xen.h diff --git a/xen/arch/x86/include/boot/public/xen.h b/xen/arch/x86/include/boot/public/xen.h new file mode 100644 index XXXXXXX..XXXXXXX --- /dev/null +++ b/xen/arch/x86/include/boot/public/xen.h @@ -XXX,XX +XXX,XX @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +/* This header allows the inclusion of public xen.h */ + +#ifndef BOOT__PUBLIC__XEN_H +#define BOOT__PUBLIC__XEN_H + +#if !defined(__XEN__) || defined(__XEN_TOOLS__) || __XEN__ != 1 +#error Unexpected defines +#endif + +#include <xen/types.h> + +#ifdef __i386__ + +# define __XEN_TOOLS__ 1 +# undef __XEN__ +# include <public/arch-x86/xen.h> +# define __XEN__ 1 +# undef __XEN_TOOLS__ + +#else + +# include <public/arch-x86/xen.h> + +#endif + +#endif /* BOOT__PUBLIC__XEN_H */ -- 2.34.1
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(-) diff --git a/xen/arch/x86/boot/build32.lds.S b/xen/arch/x86/boot/build32.lds.S index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/boot/build32.lds.S +++ b/xen/arch/x86/boot/build32.lds.S @@ -XXX,XX +XXX,XX @@ 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.*) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -XXX,XX +XXX,XX @@ 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: - /* Interrogate CPU extended features via CPUID. */ mov $1, %eax cpuid diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -XXX,XX +XXX,XX @@ #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" @@ -XXX,XX +XXX,XX @@ 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) { memctx ctx = { trampoline_phys + TRAMPOLINE_HEAP_END }; + 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; } /* diff --git a/xen/arch/x86/include/asm/guest/pvh-boot.h b/xen/arch/x86/include/asm/guest/pvh-boot.h index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/include/asm/guest/pvh-boot.h +++ b/xen/arch/x86/include/asm/guest/pvh-boot.h @@ -XXX,XX +XXX,XX @@ #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); -- 2.34.1
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 diff --git a/xen/arch/x86/boot/build32.lds.S b/xen/arch/x86/boot/build32.lds.S index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/boot/build32.lds.S +++ b/xen/arch/x86/boot/build32.lds.S @@ -XXX,XX +XXX,XX @@ SECTIONS DECLARE_IMPORT(multiboot_ptr); DECLARE_IMPORT(pvh_boot); DECLARE_IMPORT(pvh_start_info_pa); + DECLARE_IMPORT(early_boot_opts); . = . + GAP; *(.text) *(.text.*) diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/boot/cmdline.c +++ b/xen/arch/x86/boot/cmdline.c @@ -XXX,XX +XXX,XX @@ #include <xen/kconfig.h> #include <xen/macros.h> #include <xen/types.h> +#include <xen/multiboot.h> + +#include <asm/setup.h> #include "video.h" @@ -XXX,XX +XXX,XX @@ 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) @@ -XXX,XX +XXX,XX @@ 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); diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -XXX,XX +XXX,XX @@ 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: diff --git a/xen/arch/x86/boot/trampoline.S b/xen/arch/x86/boot/trampoline.S index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/boot/trampoline.S +++ b/xen/arch/x86/boot/trampoline.S @@ -XXX,XX +XXX,XX @@ 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: diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h index XXXXXXX..XXXXXXX 100644 --- a/xen/arch/x86/include/asm/setup.h +++ b/xen/arch/x86/include/asm/setup.h @@ -XXX,XX +XXX,XX @@ 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); diff --git a/xen/arch/x86/include/boot/xen/cpumask.h b/xen/arch/x86/include/boot/xen/cpumask.h new file mode 100644 index XXXXXXX..XXXXXXX --- /dev/null +++ b/xen/arch/x86/include/boot/xen/cpumask.h @@ -0,0 +1 @@ +/* Empty. */ diff --git a/xen/arch/x86/include/boot/xen/string.h b/xen/arch/x86/include/boot/xen/string.h new file mode 100644 index XXXXXXX..XXXXXXX --- /dev/null +++ b/xen/arch/x86/include/boot/xen/string.h @@ -XXX,XX +XXX,XX @@ +#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 */ -- 2.34.1