[PATCH 03/18] x86/boot: use %ecx instead of %eax

2015-01-30 Thread Daniel Kiper
Use %ecx instead of %eax to store low memory upper limit from EBDA. This way we do not wipe multiboot protocol identifier. It is needed in reloc() to differentiate between multiboot (v1) and multiboot2 protocol. Signed-off-by: Daniel Kiper Reviewed-by: Andrew Cooper --- xen/arch/x86/boot/head.S

[PATCH 00/18] x86: multiboot2 protocol support

2015-01-30 Thread Daniel Kiper
Hi, I am sending, long awaited, first version of multiboot2 protocol support for legacy BIOS and EFI platforms. The final goal is xen.efi binary file which could be loaded by EFI loader, multiboot (v1) protocol (only on legacy BIOS platforms) and multiboot2 protocol. This way we will have: - sm

[PATCH 01/18] x86/boot/reloc: mask out MBI_BOOTDEV from mbi flags

2015-01-30 Thread Daniel Kiper
..because it is ignored by Xen. Signed-off-by: Daniel Kiper --- xen/arch/x86/boot/reloc.c |1 - 1 file changed, 1 deletion(-) diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index f971920..63045c0 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -

[PATCH 05/18] efi: split efi_enabled to efi_platform and efi_loader

2015-01-30 Thread Daniel Kiper
We need more fine grained knowledge about EFI environment and check for EFI platform and EFI loader separately to properly support multiboot2 protocol. In general Xen loaded by this protocol uses memory mappings and loaded modules in simliar way to Xen loaded by multiboot (v1) protocol. Hence, spli

[PATCH 02/18] x86/boot/reloc: create generic alloc and copy functions

2015-01-30 Thread Daniel Kiper
Create generic alloc and copy functions. We need separate tools for memory allocation and copy to provide multiboot2 protocol support. Signed-off-by: Daniel Kiper --- xen/arch/x86/boot/reloc.c | 52 - 1 file changed, 33 insertions(+), 19 deletions(-)

[PATCH 04/18] xen/x86: add multiboot2 protocol support

2015-01-30 Thread Daniel Kiper
Add multiboot2 protocol support. Alter min memory limit handling as we now may not find it from either multiboot (v1) or multiboot2. This way we are laying the foundation for EFI + GRUB2 + Xen development. Signed-off-by: Daniel Kiper --- xen/arch/x86/boot/Makefile|3 +- xen/arch/x86

[PATCH 12/18] efi: create efi_find_gop_mode()

2015-01-30 Thread Daniel Kiper
..which finds suitable GOP mode. We need this to support multiboot2 protocol on EFI platforms. Signed-off-by: Daniel Kiper --- xen/common/efi/boot.c | 94 - 1 file changed, 54 insertions(+), 40 deletions(-) diff --git a/xen/common/efi/boot.c b/x

[PATCH 06/18] x86: remove commented out stale references to efi_enabled

2015-01-30 Thread Daniel Kiper
Signed-off-by: Daniel Kiper --- xen/arch/x86/e820.c | 29 ++--- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c index bf84bae..47920a3 100644 --- a/xen/arch/x86/e820.c +++ b/xen/arch/x86/e820.c @@ -74,20 +74,18 @@

[PATCH 08/18] efi: build xen.gz with EFI code

2015-01-30 Thread Daniel Kiper
Build xen.gz with EFI code. We need this to support multiboot2 protocol on EFI platforms. If we wish to load not ELF file using multiboot (v1) or multiboot2 then it must contain "linear" (or "flat") representation of code and data. Currently, PE file contains many sections which are not "linear" (

[PATCH 10/18] efi: create efi_console_set_mode()

2015-01-30 Thread Daniel Kiper
..which sets console mode. We need this to support multiboot2 protocol on EFI platforms. Signed-off-by: Daniel Kiper --- xen/common/efi/boot.c | 37 - 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot

[PATCH 07/18] efi: run EFI specific code on EFI platform only

2015-01-30 Thread Daniel Kiper
Signed-off-by: Daniel Kiper --- xen/arch/x86/shutdown.c |3 ++- xen/common/efi/boot.c|5 + xen/common/efi/runtime.c |6 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c index 21f6cf5..1c8336f 100644 --- a/

[PATCH 11/18] efi: create efi_get_gop()

2015-01-30 Thread Daniel Kiper
..which gets pointer to GOP device. We need this to support multiboot2 protocol on EFI platforms. Signed-off-by: Daniel Kiper --- xen/common/efi/boot.c | 59 ++--- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/xen/common/efi/boot.c

[PATCH 17/18] x86/efi: create new early memory allocator

2015-01-30 Thread Daniel Kiper
There is a problem with place_string() which is used as early memory allocator. It gets memory chunks starting from start symbol and going down. Sadly this does not work when Xen is loaded using multiboot2 protocol because start lives on 1 MiB address. So, I tried to use mem_lower address calculate

[PATCH 14/18] efi: create efi_variables()

2015-01-30 Thread Daniel Kiper
..which collects variable store parameters. We need this to support multiboot2 protocol on EFI platforms. Signed-off-by: Daniel Kiper --- xen/common/efi/boot.c | 41 - 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/xen/common/efi/boot.c

[PATCH 13/18] efi: create efi_tables()

2015-01-30 Thread Daniel Kiper
..which collects system tables data. We need this to support multiboot2 protocol on EFI platforms. Signed-off-by: Daniel Kiper --- xen/common/efi/boot.c | 51 - 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/xen/common/efi/boot.c

[PATCH 16/18] efi: create efi_exit_boot()

2015-01-30 Thread Daniel Kiper
..which gets memory map and calls ExitBootServices(). We need this to support multiboot2 protocol on EFI platforms. Signed-off-by: Daniel Kiper --- xen/common/efi/boot.c | 79 +++-- 1 file changed, 44 insertions(+), 35 deletions(-) diff --git a/xen/

[PATCH 09/18] efi: create efi_init()

2015-01-30 Thread Daniel Kiper
..which initializes basic EFI variables. We need this to support multiboot2 protocol on EFI platforms. Signed-off-by: Daniel Kiper --- xen/common/efi/boot.c | 26 -- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/b

[PATCH 15/18] efi: create efi_set_gop_mode()

2015-01-30 Thread Daniel Kiper
..which sets chosen GOP mode. We need this to support multiboot2 protocol on EFI platforms. Signed-off-by: Daniel Kiper --- xen/common/efi/boot.c | 35 +-- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/xen/common/efi/boot.c b/xen/common/efi/boo

[PATCH 18/18] x86: add multiboot2 protocol support for EFI platforms

2015-01-30 Thread Daniel Kiper
Signed-off-by: Daniel Kiper --- xen/arch/x86/boot/head.S | 174 +++-- xen/arch/x86/efi/efi-boot.h | 29 +++ xen/arch/x86/setup.c | 23 ++--- xen/arch/x86/x86_64/asm-offsets.c |2 + xen/common/efi/boot.c | 11 ++

Re: [Xen-devel] [PATCH 01/18] x86/boot/reloc: mask out MBI_BOOTDEV from mbi flags

2015-01-30 Thread Andrew Cooper
On 30/01/15 17:54, Daniel Kiper wrote: > ..because it is ignored by Xen. > > Signed-off-by: Daniel Kiper Reviewed-by: Andrew Cooper > --- > xen/arch/x86/boot/reloc.c |1 - > 1 file changed, 1 deletion(-) > > diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c > index f971920

[PATCH 0/5] multiboot2: Enable EFI boot services usage in loaded images

2015-01-30 Thread Daniel Kiper
Hi, This patch series enable EFI boot services usage in loaded images by multiboot2 protocol. Daniel grub-core/Makefile.core.def |1 + grub-core/lib/i386/relocator.c | 59 ++ grub-core/lib/i386/relocator64

[PATCH 3/5] i386/relocator: Remove unused avoid_efi_bootservices argument

2015-01-30 Thread Daniel Kiper
Signed-off-by: Daniel Kiper --- grub-core/lib/i386/relocator.c |5 ++--- grub-core/loader/i386/bsd.c |6 +++--- grub-core/loader/i386/coreboot/chainloader.c |2 +- grub-core/loader/i386/linux.c|2 +- grub-core/loader/i386/pc/plan9.c

[PATCH 2/5] i386/relocator: Remove unused extern grub_relocator64_rip_addr

2015-01-30 Thread Daniel Kiper
Signed-off-by: Daniel Kiper --- grub-core/lib/i386/relocator.c |1 - 1 file changed, 1 deletion(-) diff --git a/grub-core/lib/i386/relocator.c b/grub-core/lib/i386/relocator.c index ffaf25f..71dd4f0 100644 --- a/grub-core/lib/i386/relocator.c +++ b/grub-core/lib/i386/relocator.c @@ -64,7 +64

[PATCH 4/5] i386/relocator: Add grub_relocator64_efi relocator

2015-01-30 Thread Daniel Kiper
Add grub_relocator64_efi relocator. It will be used on EFI 64-bit platforms when multiboot2 compatible image requests MULTIBOOT_TAG_TYPE_EFI_BS. Relocator will set lower parts of %rax and %rbx accordingly to multiboot2 specification. On the other hand processor mode, just before jumping into loaded

[PATCH 5/5] multiboot2: Add tags used to pass ImageHandle to loaded image

2015-01-30 Thread Daniel Kiper
Add tags used to pass ImageHandle to loaded image. It is used by at least ExitBootServices() function. Signed-off-by: Daniel Kiper --- grub-core/loader/multiboot_mbi2.c | 36 +++- include/multiboot2.h | 16 2 files changed, 47 ins

[PATCH 1/5] multiboot2: Fix information request tag size calculation

2015-01-30 Thread Daniel Kiper
Signed-off-by: Daniel Kiper --- grub-core/loader/multiboot_mbi2.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c index 6f74aee..d7c19bc 100644 --- a/grub-core/loader/multiboot_mbi2.c +++ b/grub-core/loa

Re: [PATCH 02/18] x86/boot/reloc: create generic alloc and copy functions

2015-01-30 Thread Andrew Cooper
On 30/01/15 17:54, Daniel Kiper wrote: > Create generic alloc and copy functions. We need > separate tools for memory allocation and copy to > provide multiboot2 protocol support. > > Signed-off-by: Daniel Kiper Reviewed-by: Andrew Cooper > --- > xen/arch/x86/boot/reloc.c | 52 > +++

Re: [PATCH 00/18] x86: multiboot2 protocol support

2015-01-30 Thread Daniel Kiper
On Fri, Jan 30, 2015 at 06:54:04PM +0100, Daniel Kiper wrote: > Hi, > > I am sending, long awaited, first version of multiboot2 protocol > support for legacy BIOS and EFI platforms. By mistake I forgot to thank you Andrew and Konrad for support during development of this series. Sorry guys. Danie

Re: [PATCH 04/18] xen/x86: add multiboot2 protocol support

2015-01-30 Thread Andrew Cooper
On 30/01/15 17:54, Daniel Kiper wrote: > Add multiboot2 protocol support. Alter min memory limit handling as we > now may not find it from either multiboot (v1) or multiboot2. > > This way we are laying the foundation for EFI + GRUB2 + Xen development. > > Signed-off-by: Daniel Kiper I have not r

Re: [PATCH 18/18] x86: add multiboot2 protocol support for EFI platforms

2015-01-30 Thread Andrew Cooper
On 30/01/15 17:54, Daniel Kiper wrote: > Signed-off-by: Daniel Kiper > --- > xen/arch/x86/boot/head.S | 174 > +++-- > xen/arch/x86/efi/efi-boot.h | 29 +++ > xen/arch/x86/setup.c | 23 ++--- > xen/arch/x86/x86_64/asm-offsets.c

Re: [PATCH 1/5] multiboot2: Fix information request tag size calculation

2015-01-30 Thread Ben Hildred
Why do you want the size of a pointer instead of the size of the structure? On Fri, Jan 30, 2015 at 10:59 AM, Daniel Kiper wrote: > Signed-off-by: Daniel Kiper > --- > grub-core/loader/multiboot_mbi2.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/grub-core/loader

Re: [PATCH 1/5] multiboot2: Fix information request tag size calculation

2015-01-30 Thread Lennart Sorensen
On Fri, Jan 30, 2015 at 01:52:09PM -0700, Ben Hildred wrote: > Why do you want the size of a pointer instead of the size of the structure? Isn't *request_tag the dereferenced pointer, and hence is the size of the structure, where as before it was the size of a pointer? -- Len Sorensen > On Fri,

Re: [PATCH 18/18] x86: add multiboot2 protocol support for EFI platforms

2015-01-30 Thread Daniel Kiper
On Fri, Jan 30, 2015 at 07:06:53PM +, Andrew Cooper wrote: > On 30/01/15 17:54, Daniel Kiper wrote: > > Signed-off-by: Daniel Kiper > > --- > > xen/arch/x86/boot/head.S | 174 > > +++-- > > xen/arch/x86/efi/efi-boot.h | 29 +++ > > xen/ar

Re: [PATCH 18/18] x86: add multiboot2 protocol support for EFI platforms

2015-01-30 Thread Andrew Cooper
On 30/01/2015 23:43, Daniel Kiper wrote: > On Fri, Jan 30, 2015 at 07:06:53PM +, Andrew Cooper wrote: >> On 30/01/15 17:54, Daniel Kiper wrote: >>> + >>> +efi_multiboot2_proto: >>> +/* Skip Multiboot2 information fixed part */ >>> +lea MB2_fixed_sizeof(%ebx),%ecx >>> + >>> +

Re: [PATCH 1/5] multiboot2: Fix information request tag size calculation

2015-01-30 Thread Ben Hildred
ok, the fix is correct. This is why I always do size of typedefs. the syntax is better. On Fri, Jan 30, 2015 at 2:21 PM, Lennart Sorensen < lsore...@csclub.uwaterloo.ca> wrote: > On Fri, Jan 30, 2015 at 01:52:09PM -0700, Ben Hildred wrote: > > Why do you want the size of a pointer instead of the

Re: [PATCH 00/18] x86: multiboot2 protocol support

2015-01-30 Thread João Jerónimo
Hello, Is it planned to have the boot loader set up long mode for the kernel (in BIOS systems) in a future multiboot version? And, before someone talks about that, I know that long mode requires paging to be set up and enabled. As far as I know some OS loaders do this. Also, something I think