grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Kiper <daniel.kiper@oracle.com>
To: grub-devel@gnu.org, xen-devel@lists.xenproject.org
Cc: andrew.cooper3@citrix.com, arvidjaar@gmail.com,
	eric.snowberg@oracle.com,  jgross@suse.com,
	konrad.wilk@oracle.com, phcoder@gmail.com,
	seth.goldberg@oracle.com, tsoome@me.com
Subject: [MULTIBOOT2 DOC PATCH v3 07/13] multiboot2: Add description of support for EFI boot services
Date: Tue,  6 Dec 2016 23:52:55 +0100	[thread overview]
Message-ID: <1481064781-16949-8-git-send-email-daniel.kiper@oracle.com> (raw)
In-Reply-To: <1481064781-16949-1-git-send-email-daniel.kiper@oracle.com>

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
v3 - suggestions/fixes:
   - replace u_virt with u32
     (suggested by Andrei Borzenkov and Toomas Soome),
   - change RAX/RBX to EAX/EBX in "EFI amd64 machine state with boot
     services enabled" section,
   - describe the kernel, the modules, etc. load addresses limitation
     in "EFI amd64 machine state with boot services enabled" section,
   - replace Multiboot-compliant with Multiboot2-compliant.

v2 - suggestions/fixes:
   - clarify physical address meaning for EFI amd64
     mode with boot services enabled
     (suggested by Andrew Cooper).
---
 doc/multiboot.texi |  124 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 doc/multiboot2.h   |    2 +
 2 files changed, 126 insertions(+)

diff --git a/doc/multiboot.texi b/doc/multiboot.texi
index 9af756a..9f13e74 100644
--- a/doc/multiboot.texi
+++ b/doc/multiboot.texi
@@ -528,6 +528,66 @@ The physical address to which the boot loader should jump in order to
 start running the operating system.
 @end table
 
+@subsection EFI i386 entry address tag of Multiboot2 header
+
+@example
+@group
+        +-------------------+
+u16     | type = 8          |
+u16     | flags             |
+u32     | size              |
+u32     | entry_addr        |
+        +-------------------+
+@end group
+@end example
+
+All of the address fields in this tag are physical addresses.
+The meaning of each is as follows:
+
+@table @code
+
+@item entry_addr
+The physical address to which the boot loader should jump in order to
+start running EFI i386 compatible operating system code.
+@end table
+
+This tag is taken into account only on EFI i386 platforms
+when Multiboot2 image header contains EFI boot services tag.
+Then entry point specified in ELF header and the entry address
+tag of Multiboot2 header are ignored.
+
+@subsection EFI amd64 entry address tag of Multiboot2 header
+
+@example
+@group
+        +-------------------+
+u16     | type = 9          |
+u16     | flags             |
+u32     | size              |
+u32     | entry_addr        |
+        +-------------------+
+@end group
+@end example
+
+All of the address fields in this tag are physical addresses (paging
+mode is enabled and any memory space defined by the UEFI memory map
+is identity mapped, hence, virtual address equals physical address;
+Unified Extensible Firmware Interface Specification, Version 2.6,
+section 2.3.4, x64 Platforms, boot services). The meaning of each
+is as follows:
+
+@table @code
+
+@item entry_addr
+The physical address to which the boot loader should jump in order to
+start running EFI amd64 compatible operating system code.
+@end table
+
+This tag is taken into account only on EFI amd64 platforms
+when Multiboot2 image header contains EFI boot services tag.
+Then entry point specified in ELF header and the entry address
+tag of Multiboot2 header are ignored.
+
 @node Console header tags
 @subsection Flags tag
 
@@ -708,6 +768,70 @@ The OS image must leave interrupts disabled until it sets up its own
 
 On EFI system boot services must be terminated.
 
+@section EFI i386 machine state with boot services enabled
+
+When the boot loader invokes the 32-bit operating system on EFI i386
+platform and EFI boot services tag together with EFI i386 entry address
+tag are present in the image Multiboot2 header, the machine must have the
+following state:
+
+@table @samp
+@item EAX
+Must contain the magic value @samp{0x36d76289}; the presence of this
+value indicates to the operating system that it was loaded by a
+Multiboot2-compliant boot loader (e.g. as opposed to another type of
+boot loader that the operating system can also be loaded from).
+
+@item EBX
+Must contain the 32-bit physical address of the Multiboot2
+information structure provided by the boot loader (@pxref{Boot
+information format}).
+@end table
+
+All other processor registers, flag bits and state are set accordingly
+to Unified Extensible Firmware Interface Specification, Version 2.6,
+section 2.3.2, IA-32 Platforms, boot services.
+
+@section EFI amd64 machine state with boot services enabled
+
+When the boot loader invokes the 64-bit operating system on EFI amd64
+platform and EFI boot services tag together with EFI amd64 entry address
+tag are present in the image Multiboot2 header, the machine must have the
+following state:
+
+@table @samp
+@item EAX
+Must contain the magic value @samp{0x36d76289}; the presence of this
+value indicates to the operating system that it was loaded by a
+Multiboot2-compliant boot loader (e.g. as opposed to another type of
+boot loader that the operating system can also be loaded from).
+
+@item EBX
+Must contain the 64-bit physical address (paging mode is enabled and any
+memory space defined by the UEFI memory map is identity mapped, hence,
+virtual address equals physical address; Unified Extensible Firmware
+Interface Specification, Version 2.6, section 2.3.4, x64 Platforms, boot
+services) of the Multiboot2 information structure provided by the boot
+loader (@pxref{Boot information format}).
+@end table
+
+All other processor registers, flag bits and state are set accordingly
+to Unified Extensible Firmware Interface Specification, Version 2.6,
+section 2.3.4, x64 Platforms, boot services.
+
+The bootloader must not load any part of the kernel, the modules, the Multiboot2
+information structure, etc. higher than 4 GiB - 1. This requirement is put in
+force because most of currently specified tags supports 32-bit addresses only.
+Additionally, some kernels, even if they run on EFI 64-bit platform, still
+execute some parts of its initialization code in 32-bit mode.
+
+Note: If at some point there is a need for full 64-bit mode support in Multiboot2
+protocol then it should be designed very carefully. Especially it should be taken
+into account that 32-bit and 64-bit mode code should coexist in an image without
+any issue. The image should have a chance to inform the bootloader that it supports
+full 64-bit mode. If it is the case then the bootloader should provide 64-bit tags
+if it is desired and possible. Otherwise 32-bit tags should be used.
+
 @node Boot information format
 @section Boot information
 @subsection Boot information format
diff --git a/doc/multiboot2.h b/doc/multiboot2.h
index 78337f5..240400d 100644
--- a/doc/multiboot2.h
+++ b/doc/multiboot2.h
@@ -69,6 +69,8 @@
 #define MULTIBOOT_HEADER_TAG_FRAMEBUFFER  5
 #define MULTIBOOT_HEADER_TAG_MODULE_ALIGN  6
 #define MULTIBOOT_HEADER_TAG_EFI_BS        7
+#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI32  8
+#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64  9
 
 #define MULTIBOOT_ARCHITECTURE_I386  0
 #define MULTIBOOT_ARCHITECTURE_MIPS32  4
-- 
1.7.10.4



  parent reply	other threads:[~2016-12-06 22:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-06 22:52 [MULTIBOOT2 DOC PATCH v3 00/13] multiboot2: Update documentation Daniel Kiper
2016-12-06 22:52 ` [MULTIBOOT2 DOC PATCH v3 01/13] multiboot2: Replace u_phys with u32 Daniel Kiper
2016-12-10 17:23   ` Andrei Borzenkov
2016-12-12 13:48     ` Daniel Kiper
2016-12-06 22:52 ` [MULTIBOOT2 DOC PATCH v3 02/13] multiboot2: Replace u_virt " Daniel Kiper
2016-12-06 22:52 ` [MULTIBOOT2 DOC PATCH v3 03/13] multiboot2: Rename Multiboot to Multiboot2 Daniel Kiper
2016-12-06 22:52 ` [MULTIBOOT2 DOC PATCH v3 04/13] multiboot2: Replace redundant if with the Daniel Kiper
2016-12-06 22:52 ` [MULTIBOOT2 DOC PATCH v3 05/13] multiboot2: Clarify meaning of information request header tag Daniel Kiper
2016-12-06 22:52 ` [MULTIBOOT2 DOC PATCH v3 06/13] multiboot2: Fix description of EFI boot services tag Daniel Kiper
2016-12-06 22:52 ` Daniel Kiper [this message]
2016-12-07 14:33   ` [MULTIBOOT2 DOC PATCH v3 07/13] multiboot2: Add description of support for EFI boot services Konrad Rzeszutek Wilk
2016-12-07 18:21     ` Daniel Kiper
2016-12-06 22:52 ` [MULTIBOOT2 DOC PATCH v3 08/13] multiboot2: Add description of EFI image handle tags Daniel Kiper
2016-12-06 22:52 ` [MULTIBOOT2 DOC PATCH v3 09/13] multiboot2: Add description of support for relocatable images Daniel Kiper
2016-12-06 22:52 ` [MULTIBOOT2 DOC PATCH v3 10/13] multiboot2: Say that memory maps may not be available on EFI platforms Daniel Kiper
2016-12-06 22:52 ` [MULTIBOOT2 DOC PATCH v3 11/13] multiboot2: Add C structure members alignment and padding consideration section Daniel Kiper
2016-12-06 22:53 ` [MULTIBOOT2 DOC PATCH v3 12/13] multiboot2: Add me to authors Daniel Kiper
2016-12-06 22:53 ` [MULTIBOOT2 DOC PATCH v3 13/13] multiboot2: Bump version to 2.0 Daniel Kiper
2016-12-07  3:45 ` [MULTIBOOT2 DOC PATCH v3 00/13] multiboot2: Update documentation Konrad Rzeszutek Wilk
2016-12-07 11:26   ` Daniel Kiper
2016-12-07 14:34     ` Konrad Rzeszutek Wilk
2016-12-07 18:24       ` Daniel Kiper
2016-12-09 12:57 ` Daniel Kiper
2016-12-14 13:21   ` Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1481064781-16949-8-git-send-email-daniel.kiper@oracle.com \
    --to=daniel.kiper@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=arvidjaar@gmail.com \
    --cc=eric.snowberg@oracle.com \
    --cc=grub-devel@gnu.org \
    --cc=jgross@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=phcoder@gmail.com \
    --cc=seth.goldberg@oracle.com \
    --cc=tsoome@me.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).