Change xen.efi build and add SHIM_LOCK verification into efi_multiboot2()
RFC PATCH 1/7 xen: Introduce XEN_COMPILE_POSIX_TIME
In reply to Daniel KiperWe need the POSIX time to properly fill the TimeDateStamp field in the PE header.
--- xen/Makefile | 14 ++++++++------ xen/include/xen/compile.h.in | 1 + 2 files changed, 9 insertions(+), 6 deletions(-)
xen/Makefile +8 -6
@@ -6,12 +6,13 @@ export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION) export XEN_FULLVERSION = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION) -include xen-version -export XEN_WHOAMI ?= $(USER) -export XEN_DOMAIN ?= $(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown])) -export XEN_BUILD_DATE ?= $(shell LC_ALL=C date) -export XEN_BUILD_TIME ?= $(shell LC_ALL=C date +%T) -export XEN_BUILD_HOST ?= $(shell hostname) -export XEN_CONFIG_EXPERT ?= n +export XEN_WHOAMI ?= $(USER) +export XEN_DOMAIN ?= $(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown])) +export XEN_BUILD_DATE ?= $(shell LC_ALL=C date) +export XEN_BUILD_TIME ?= $(shell LC_ALL=C date +%T) +export XEN_BUILD_POSIX_TIME ?= $(shell LC_ALL=C date +%s) +export XEN_BUILD_HOST ?= $(shell hostname) +export XEN_CONFIG_EXPERT ?= n export BASEDIR := $(CURDIR) export XEN_ROOT := $(BASEDIR)/..
@@ -164,6 +165,7 @@ delete-unfresh-files: include/xen/compile.h: include/xen/compile.h.in .banner @sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \ -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \ + -e 's/@@posix_time@@/$(XEN_BUILD_POSIX_TIME)/g' \ -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \ -e 's/@@domain@@/$(XEN_DOMAIN)/g' \ -e 's/@@hostname@@/$(XEN_BUILD_HOST)/g' \
xen/include/xen/compile.h.in +1 -0
@@ -1,5 +1,6 @@ #define XEN_COMPILE_DATE "@@date@@" #define XEN_COMPILE_TIME "@@time@@" +#define XEN_COMPILE_POSIX_TIME @@posix_time@@ #define XEN_COMPILE_BY "@@whoami@@" #define XEN_COMPILE_DOMAIN "@@domain@@" #define XEN_COMPILE_HOST "@@hostname@@"
Signature · 7 lines
1.7.10.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
cover Change xen.efi build and add SHIM_LOCK verification into efi_multiboot2()
Hey,
As in subject... This way we get:
- one binary which can be loaded by the EFI loader, Multiboot and Multiboot2 protocols,
- if we wish, in the future we can drop xen/xen.gz and build xen.efi only,
- crash dumps generated by the xen.efi loaded from the EFI loader can be analyzed by crash tool,
- simpler code,
- simpler build,
- Xen build will no longer depend on ld i386pep support.
This is RFC, so, e.g. xen.mb.efi does not boot if loaded from EFI loader.
TODO:
- make xen.mb.efi bootable from EFI loader which probably requires some changes in the code relocating trampoline,
- drop old PE build code,
- remove build recipes for old PE code,
- drop xen ELF build recipes (now or later?),
- cleanup the code.
Daniel
xen/Makefile | 14 ++++--- xen/arch/x86/Makefile | 1 + xen/arch/x86/Rules.mk | 2 + xen/arch/x86/boot/head.S | 197 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- xen/arch/x86/efi/efi-boot.h | 12 +++++- xen/arch/x86/efi/stub.c | 5 ++- xen/arch/x86/xen.lds.S | 16 ++++++- xen/common/efi/boot.c | 19 ++++++--- xen/include/xen/compile.h.in | 1 + 9 files changed, 245 insertions(+), 22 deletions(-)
Daniel Kiper (7):
xen: Introduce XEN_COMPILE_POSIX_TIME
xen/x86: Manually build PE header
xen/x86: Add some addresses to the Multiboot header
xen/x86: Add some addresses to the Multiboot2 header
efi: split out efi_shim_lock()
xen/x86/efi: Verify dom0 kernel with SHIM_LOCK protocol in efi_multiboot2() xen/x86: Build xen.mb.efi directly from xen-syms
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
RFC PATCH 2/7 xen/x86: Manually build PE header
This is the first step to get:
- one binary which can be loaded by the EFI loader, Multiboot and Multiboot2 protocols,
- if we wish, in the future we can drop xen/xen.gz and build xen.efi only,
- crash dumps generated by the xen.efi loaded from the EFI loader can be analyzed by crash tool,
- simpler code,
- simpler build,
- Xen build will no longer depend on ld i386pep support.
--- xen/arch/x86/Rules.mk | 2 + xen/arch/x86/boot/head.S | 145 ++++++++++++++++++++++++++++++++++++++++++++++ xen/arch/x86/xen.lds.S | 16 ++++- 3 files changed, 162 insertions(+), 1 deletion(-)
xen/arch/x86/Rules.mk +2 -0
@@ -7,6 +7,8 @@ CFLAGS += -I$(BASEDIR)/include CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET) +CFLAGS += -DXEN_LOAD_ALIGN=XEN_IMG_OFFSET +CFLAGS += -DXEN_FILE_ALIGN=PAGE_SIZE CFLAGS += '-D__OBJECT_LABEL__=$(subst /,$$,$(subst -,_,$(subst $(BASEDIR)/,,$(CURDIR))/$@))' # Prevent floating-point variables from creeping into Xen.
xen/arch/x86/boot/head.S +145 -0
154 lines not on this page · raw message
xen/arch/x86/xen.lds.S +15 -1
@@ -54,7 +54,12 @@ SECTIONS __2M_text_start = .; /* Start of 2M superpages, mapped RX. */ #endif - . = __XEN_VIRT_START + XEN_IMG_OFFSET; + . = __XEN_VIRT_START + XEN_IMG_OFFSET - efi_pe_head_end + efi_pe_head; + + .efi.pe.header : { + *(.efi.pe.header) + } :NONE + _start = .; .text : { _stext = .; /* Text and read-only data */
@@ -234,6 +239,8 @@ SECTIONS *(.data.rel) *(.data.rel.*) CONSTRUCTORS + /* PE file must end at XEN_FILE_ALIGN boundary. */ + . = ALIGN(XEN_FILE_ALIGN); } :text .bss : { /* BSS */
@@ -259,6 +266,8 @@ SECTIONS #endif __2M_rwdata_end = .; + __pe_SizeOfImage = ALIGN(. - __image_base__, XEN_LOAD_ALIGN); + #ifdef EFI . = ALIGN(4); .reloc : {
@@ -337,3 +346,8 @@ ASSERT((trampoline_end - trampoline_start) < TRAMPOLINE_SPACE - MBI_SPACE_MIN, "not enough room for trampoline and mbi data") ASSERT((wakeup_stack - wakeup_stack_start) >= WAKEUP_STACK_MIN, "wakeup stack too small") + +ASSERT(efi_pe_head_end == _start, "PE header does not end at the beginning of .text section") +ASSERT(_start == __XEN_VIRT_START + XEN_IMG_OFFSET, ".text section begins at wrong address") +ASSERT(IS_ALIGNED(_start, XEN_FILE_ALIGN), "_start misaligned") +ASSERT(IS_ALIGNED(__bss_start, XEN_FILE_ALIGN), "__bss_start misaligned")
Signature · 7 lines
1.7.10.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
RFC PATCH 5/7 efi: split out efi_shim_lock()
In reply to Daniel Kiper..which verifies PE signatures with SHIM_LOCK protocol. We want to re-use this code in subsequent patch in efi_multiboot2().
--- xen/common/efi/boot.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
xen/common/efi/boot.c +13 -6
@@ -124,6 +124,7 @@ static void efi_console_set_mode(void);static EFI_GRAPHICS_OUTPUT_PROTOCOL *efi_get_gop (void );static UINTN efi_find_gop_mode (EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,UINTN cols,UINTN rows,UINTN depth); +static void efi_shim_lock (VOID *Buffer,UINT32 Size);static void efi_tables (void );static void setup_efi_pci (void );static void efi_variables (void );
@@ -797,6 +798,17 @@ static UINTN __init efi_find_gop_mode(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop,return gop_mode; } +static void __init efi_shim_lock (VOID *Buffer,UINT32 Size) +{ +static EFI_GUID __initdata shim_lock_guid =SHIM_LOCK_PROTOCOL_GUID ; +EFI_SHIM_LOCK_PROTOCOL *shim_lock; +EFI_STATUS status; + +if ( !EFI_ERROR (efi_bs->LocateProtocol (&shim_lock_guid,NULL , (void **)&shim_lock)) && + (status = shim_lock->Verify (Buffer, Size)) !=EFI_SUCCESS ) +PrintErrMesg (L"Dom0 kernel image could not be verified" , status); +} +static void __init efi_tables (void ) {unsigned int i;
@@ -1062,13 +1074,11 @@ void EFIAPI __init noreturn efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { static EFI_GUID __initdata loaded_image_guid = LOADED_IMAGE_PROTOCOL; -static EFI_GUID __initdata shim_lock_guid =SHIM_LOCK_PROTOCOL_GUID ;EFI_LOADED_IMAGE *loaded_image;EFI_STATUS status;unsigned int i, argc;CHAR16 **argv, *file_name, *cfg_file_name =NULL , *options =NULL ;UINTN gop_mode = ~0 ; -EFI_SHIM_LOCK_PROTOCOL *shim_lock;EFI_GRAPHICS_OUTPUT_PROTOCOL *gop =NULL ;union string section = {NULL }, name;bool base_video = false;
@@ -1225,10 +1235,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)read_file (dir_handle,s2w (&name), &kernel, option_str); efi_bs->FreePool (name.w); -if ( !EFI_ERROR (efi_bs->LocateProtocol (&shim_lock_guid,NULL , - (void **)&shim_lock)) && - (status = shim_lock->Verify (kernel.ptr, kernel.size)) !=EFI_SUCCESS ) -PrintErrMesg (L"Dom0 kernel image could not be verified" , status); +efi_shim_lock (kernel.ptr, kernel.size); name.s =get_value (&cfg, section.s,"ramdisk" );if ( name.s )
Signature · 7 lines
1.7.10.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
RFC PATCH 3/7 xen/x86: Add some addresses to the Multiboot header
In reply to Daniel KiperIn comparison to ELF the PE format is not supported by the Multiboot protocol. So, if we wish to load xen.efi using this protocol we have to put header_addr, load_addr, load_end_addr, bss_end_addr and entry_addr data into Multiboot header.
--- xen/arch/x86/boot/head.S | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
xen/arch/x86/boot/head.S +12 -1
@@ -195,13 +195,24 @@ ENTRY(start) .align 4 multiboot1_header_start: /*** MULTIBOOT1 HEADER ****/ #define MULTIBOOT_HEADER_FLAGS (MULTIBOOT_HEADER_MODS_ALIGNED | \ - MULTIBOOT_HEADER_WANT_MEMORY) + MULTIBOOT_HEADER_WANT_MEMORY | \ + MULTIBOOT_HEADER_HAS_ADDR) /* Magic number indicating a Multiboot header. */ .long MULTIBOOT_HEADER_MAGIC /* Flags to bootloader (see Multiboot spec). */ .long MULTIBOOT_HEADER_FLAGS /* Checksum: must be the negated sum of the first two fields. */ .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) + /* header_addr */ + .long sym_offs(multiboot1_header_start) + /* load_addr */ + .long sym_offs(start) + /* load_end_addr */ + .long sym_offs(__bss_start) + /* bss_end_addr */ + .long sym_offs(__2M_rwdata_end) + /* entry_addr */ + .long sym_offs(__start) multiboot1_header_end: /*** MULTIBOOT2 HEADER ****/
Signature · 7 lines
1.7.10.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
RFC PATCH 4/7 xen/x86: Add some addresses to the Multiboot2 header
In reply to Daniel KiperIn comparison to ELF the PE format is not supported by the Multiboot2 protocol. So, if we wish to load xen.efi using this protocol we have to add MULTIBOOT2_HEADER_TAG_ADDRESS and MULTIBOOT2_HEADER_TAG_ENTRY_ADDRESS tags into Multiboot2 header.
Additionally, put MULTIBOOT2_HEADER_TAG_ENTRY_ADDRESS and MULTIBOOT2_HEADER_TAG_ENTRY_ADDRESS_EFI64 tags close to each other.
--- xen/arch/x86/boot/head.S | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
xen/arch/x86/boot/head.S +15 -4
@@ -237,6 +237,13 @@ multiboot2_header_start: /* Align modules at page boundry. */ mb2ht_init MB2_HT(MODULE_ALIGN), MB2_HT(REQUIRED) + /* The address tag. */ + mb2ht_init MB2_HT(ADDRESS), MB2_HT(REQUIRED), \ + sym_offs(multiboot2_header_start), /* header_addr */ \ + sym_offs(start), /* load_addr */ \ + sym_offs(__bss_start), /* load_end_addr */ \ + sym_offs(__2M_rwdata_end) /* bss_end_addr */ + /* Load address preference. */ mb2ht_init MB2_HT(RELOCATABLE), MB2_HT(OPTIONAL), \ sym_offs(start), /* Min load address. */ \
@@ -244,6 +251,14 @@ multiboot2_header_start: 0x200000, /* Load address alignment (2 MiB). */ \ MULTIBOOT2_LOAD_PREFERENCE_HIGH + /* Multiboot2 entry point. */ + mb2ht_init MB2_HT(ENTRY_ADDRESS), MB2_HT(REQUIRED), \ + sym_offs(__start) + + /* EFI64 Multiboot2 entry point. */ + mb2ht_init MB2_HT(ENTRY_ADDRESS_EFI64), MB2_HT(OPTIONAL), \ + sym_offs(__efi64_mb2_start) + /* Console flags tag. */ mb2ht_init MB2_HT(CONSOLE_FLAGS), MB2_HT(OPTIONAL), \ MULTIBOOT2_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED
@@ -257,10 +272,6 @@ multiboot2_header_start: /* Request that ExitBootServices() not be called. */ mb2ht_init MB2_HT(EFI_BS), MB2_HT(OPTIONAL) - /* EFI64 Multiboot2 entry point. */ - mb2ht_init MB2_HT(ENTRY_ADDRESS_EFI64), MB2_HT(OPTIONAL), \ - sym_offs(__efi64_mb2_start) - /* Multiboot2 header end tag. */ mb2ht_init MB2_HT(END), MB2_HT(REQUIRED) .Lmultiboot2_header_end:
Signature · 7 lines
1.7.10.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
RFC PATCH 6/7 xen/x86/efi: Verify dom0 kernel with SHIM_LOCK protocol in efi_multiboot2()
In reply to Daniel Kiper--- xen/arch/x86/boot/head.S | 20 ++++++++++++++++++-- xen/arch/x86/efi/efi-boot.h | 12 +++++++++++- xen/arch/x86/efi/stub.c | 5 ++++- 3 files changed, 33 insertions(+), 4 deletions(-)
xen/arch/x86/boot/head.S +18 -2
@@ -383,9 +383,13 @@ __efi64_mb2_start: jmp x86_32_switch .Lefi_multiboot2_proto: - /* Zero EFI SystemTable and EFI ImageHandle addresses. */ + /* + * Zero EFI SystemTable, EFI ImageHandle and + * dom0 kernel module struct addresses. + */ xor %esi,%esi xor %edi,%edi + xor %r14d,%r14d /* Skip Multiboot2 information fixed part. */ lea (MB2_fixed_sizeof+MULTIBOOT2_TAG_ALIGN-1)(%rbx),%ecx
@@ -423,6 +427,15 @@ __efi64_mb2_start: cmove MB2_efi64_ih(%rcx),%rdi je .Lefi_mb2_next_tag + /* Get dom0 kernel module struct address from Multiboot2 information. */ + cmpl $MULTIBOOT2_TAG_TYPE_MODULE,MB2_tag_type(%rcx) + jne .Lefi_mb2_end + + test %r14d,%r14d + cmovz %ecx,%r14d + jmp .Lefi_mb2_next_tag + +.Lefi_mb2_end: /* Is it the end of Multiboot2 information? */ cmpl $MULTIBOOT2_TAG_TYPE_END,MB2_tag_type(%rcx) je .Lrun_bs
@@ -484,9 +497,12 @@ __efi64_mb2_start: /* Keep the stack aligned. Do not pop a single item off it. */ mov (%rsp),%rdi + mov %r14d,%edx + /* * efi_multiboot2() is called according to System V AMD64 ABI: - * - IN: %rdi - EFI ImageHandle, %rsi - EFI SystemTable. + * - IN: %rdi - EFI ImageHandle, %rsi - EFI SystemTable, + * %rdx - dom0 kernel module struct address. */ call efi_multiboot2
xen/arch/x86/efi/efi-boot.h +11 -1
@@ -3,6 +3,8 @@* is intended to be included by common/efi/boot.c _only_, and * therefore can define arch specific global variables. */ +#include <xen/types.h> +#include <xen/multiboot2.h> #include <xen/vga.h> #include <asm/e820.h> #include <asm/edd.h>
@@ -47,6 +49,7 @@ extern const struct pe_base_relocs {static void __init efi_arch_relocate_image (unsigned long delta) { +#if 0 const struct pe_base_relocs *base_relocs;for ( base_relocs = __base_relocs_start; base_relocs < __base_relocs_end; )
@@ -95,6 +98,7 @@ static void __init efi_arch_relocate_image(unsigned long delta) } base_relocs = (const void *)(base_relocs->entries + i + (i &1 )); } +#endif }extern const s32 __trampoline_rel_start[], __trampoline_rel_stop[];
@@ -669,7 +673,9 @@ static bool __init efi_arch_use_config_file(EFI_SYSTEM_TABLE *SystemTable)static void efi_arch_flush_dcache_area (const void *vaddr,UINTN size) { } -void __init efi_multiboot2 (EFI_HANDLE ImageHandle,EFI_SYSTEM_TABLE *SystemTable) +void __init efi_multiboot2 (EFI_HANDLE ImageHandle, +EFI_SYSTEM_TABLE *SystemTable, +multiboot2_tag_module_t *dom0_kernel) {EFI_GRAPHICS_OUTPUT_PROTOCOL *gop;UINTN cols, gop_mode = ~0 , rows;
@@ -687,6 +693,10 @@ void __init efi_multiboot2(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable gop =efi_get_gop (); +if ( dom0_kernel && dom0_kernel->mod_end > dom0_kernel->mod_start ) +efi_shim_lock ((VOID *)(unsigned long )dom0_kernel->mod_start, + dom0_kernel->mod_end - dom0_kernel->mod_start); +if ( gop ) gop_mode =efi_find_gop_mode (gop,0 ,0 ,0 );
xen/arch/x86/efi/stub.c +4 -1
@@ -1,7 +1,9 @@ +#include <xen/types.h> #include <xen/efi.h> #include <xen/errno.h> #include <xen/init.h> #include <xen/lib.h> +#include <xen/multiboot2.h> #include <asm/page.h> #include <asm/efibind.h> #include <efi/efidef.h>
@@ -18,7 +20,8 @@*/ void __init noreturnefi_multiboot2 (EFI_HANDLE ImageHandle, -EFI_SYSTEM_TABLE *SystemTable) +EFI_SYSTEM_TABLE *SystemTable, +multiboot2_tag_module_t *dom0_kernel) {static const CHAR16 __initconst err[] =L"Xen does not have EFI code build in!\r\nSystem halted!\r\n" ;
Signature · 7 lines
1.7.10.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
RFC PATCH 7/7 xen/x86: Build xen.mb.efi directly from xen-syms
In reply to Daniel Kiper--- xen/arch/x86/Makefile | 1 + 1 file changed, 1 insertion(+)
xen/arch/x86/Makefile +1 -0
@@ -95,6 +95,7 @@ syms-warn-dup-$(CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS) := $(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32 ./boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TARGET) $(XEN_IMG_OFFSET) \ `$(NM) $(TARGET)-syms | sed -ne 's/^\([^ ]*\) . __2M_rwdata_end$$/0x\1/p'` + $(OBJCOPY) -O binary -S $(TARGET)-syms $(TARGET).mb.efi ALL_OBJS := $(BASEDIR)/arch/x86/boot/built_in.o $(BASEDIR)/arch/x86/efi/built_in.o $(ALL_OBJS)
Signature · 7 lines
1.7.10.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH RFC 1/7] xen: Introduce XEN_COMPILE_POSIX_TIME
In reply to Daniel KiperQuoted 19 lines
Quoted 1 line
Quoted 1 line · On 08.07.17 at 23:53, <[email protected]> wrote:
We need the POSIX time to properly fill the TimeDateStamp field in the PE header.
Signed-off-by Daniel Kiper <[email protected]>--- xen/Makefile | 14 ++++++++------ xen/include/xen/compile.h.in | 1 + 2 files changed, 9 insertions(+), 6 deletions(-)xen/Makefile +0
-1@@ -6,12 +6,13 @@ export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION) export XEN_FULLVERSION = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION) -include xen-version -export XEN_WHOAMI ?= $(USER)
xen/Makefile export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION) · line 13
Quoted 10 lines
xen/Makefile +5
-5-export XEN_DOMAIN ?= $(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown])) -export XEN_BUILD_DATE ?= $(shell LC_ALL=C date) -export XEN_BUILD_TIME ?= $(shell LC_ALL=C date +%T) -export XEN_BUILD_HOST ?= $(shell hostname) -export XEN_CONFIG_EXPERT ?= n +export XEN_WHOAMI ?= $(USER) +export XEN_DOMAIN ?= $(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown])) +export XEN_BUILD_DATE ?= $(shell LC_ALL=C date) +export XEN_BUILD_TIME ?= $(shell LC_ALL=C date +%T) +export XEN_BUILD_POSIX_TIME ?= $(shell LC_ALL=C date +%s)
If you run two independent commands anyway, I don't see why you need to obtain the POSIX time here. If you're really after the time stamps agreeing, then you should invoke date only once (strictly speaking this also applies to the DATE vs TIME invocation, but lets hope people sleep at midnight rather than building Xen).
xen/Makefile delete-unfresh-files: · line 168
Quoted 5 lines
xen/Makefile +1
-0@@ -164,6 +165,7 @@ delete-unfresh-files: include/xen/compile.h: include/xen/compile.h.in .banner @sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \ -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \ + -e 's/@@posix_time@@/$(XEN_BUILD_POSIX_TIME)/g' \
In order to fill a PE header, do you really need to make this available in compile.h?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH RFC 2/7] xen/x86: Manually build PE header
In reply to Daniel KiperQuoted 6 lines
Quoted 1 line
Quoted 1 line · On 08.07.17 at 23:53, <[email protected]> wrote:
This is the first step to get:
- one binary which can be loaded by the EFI loader, Multiboot and Multiboot2 protocols,
- if we wish, in the future we can drop xen/xen.gz and build xen.efi only,
If anything, generate xen.gz from xen.efi - I see value in the compression, but the EFI loader requires an uncompressed binary. And of course we'd have to raise the minimal gcc version requirement.
xen/arch/x86/Rules.mk CFLAGS += -I$(BASEDIR)/include · line 11
Quoted 8 lines
xen/arch/x86/Rules.mk +2
-0@@ -7,6 +7,8 @@ CFLAGS += -I$(BASEDIR)/include CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET) +CFLAGS += -DXEN_LOAD_ALIGN=XEN_IMG_OFFSET +CFLAGS += -DXEN_FILE_ALIGN=PAGE_SIZE
??? (Sadly your description talks about benefits only, not about what the patch actually does.)
Quoted 8 lines
xen/arch/x86/boot/head.S +1
-0@@ -1,3 +1,4 @@ +#include <xen/compile.h> #include <xen/multiboot.h> #include <xen/multiboot2.h> #include <public/xen.h>
xen/arch/x86/boot/head.S line 50
Quoted 6 lines
xen/arch/x86/boot/head.S +3
-0@@ -44,6 +45,150 @@ .Lmb2ht_init_end\@: .endm + .section .efi.pe.header, "a", @progbits + +ENTRY(efi_pe_head)
Since you put this in a separate section anyway, why don't you place it in a C file (perhaps even of its own) with suitably declared structures?
Quoted 43 lines
xen/arch/x86/boot/head.S +43
-0+ /* + * Legacy EXE header. + * + * Most of it is copied from binutils package, version 2.28, + * include/coff/pe.h:struct external_PEI_filehdr and + * bfd/peXXigen.c:_bfd_XXi_only_swap_filehdr_out(). + * + * Page is equal 512 bytes here. + * Paragraph is equal 16 bytes here. + */ + .short 0x5a4d /* EXE magic number. */ + .short 0x90 /* Bytes on last page of file. */ + .short 0x3 /* Pages in file. */ + .short 0 /* Relocations. */ + .short 0x4 /* Size of header in paragraphs. */ + .short 0 /* Minimum extra paragraphs needed. */ + .short 0xffff /* Maximum extra paragraphs needed. */ + .short 0 /* Initial (relative) SS value. */ + .short 0xb8 /* Initial SP value. */ + .short 0 /* Checksum. */ + .short 0 /* Initial IP value. */ + .short 0 /* Initial (relative) CS value. */ + .short 0x40 /* File address of relocation table. */ + .short 0 /* Overlay number. */ + .fill 4, 2, 0 /* Reserved words. */ + .short 0 /* OEM identifier. */ + .short 0 /* OEM information. */ + .fill 10, 2, 0 /* Reserved words. */ + .long pe_header - efi_pe_head /* File address of the PE header. */ + + /* + * DOS message. + * + * It is copied from binutils package, version 2.28, + * include/coff/pe.h:struct external_PEI_filehdr and + * bfd/peXXigen.c:_bfd_XXi_only_swap_filehdr_out(). + */ + .long 0x0eba1f0e + .long 0xcd09b400 + .long 0x4c01b821 + .long 0x685421cd + .long 0x70207369 + .long 0x72676f72
xen/arch/x86/boot/head.S line 103
Quoted 10 lines
xen/arch/x86/boot/head.S +10
-0+ .long 0x63206d61 + .long 0x6f6e6e61 + .long 0x65622074 + .long 0x6e757220 + .long 0x206e6920 + .long 0x20534f44 + .long 0x65646f6d + .long 0x0a0d0d2e + .long 0x24 + .long 0
Other than what the comment says, this isn't just a message (or else you could have used .asciz for the whole thing). I'm not convinced we need any of this.
xen/arch/x86/boot/head.S SECTIONS · line 269
Quoted 5 lines
xen/arch/x86/boot/head.S +1
-0@@ -259,6 +266,8 @@ SECTIONS #endif __2M_rwdata_end = .; + __pe_SizeOfImage = ALIGN(. - __image_base__, XEN_LOAD_ALIGN);
I don't think this is in line with what xen.efi currently has. Any difference needs explaining (I think there are further fields in this category).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH RFC 3/7] xen/x86: Add some addresses to the Multiboot header
In reply to Daniel KiperQuoted 5 lines
Quoted 1 line
Quoted 1 line · On 08.07.17 at 23:53, <[email protected]> wrote:
In comparison to ELF the PE format is not supported by the Multiboot protocol. So, if we wish to load xen.efi using this protocol we have to put
header_addr,load_addr,load_end_addr,bss_end_addrandentry_addrdata into Multiboot header.
Looks fine, but you will want to assure us that this non-ELF method of loading is compatible with each and every loader able of loading Xen so far.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH RFC 6/7] xen/x86/efi: Verify dom0 kernel with SHIM_LOCK protocol in efi_multiboot2()
In reply to Daniel KiperQuoted 35 lines
Quoted 1 line
Quoted 1 line · On 08.07.17 at 23:53, <[email protected]> wrote:
xen/arch/x86/boot/head.S +14
-1@@ -383,9 +383,13 @@ __efi64_mb2_start: jmp x86_32_switch .Lefi_multiboot2_proto: - /* Zero EFI SystemTable and EFI ImageHandle addresses. */ + /* + * Zero EFI SystemTable, EFI ImageHandle and + * dom0 kernel module struct addresses. + */ xor %esi,%esi xor %edi,%edi + xor %r14d,%r14d /* Skip Multiboot2 information fixed part. */ lea (MB2_fixed_sizeof+MULTIBOOT2_TAG_ALIGN-1)(%rbx),%ecx@@ -423,6 +427,15 @@ __efi64_mb2_start: cmove MB2_efi64_ih(%rcx),%rdi je .Lefi_mb2_next_tag + /* Get dom0 kernel module struct address from Multiboot2 information. */ + cmpl $MULTIBOOT2_TAG_TYPE_MODULE,MB2_tag_type(%rcx) + jne .Lefi_mb2_end + + test %r14d,%r14d + cmovz %ecx,%r14d + jmp .Lefi_mb2_next_tag + +.Lefi_mb2_end: /* Is it the end of Multiboot2 information? */ cmpl $MULTIBOOT2_TAG_TYPE_END,MB2_tag_type(%rcx) je .Lrun_bs
xen/arch/x86/boot/head.S __efi64_mb2_start: · line 505
Quoted 10 lines
xen/arch/x86/boot/head.S +4
-1@@ -484,9 +497,12 @@ __efi64_mb2_start: /* Keep the stack aligned. Do not pop a single item off it. */ mov (%rsp),%rdi + mov %r14d,%edx + /* * efi_multiboot2() is called according to System V AMD64 ABI: - * - IN: %rdi - EFI ImageHandle, %rsi - EFI SystemTable. + * - IN: %rdi - EFI ImageHandle, %rsi - EFI SystemTable, + * %rdx - dom0 kernel module struct address.
How come everything further up treats this as a 32-bit quantity only?
Quoted 10 lines
xen/arch/x86/boot/head.S +1
-0@@ -47,6 +49,7 @@ extern const struct pe_base_relocs { static void __init efi_arch_relocate_image(unsigned long delta) { +#if 0 const struct pe_base_relocs *base_relocs; for ( base_relocs = __base_relocs_start; base_relocs <
__base_relocs_end; )
xen/arch/x86/boot/head.S static void __init efi_arch_relocate_image(unsigned long delta) · line 102
Quoted 5 lines
xen/arch/x86/boot/head.S +1
-0@@ -95,6 +98,7 @@ static void __init efi_arch_relocate_image(unsigned long delta) } base_relocs = (const void *)(base_relocs->entries + i + (i & 1)); } +#endif }
???
xen/arch/x86/boot/head.S static bool __init · line 679
Quoted 9 lines
xen/arch/x86/boot/head.S +3
-1@@ -669,7 +673,9 @@ static bool __init efi_arch_use_config_file(EFI_SYSTEM_TABLE *SystemTable) static void efi_arch_flush_dcache_area(const void *vaddr, UINTN size) { } -void __init efi_multiboot2(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) +void __init efi_multiboot2(EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable, + multiboot2_tag_module_t *dom0_kernel)
const?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH RFC 1/7] xen: Introduce XEN_COMPILE_POSIX_TIME
In reply to Jan BeulichQuoted 27 lines · Jan Beulich
Quoted 27 lines
Quoted 1 line
Quoted 1 line · On 08.07.17 at 23:53, <[email protected]> wrote:
We need the POSIX time to properly fill the TimeDateStamp field in the PE header.
Signed-off-by Daniel Kiper <[email protected]>--- xen/Makefile | 14 ++++++++------ xen/include/xen/compile.h.in | 1 + 2 files changed, 9 insertions(+), 6 deletions(-)xen/Makefile +3
-6@@ -6,12 +6,13 @@ export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION) export XEN_FULLVERSION = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION) -include xen-version -export XEN_WHOAMI ?= $(USER) -export XEN_DOMAIN ?= $(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown])) -export XEN_BUILD_DATE ?= $(shell LC_ALL=C date) -export XEN_BUILD_TIME ?= $(shell LC_ALL=C date +%T) -export XEN_BUILD_HOST ?= $(shell hostname) -export XEN_CONFIG_EXPERT ?= n +export XEN_WHOAMI ?= $(USER) +export XEN_DOMAIN ?= $(shell ([ -x /bin/dnsdomainname ] && /bin/dnsdomainname) || ([ -x /bin/domainname ] && /bin/domainname || echo [unknown])) +export XEN_BUILD_DATE ?= $(shell LC_ALL=C date)
Quoted 8 lines
xen/Makefile export XEN_EXTRAVERSION ?= -unstable$(XEN_VENDORVERSION) · line 13
Quoted 2 lines
xen/Makefile +2
-0+export XEN_BUILD_TIME ?= $(shell LC_ALL=C date +%T) +export XEN_BUILD_POSIX_TIME ?= $(shell LC_ALL=C date +%s)If you run two independent commands anyway, I don't see why you need to obtain the POSIX time here. If you're really after the time stamps agreeing, then you should invoke date only once (strictly speaking this also applies to the DATE vs TIME invocation, but lets hope people sleep at midnight rather than building Xen).
If you wish I can fix this and feed the XEN_BUILD_DATE output into subsequent date commands.
Quoted 8 lines
xen/Makefile delete-unfresh-files: · line 168
Quoted 5 lines
xen/Makefile +1
-0@@ -164,6 +165,7 @@ delete-unfresh-files: include/xen/compile.h: include/xen/compile.h.in .banner @sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \ -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \ + -e 's/@@posix_time@@/$(XEN_BUILD_POSIX_TIME)/g' \In order to fill a PE header, do you really need to make this available in
compile.h?
Why not? I think that we should have all time related constants defined in one place. Even if one of them is used just only once.
Daniel
PS Your comments come just in time. I am working on the second version
of the patches.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH RFC 2/7] xen/x86: Manually build PE header
In reply to Jan BeulichQuoted 8 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 08.07.17 at 23:53, <[email protected]> wrote:
This is the first step to get:
- one binary which can be loaded by the EFI loader, Multiboot and Multiboot2 protocols,
- if we wish, in the future we can drop xen/xen.gz and build xen.efi only,If anything, generate xen.gz from xen.efi - I see value in the compression,
I generate both xen.gz and xen.efi from xen-syms. Anyway, as I can see we currently depend more on ELF output than earlier. So, I do not expect that we would be able to drop xen.gz in the near future.
Quoted 14 lines
but the EFI loader requires an uncompressed binary. And of course we'd have to raise the minimal gcc version requirement.
xen/arch/x86/Rules.mk CFLAGS += -I$(BASEDIR)/include · line 11
Quoted 8 lines
xen/arch/x86/Rules.mk +2
-0@@ -7,6 +7,8 @@ CFLAGS += -I$(BASEDIR)/include CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET) +CFLAGS += -DXEN_LOAD_ALIGN=XEN_IMG_OFFSET +CFLAGS += -DXEN_FILE_ALIGN=PAGE_SIZE??? (Sadly your description talks about benefits only, not about what the patch actually does.)
OK, I will improve the commit message. And maybe s/XEN_FILE_ALIGN/XEN_EFI_FILE_ALIGN/. And s/PAGE_SIZE/512/. This is minimal value required by PE spec. I have used PAGE_SIZE earlier just to be on safe side and in line with the output from ld.
Quoted 11 lines
Quoted 11 lines
xen/arch/x86/boot/head.S +1
-0@@ -1,3 +1,4 @@ +#include <xen/compile.h> #include <xen/multiboot.h> #include <xen/multiboot2.h> #include <public/xen.h>@@ -44,6 +45,150 @@ .Lmb2ht_init_end\@: .endm
Quoted 6 lines
xen/arch/x86/boot/head.S line 50
Quoted 3 lines
xen/arch/x86/boot/head.S +3
-0+ .section .efi.pe.header, "a", @progbits + +ENTRY(efi_pe_head)Since you put this in a separate section anyway, why don't you place it in a C file (perhaps even of its own) with suitably declared structures?
Really? I thought that it makes sense to have all bootloader headers in one place. Additionally, C requires struct definition in advance and later it have to be filled somehow. So, it will be twice as large. Hence, I do not see much benefit in using C here. OK, maybe it will be a bit more readable.
Quoted 54 lines
Quoted 43 lines
xen/arch/x86/boot/head.S +43
-0+ /* + * Legacy EXE header. + * + * Most of it is copied from binutils package, version 2.28, + * include/coff/pe.h:struct external_PEI_filehdr and + * bfd/peXXigen.c:_bfd_XXi_only_swap_filehdr_out(). + * + * Page is equal 512 bytes here. + * Paragraph is equal 16 bytes here. + */ + .short 0x5a4d /* EXE magic number. */ + .short 0x90 /* Bytes on last page of file. */ + .short 0x3 /* Pages in file. */ + .short 0 /* Relocations. */ + .short 0x4 /* Size of header in paragraphs. */ + .short 0 /* Minimum extra paragraphs needed. */ + .short 0xffff /* Maximum extra paragraphs needed. */ + .short 0 /* Initial (relative) SS value. */ + .short 0xb8 /* Initial SP value. */ + .short 0 /* Checksum. */ + .short 0 /* Initial IP value. */ + .short 0 /* Initial (relative) CS value. */ + .short 0x40 /* File address of relocation table. */ + .short 0 /* Overlay number. */ + .fill 4, 2, 0 /* Reserved words. */ + .short 0 /* OEM identifier. */ + .short 0 /* OEM information. */ + .fill 10, 2, 0 /* Reserved words. */ + .long pe_header - efi_pe_head /* File address of the PE header. */ + + /* + * DOS message. + * + * It is copied from binutils package, version 2.28, + * include/coff/pe.h:struct external_PEI_filehdr and + * bfd/peXXigen.c:_bfd_XXi_only_swap_filehdr_out(). + */ + .long 0x0eba1f0e + .long 0xcd09b400 + .long 0x4c01b821 + .long 0x685421cd + .long 0x70207369 + .long 0x72676f72xen/arch/x86/boot/head.S line 103
Quoted 10 lines
xen/arch/x86/boot/head.S +10
-0+ .long 0x63206d61 + .long 0x6f6e6e61 + .long 0x65622074 + .long 0x6e757220 + .long 0x206e6920 + .long 0x20534f44 + .long 0x65646f6d + .long 0x0a0d0d2e + .long 0x24 + .long 0
Quoted 3 lines
Other than what the comment says, this isn't just a message (or else you could have used .asciz for the whole thing). I'm not convinced we need any of this.
Potentially we can drop this. However, ld from binutils put this into EFI binary. And IIRC this is exactly what is embedded by other linkers into PE/COFF compatible files, e.g. *.efi, *.exe, *.dll, etc. So, I would leave this just for the sake of compatibility.
Quoted 8 lines
xen/arch/x86/boot/head.S SECTIONS · line 269
Quoted 5 lines
xen/arch/x86/boot/head.S +1
-0@@ -259,6 +266,8 @@ SECTIONS #endif __2M_rwdata_end = .; + __pe_SizeOfImage = ALIGN(. - __image_base__, XEN_LOAD_ALIGN);I don't think this is in line with what xen.efi currently has. Any difference needs explaining (I think there are further fields in this category).
I am not going to build manually exact copy of current xen.efi. It does not make sense. I would like to provide something minimalistic which works. No more no less. However, if you wish I can provide relevant comment here.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH RFC 3/7] xen/x86: Add some addresses to the Multiboot header
In reply to Jan BeulichQuoted 9 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 08.07.17 at 23:53, <[email protected]> wrote:
In comparison to ELF the PE format is not supported by the Multiboot protocol. So, if we wish to load xen.efi using this protocol we have to put
header_addr,load_addr,load_end_addr,bss_end_addrandentry_addrdata into Multiboot header.Looks fine, but you will want to assure us that this non-ELF method of loading is compatible with each and every loader able of loading Xen so far.
We have tested internally backport of this patch series and only one SYSLINUX bug surfaced until now. This is Multiboot implementation issue which have to be fixed at some point in SYSLINUX. However, it only manifests with ELF files (e.g. xen.gz) if some ELF addresses are not in line with addresses in Multiboot header (this happened due to not intended incorrect .efi.pe.header section placement; patch series posted here does not have this issue). So, this does not apply to xen.efi and everything works as expected.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH RFC 6/7] xen/x86/efi: Verify dom0 kernel with SHIM_LOCK protocol in efi_multiboot2()
In reply to Jan BeulichQuoted 38 lines · Jan Beulich
Quoted 38 lines
Quoted 1 line
Quoted 1 line · On 08.07.17 at 23:53, <[email protected]> wrote:
xen/arch/x86/boot/head.S +14
-1@@ -383,9 +383,13 @@ __efi64_mb2_start: jmp x86_32_switch .Lefi_multiboot2_proto: - /* Zero EFI SystemTable and EFI ImageHandle addresses. */ + /* + * Zero EFI SystemTable, EFI ImageHandle and + * dom0 kernel module struct addresses. + */ xor %esi,%esi xor %edi,%edi + xor %r14d,%r14d /* Skip Multiboot2 information fixed part. */ lea (MB2_fixed_sizeof+MULTIBOOT2_TAG_ALIGN-1)(%rbx),%ecx@@ -423,6 +427,15 @@ __efi64_mb2_start: cmove MB2_efi64_ih(%rcx),%rdi je .Lefi_mb2_next_tag + /* Get dom0 kernel module struct address from Multiboot2 information. */ + cmpl $MULTIBOOT2_TAG_TYPE_MODULE,MB2_tag_type(%rcx) + jne .Lefi_mb2_end + + test %r14d,%r14d + cmovz %ecx,%r14d + jmp .Lefi_mb2_next_tag + +.Lefi_mb2_end: /* Is it the end of Multiboot2 information? */ cmpl $MULTIBOOT2_TAG_TYPE_END,MB2_tag_type(%rcx) je .Lrun_bs@@ -484,9 +497,12 @@ __efi64_mb2_start: /* Keep the stack aligned. Do not pop a single item off it. */ mov (%rsp),%rdi
Quoted 9 lines
xen/arch/x86/boot/head.S __efi64_mb2_start: · line 505
Quoted 7 lines
xen/arch/x86/boot/head.S +4
-1+ mov %r14d,%edx + /* * efi_multiboot2() is called according to System V AMD64 ABI: - * - IN: %rdi - EFI ImageHandle, %rsi - EFI SystemTable. + * - IN: %rdi - EFI ImageHandle, %rsi - EFI SystemTable, + * %rdx - dom0 kernel module struct address.How come everything further up treats this as a 32-bit quantity only?
According to the Multiboot2 spec the bootloader is not allowed to put the kernel (xen.gz) and the modules above 4 GiB boundary. And comment below __efi64_mb2_start label is clear about that.
Quoted 7 lines
Quoted 7 lines
xen/arch/x86/boot/head.S +1
-0@@ -47,6 +49,7 @@ extern const struct pe_base_relocs { static void __init efi_arch_relocate_image(unsigned long delta) { +#if 0 const struct pe_base_relocs *base_relocs;
Quoted 10 lines
xen/arch/x86/boot/head.S static void __init efi_arch_relocate_image(unsigned long delta) · line 102
Quoted 8 lines
xen/arch/x86/boot/head.S +0
-0for ( base_relocs = __base_relocs_start; base_relocs <
__base_relocs_end; )xen/arch/x86/boot/head.S +1
-0@@ -95,6 +98,7 @@ static void __init efi_arch_relocate_image(unsigned long delta) } base_relocs = (const void *)(base_relocs->entries + i + (i & 1)); } +#endif }???
Please forget it. This is just an RFC. It will be fixed in v2.
Quoted 11 lines
xen/arch/x86/boot/head.S static bool __init · line 679
Quoted 9 lines
xen/arch/x86/boot/head.S +3
-1@@ -669,7 +673,9 @@ static bool __init efi_arch_use_config_file(EFI_SYSTEM_TABLE *SystemTable) static void efi_arch_flush_dcache_area(const void *vaddr, UINTN size) { } -void __init efi_multiboot2(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) +void __init efi_multiboot2(EFI_HANDLE ImageHandle, + EFI_SYSTEM_TABLE *SystemTable, + multiboot2_tag_module_t *dom0_kernel)const?
Will do.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH RFC 1/7] xen: Introduce XEN_COMPILE_POSIX_TIME
In reply to Daniel KiperQuoted 12 lines
Quoted 1 line
Quoted 1 line · On 08.05.18 at 14:18, <[email protected]> wrote:
Quoted 9 lines · Jan Beulich
xen/Makefile delete-unfresh-files: · line 168
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 08.07.17 at 23:53, <[email protected]> wrote:
xen/Makefile +1
-0@@ -164,6 +165,7 @@ delete-unfresh-files: include/xen/compile.h: include/xen/compile.h.in .banner @sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \ -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \ + -e 's/@@posix_time@@/$(XEN_BUILD_POSIX_TIME)/g' \In order to fill a PE header, do you really need to make this available in
compile.h?
Quoted 2 lines
Why not? I think that we should have all time related constants defined in one place. Even if one of them is used just only once.
I don't think so, fwiw, i.e. I'd prefer you to consume XEN_BUILD_{DATE,TIME} at the point/place you want/need the time in POSIX form.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH RFC 2/7] xen/x86: Manually build PE header
In reply to Daniel KiperQuoted 15 lines
Quoted 1 line
Quoted 1 line · On 08.05.18 at 14:47, <[email protected]> wrote:
Quoted 12 lines · Jan Beulich
xen/arch/x86/Rules.mk CFLAGS += -I$(BASEDIR)/include · line 11
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 08.07.17 at 23:53, <[email protected]> wrote:
xen/arch/x86/Rules.mk +2
-0@@ -7,6 +7,8 @@ CFLAGS += -I$(BASEDIR)/include CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET) +CFLAGS += -DXEN_LOAD_ALIGN=XEN_IMG_OFFSET +CFLAGS += -DXEN_FILE_ALIGN=PAGE_SIZE??? (Sadly your description talks about benefits only, not about what the patch actually does.)
Quoted 3 lines
OK, I will improve the commit message. And maybe s/XEN_FILE_ALIGN/XEN_EFI_FILE_ALIGN/.
And s/PAGE_SIZE/512/. This is minimal value required by PE spec.
Just go through *.sys on any Windows, and I think you'll find several with smaller file alignment. Iirc anything down to 0x20 is fine with the Windows driver loader (and the EFI one as well). I don't see any reason to use larger values than needed here, as there's no demand paging involved, where the higher alignment indeed helps performance.
Quoted 18 lines
Quoted 11 lines
Quoted 11 lines
xen/arch/x86/boot/head.S +1
-0@@ -1,3 +1,4 @@ +#include <xen/compile.h> #include <xen/multiboot.h> #include <xen/multiboot2.h> #include <public/xen.h>@@ -44,6 +45,150 @@ .Lmb2ht_init_end\@: .endmQuoted 6 lines
xen/arch/x86/boot/head.S line 50
Quoted 3 lines
xen/arch/x86/boot/head.S +3
-0+ .section .efi.pe.header, "a", @progbits + +ENTRY(efi_pe_head)Since you put this in a separate section anyway, why don't you place it in a C file (perhaps even of its own) with suitably declared structures?
Quoted 4 lines
Really? I thought that it makes sense to have all bootloader headers in one place. Additionally, C requires struct definition in advance and later it have to be filled somehow. So, it will be twice as large. Hence, I do not see much benefit in using C here. OK, maybe it will be a bit more readable.
That last aspect is the important one, and the reason we try to morph assembly code over into C where possible.
Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
xen/arch/x86/boot/head.S +23
-0+ /* + * DOS message. + * + * It is copied from binutils package, version 2.28, + * include/coff/pe.h:struct external_PEI_filehdr and + * bfd/peXXigen.c:_bfd_XXi_only_swap_filehdr_out(). + */ + .long 0x0eba1f0e + .long 0xcd09b400 + .long 0x4c01b821 + .long 0x685421cd + .long 0x70207369 + .long 0x72676f72 + .long 0x63206d61 + .long 0x6f6e6e61 + .long 0x65622074 + .long 0x6e757220 + .long 0x206e6920 + .long 0x20534f44 + .long 0x65646f6d + .long 0x0a0d0d2e + .long 0x24 + .long 0
Quoted 8 lines
Quoted 3 lines
Other than what the comment says, this isn't just a message (or else you could have used .asciz for the whole thing). I'm not convinced we need any of this.
Potentially we can drop this. However, ld from binutils put this into EFI binary. And IIRC this is exactly what is embedded by other linkers into PE/COFF compatible files, e.g. *.efi, *.exe, *.dll, etc. So, I would leave this just for the sake of compatibility.
Having this in .exe files is indeed helpful (or at least was back when DOS still played some sort of a role). In .dll it is already highly questionable, and hence even more so in .efi. Let's not encode and carry cruft that's not needed for anything.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
xen/arch/x86/boot/head.S +0
-0@@ -259,6 +266,8 @@ SECTIONS #endif __2M_rwdata_end = .;
Quoted 8 lines
Quoted 4 lines
xen/arch/x86/boot/head.S SECTIONS · line 269
Quoted 1 line
xen/arch/x86/boot/head.S +1
-0+ __pe_SizeOfImage = ALIGN(. - __image_base__, XEN_LOAD_ALIGN);I don't think this is in line with what xen.efi currently has. Any difference needs explaining (I think there are further fields in this category).
I am not going to build manually exact copy of current xen.efi. It does not make sense. I would like to provide something minimalistic which works. No more no less. However, if you wish I can provide relevant comment here.
My remark wasn't because I expect 1:1 matching output. However, core functionality needs to be the same, and iirc this being exactly 16Mb has a reason in today's xen.efi (you may want to fish out the commit).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH RFC 6/7] xen/x86/efi: Verify dom0 kernel with SHIM_LOCK protocol in efi_multiboot2()
In reply to Daniel KiperQuoted 50 lines
Quoted 1 line
Quoted 1 line · On 08.05.18 at 15:09, <[email protected]> wrote:
Quoted 38 lines · Jan Beulich
Quoted 38 lines
Quoted 1 line
Quoted 1 line · On 08.07.17 at 23:53, <[email protected]> wrote:
xen/arch/x86/boot/head.S +14
-1@@ -383,9 +383,13 @@ __efi64_mb2_start: jmp x86_32_switch .Lefi_multiboot2_proto: - /* Zero EFI SystemTable and EFI ImageHandle addresses. */ + /* + * Zero EFI SystemTable, EFI ImageHandle and + * dom0 kernel module struct addresses. + */ xor %esi,%esi xor %edi,%edi + xor %r14d,%r14d /* Skip Multiboot2 information fixed part. */ lea (MB2_fixed_sizeof+MULTIBOOT2_TAG_ALIGN-1)(%rbx),%ecx@@ -423,6 +427,15 @@ __efi64_mb2_start: cmove MB2_efi64_ih(%rcx),%rdi je .Lefi_mb2_next_tag + /* Get dom0 kernel module struct address from Multiboot2 information. */ + cmpl $MULTIBOOT2_TAG_TYPE_MODULE,MB2_tag_type(%rcx) + jne .Lefi_mb2_end + + test %r14d,%r14d + cmovz %ecx,%r14d + jmp .Lefi_mb2_next_tag + +.Lefi_mb2_end: /* Is it the end of Multiboot2 information? */ cmpl $MULTIBOOT2_TAG_TYPE_END,MB2_tag_type(%rcx) je .Lrun_bs@@ -484,9 +497,12 @@ __efi64_mb2_start: /* Keep the stack aligned. Do not pop a single item off it. */ mov (%rsp),%rdiQuoted 9 lines
xen/arch/x86/boot/head.S __efi64_mb2_start: · line 505
Quoted 7 lines
xen/arch/x86/boot/head.S +4
-1+ mov %r14d,%edx + /* * efi_multiboot2() is called according to System V AMD64 ABI: - * - IN: %rdi - EFI ImageHandle, %rsi - EFI SystemTable. + * - IN: %rdi - EFI ImageHandle, %rsi - EFI SystemTable, + * %rdx - dom0 kernel module struct address.How come everything further up treats this as a 32-bit quantity only?
Quoted 2 lines
According to the Multiboot2 spec the bootloader is not allowed to put the kernel (xen.gz) and the modules above 4 GiB boundary.
Interesting - how would they load a 1Gb initrd on a system with just 1Gb RAM below 4Gb? Not to speak of a 4Gb initrd ...
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH RFC 1/7] xen: Introduce XEN_COMPILE_POSIX_TIME
In reply to Jan BeulichQuoted 12 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 08.05.18 at 14:18, <[email protected]> wrote:
Quoted 9 lines · Jan Beulich
xen/Makefile delete-unfresh-files: · line 168
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 08.07.17 at 23:53, <[email protected]> wrote:
xen/Makefile +1
-0@@ -164,6 +165,7 @@ delete-unfresh-files: include/xen/compile.h: include/xen/compile.h.in .banner @sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \ -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \ + -e 's/@@posix_time@@/$(XEN_BUILD_POSIX_TIME)/g' \In order to fill a PE header, do you really need to make this available in
compile.h?
Quoted 5 lines
Quoted 2 lines
Why not? I think that we should have all time related constants defined in one place. Even if one of them is used just only once.
I don't think so, fwiw, i.e. I'd prefer you to consume XEN_BUILD_{DATE,TIME} at the point/place you want/need the time in POSIX form.
That would be perfect but TimeDateStamp in PE header requires the number of seconds since the epoch. And XEN_BUILD_{DATE,TIME} are in different formats. Hence, what should I do then?
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH RFC 2/7] xen/x86: Manually build PE header
In reply to Jan BeulichQuoted 19 lines · Jan Beulich
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 08.05.18 at 14:47, <[email protected]> wrote:
Quoted 12 lines · Jan Beulich
xen/arch/x86/Rules.mk CFLAGS += -I$(BASEDIR)/include · line 11
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 08.07.17 at 23:53, <[email protected]> wrote:
xen/arch/x86/Rules.mk +2
-0@@ -7,6 +7,8 @@ CFLAGS += -I$(BASEDIR)/include CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET) +CFLAGS += -DXEN_LOAD_ALIGN=XEN_IMG_OFFSET +CFLAGS += -DXEN_FILE_ALIGN=PAGE_SIZE??? (Sadly your description talks about benefits only, not about what the patch actually does.)
Quoted 3 lines
OK, I will improve the commit message. And maybe s/XEN_FILE_ALIGN/XEN_EFI_FILE_ALIGN/.
And s/PAGE_SIZE/512/. This is minimal value required by PE spec.
Quoted 5 lines
Just go through *.sys on any Windows, and I think you'll find several with smaller file alignment. Iirc anything down to
0x20is fine with the Windows driver loader (and the EFI one as well). I don't see any reason to use larger values than needed here, as there's no demand paging involved, where the higher alignment indeed helps performance.
I saw this earlier in vmlinuz. However, it looks that even MS ignores own specs. Ehhh... OK, will change this to 0x20.
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 8 lines
xen/arch/x86/boot/head.S +1
-0@@ -1,3 +1,4 @@ +#include <xen/compile.h> #include <xen/multiboot.h> #include <xen/multiboot2.h> #include <public/xen.h>xen/arch/x86/boot/head.S line 50
Quoted 6 lines
xen/arch/x86/boot/head.S +3
-0@@ -44,6 +45,150 @@ .Lmb2ht_init_end\@: .endm + .section .efi.pe.header, "a", @progbits + +ENTRY(efi_pe_head)Since you put this in a separate section anyway, why don't you place it in a C file (perhaps even of its own) with suitably declared structures?
Quoted 7 lines
Quoted 4 lines
Really? I thought that it makes sense to have all bootloader headers in one place. Additionally, C requires struct definition in advance and later it have to be filled somehow. So, it will be twice as large. Hence, I do not see much benefit in using C here. OK, maybe it will be a bit more readable.
That last aspect is the important one, and the reason we try to morph assembly code over into C where possible.
OK, will do that then.
Quoted 33 lines
Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
xen/arch/x86/boot/head.S +23
-0+ /* + * DOS message. + * + * It is copied from binutils package, version 2.28, + * include/coff/pe.h:struct external_PEI_filehdr and + * bfd/peXXigen.c:_bfd_XXi_only_swap_filehdr_out(). + */ + .long 0x0eba1f0e + .long 0xcd09b400 + .long 0x4c01b821 + .long 0x685421cd + .long 0x70207369 + .long 0x72676f72 + .long 0x63206d61 + .long 0x6f6e6e61 + .long 0x65622074 + .long 0x6e757220 + .long 0x206e6920 + .long 0x20534f44 + .long 0x65646f6d + .long 0x0a0d0d2e + .long 0x24 + .long 0Quoted 8 lines
Quoted 3 lines
Other than what the comment says, this isn't just a message (or else you could have used .asciz for the whole thing). I'm not convinced we need any of this.
Potentially we can drop this. However, ld from binutils put this into EFI binary. And IIRC this is exactly what is embedded by other linkers into PE/COFF compatible files, e.g. *.efi, *.exe, *.dll, etc. So, I would leave this just for the sake of compatibility.
Quoted 4 lines
Having this in .exe files is indeed helpful (or at least was back when DOS still played some sort of a role). In .dll it is already highly questionable, and hence even more so in .efi. Let's not encode and carry cruft that's not needed for anything.
OK, but I think that we should leave at least one or two instructions here, e.g. hlt and jmp back to it or something like that. Or int 0x21 with 0x4c00 in %ax. Latter seems better for me.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
xen/arch/x86/boot/head.S SECTIONS · line 269
Quoted 5 lines
xen/arch/x86/boot/head.S +1
-0@@ -259,6 +266,8 @@ SECTIONS #endif __2M_rwdata_end = .; + __pe_SizeOfImage = ALIGN(. - __image_base__, XEN_LOAD_ALIGN);I don't think this is in line with what xen.efi currently has. Any difference needs explaining (I think there are further fields in this category).
Quoted 7 lines
Quoted 3 lines
I am not going to build manually exact copy of current xen.efi. It does not make sense. I would like to provide something minimalistic which works. No more no less. However, if you wish I can provide relevant comment here.
My remark wasn't because I expect 1:1 matching output. However, core functionality needs to be the same, and iirc this being exactly 16Mb has a reason in today's xen.efi (you may want to fish out the commit).
OK, I will take a look.
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH RFC 6/7] xen/x86/efi: Verify dom0 kernel with SHIM_LOCK protocol in efi_multiboot2()
In reply to Jan BeulichQuoted 50 lines · Jan Beulich
Quoted 50 lines
Quoted 1 line
Quoted 1 line · On 08.05.18 at 15:09, <[email protected]> wrote:
Quoted 47 lines · Jan Beulich
Quoted 35 lines
Quoted 1 line
Quoted 1 line · On 08.07.17 at 23:53, <[email protected]> wrote:
xen/arch/x86/boot/head.S +14
-1@@ -383,9 +383,13 @@ __efi64_mb2_start: jmp x86_32_switch .Lefi_multiboot2_proto: - /* Zero EFI SystemTable and EFI ImageHandle addresses. */ + /* + * Zero EFI SystemTable, EFI ImageHandle and + * dom0 kernel module struct addresses. + */ xor %esi,%esi xor %edi,%edi + xor %r14d,%r14d /* Skip Multiboot2 information fixed part. */ lea (MB2_fixed_sizeof+MULTIBOOT2_TAG_ALIGN-1)(%rbx),%ecx@@ -423,6 +427,15 @@ __efi64_mb2_start: cmove MB2_efi64_ih(%rcx),%rdi je .Lefi_mb2_next_tag + /* Get dom0 kernel module struct address from Multiboot2 information. */ + cmpl $MULTIBOOT2_TAG_TYPE_MODULE,MB2_tag_type(%rcx) + jne .Lefi_mb2_end + + test %r14d,%r14d + cmovz %ecx,%r14d + jmp .Lefi_mb2_next_tag + +.Lefi_mb2_end: /* Is it the end of Multiboot2 information? */ cmpl $MULTIBOOT2_TAG_TYPE_END,MB2_tag_type(%rcx) je .Lrun_bsxen/arch/x86/boot/head.S __efi64_mb2_start: · line 505
Quoted 10 lines
xen/arch/x86/boot/head.S +4
-1@@ -484,9 +497,12 @@ __efi64_mb2_start: /* Keep the stack aligned. Do not pop a single item off it. */ mov (%rsp),%rdi + mov %r14d,%edx + /* * efi_multiboot2() is called according to System V AMD64 ABI: - * - IN: %rdi - EFI ImageHandle, %rsi - EFI SystemTable. + * - IN: %rdi - EFI ImageHandle, %rsi - EFI SystemTable, + * %rdx - dom0 kernel module struct address.How come everything further up treats this as a 32-bit quantity only?
Quoted 5 lines
Quoted 2 lines
According to the Multiboot2 spec the bootloader is not allowed to put the kernel (xen.gz) and the modules above 4 GiB boundary.
Interesting - how would they load a 1Gb initrd on a system with just 1Gb RAM below 4Gb? Not to speak of a 4Gb initrd ...
That is not possible right now. This requires changes in the boot protocol. Anyway, have you seen such setups in the wild today?
Daniel
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH RFC 1/7] xen: Introduce XEN_COMPILE_POSIX_TIME
In reply to Daniel KiperQuoted 17 lines
Quoted 1 line
Quoted 1 line · On 14.05.18 at 18:25, <[email protected]> wrote:
Quoted 15 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 08.05.18 at 14:18, <[email protected]> wrote:
Quoted 9 lines · Jan Beulich
xen/Makefile delete-unfresh-files: · line 168
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 08.07.17 at 23:53, <[email protected]> wrote:
xen/Makefile +1
-0@@ -164,6 +165,7 @@ delete-unfresh-files: include/xen/compile.h: include/xen/compile.h.in .banner @sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \ -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \ + -e 's/@@posix_time@@/$(XEN_BUILD_POSIX_TIME)/g' \In order to fill a PE header, do you really need to make this available in
compile.h?Why not? I think that we should have all time related constants defined in one place. Even if one of them is used just only once.
Quoted 6 lines
Quoted 2 lines
I don't think so, fwiw, i.e. I'd prefer you to consume XEN_BUILD_{DATE,TIME} at the point/place you want/need the time in POSIX form.
That would be perfect but TimeDateStamp in PE header requires the number of seconds since the epoch. And XEN_BUILD_{DATE,TIME} are in different formats. Hence, what should I do then?
I'm afraid I don't understand: As long as XEN_BUILD_{DATE,TIME} properly represent the time you're after in _some_ format, surely there's a way to convert the format to "seconds since the epoch"?
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH RFC 2/7] xen/x86: Manually build PE header
In reply to Daniel KiperQuoted 38 lines
Quoted 1 line
Quoted 1 line · On 14.05.18 at 18:52, <[email protected]> wrote:
Quoted 36 lines · Jan Beulich
Quoted 35 lines
Quoted 1 line
Quoted 1 line · On 08.05.18 at 14:47, <[email protected]> wrote:
Quoted 25 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 08.07.17 at 23:53, <[email protected]> wrote:
xen/arch/x86/boot/head.S +13
-0+ /* + * DOS message. + * + * It is copied from binutils package, version 2.28, + * include/coff/pe.h:struct external_PEI_filehdr and + * bfd/peXXigen.c:_bfd_XXi_only_swap_filehdr_out(). + */ + .long 0x0eba1f0e + .long 0xcd09b400 + .long 0x4c01b821 + .long 0x685421cd + .long 0x70207369 + .long 0x72676f72xen/arch/x86/boot/head.S line 103
Quoted 10 lines
xen/arch/x86/boot/head.S +10
-0+ .long 0x63206d61 + .long 0x6f6e6e61 + .long 0x65622074 + .long 0x6e757220 + .long 0x206e6920 + .long 0x20534f44 + .long 0x65646f6d + .long 0x0a0d0d2e + .long 0x24 + .long 0Quoted 3 lines
Other than what the comment says, this isn't just a message (or else you could have used .asciz for the whole thing). I'm not convinced we need any of this.
Potentially we can drop this. However, ld from binutils put this into EFI binary. And IIRC this is exactly what is embedded by other linkers into PE/COFF compatible files, e.g. *.efi, *.exe, *.dll, etc. So, I would leave this just for the sake of compatibility.
Quoted 8 lines
Quoted 4 lines
Having this in .exe files is indeed helpful (or at least was back when DOS still played some sort of a role). In .dll it is already highly questionable, and hence even more so in .efi. Let's not encode and carry cruft that's not needed for anything.
OK, but I think that we should leave at least one or two instructions here, e.g. hlt and jmp back to it or something like that. Or int
0x21with0x4c00in %ax. Latter seems better for me.
I certainly don't mind you doing something minimalistic like what you propose.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH RFC 6/7] xen/x86/efi: Verify dom0 kernel with SHIM_LOCK protocol in efi_multiboot2()
In reply to Daniel KiperQuoted 19 lines
Quoted 1 line
Quoted 1 line · On 14.05.18 at 18:56, <[email protected]> wrote:
Quoted 17 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 08.05.18 at 15:09, <[email protected]> wrote:
Quoted 14 lines · Jan Beulich
xen/arch/x86/boot/head.S __efi64_mb2_start: · line 505
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 08.07.17 at 23:53, <[email protected]> wrote:
xen/arch/x86/boot/head.S +4
-1@@ -484,9 +497,12 @@ __efi64_mb2_start: /* Keep the stack aligned. Do not pop a single item off it. */ mov (%rsp),%rdi + mov %r14d,%edx + /* * efi_multiboot2() is called according to System V AMD64 ABI: - * - IN: %rdi - EFI ImageHandle, %rsi - EFI SystemTable. + * - IN: %rdi - EFI ImageHandle, %rsi - EFI SystemTable, + * %rdx - dom0 kernel module struct address.How come everything further up treats this as a 32-bit quantity only?
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
According to the Multiboot2 spec the bootloader is not allowed to put the kernel (xen.gz) and the modules above 4 GiB boundary.
Interesting - how would they load a 1Gb initrd on a system with just 1Gb RAM below 4Gb? Not to speak of a 4Gb initrd ...
That is not possible right now. This requires changes in the boot protocol. Anyway, have you seen such setups in the wild today?
Years ago we've already had to make our XenoLinux forward port cope with 512Mb+ initrd-s - see the commit introducing XEN_ELFNOTE_MOD_START_PFN, which tells you that Xen itself needed to be changed for this as well. Those folks wanted to be able to boot a full fledged distro without loading anything from disk (or network) post-boot.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel