In the cases of users have preferences over Multiboot2 module load
addresses, currently GRUB has no way to achieve it.

Similar to the relocatable header tag, this new tag allows users to
specify the minimum and maximum load addresses, and other load
preferences on Multiboot2 modules.

Bump version to 2.1, and add 2020 to copyright.

Signed-off-by: Zide Chen <zide.c...@intel.com>
---
 configure.ac       |  2 +-
 doc/multiboot.texi | 57 +++++++++++++++++++++++++++++++++++++++++++++-
 doc/multiboot2.h   | 12 ++++++++++
 3 files changed, 69 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 585b37a3683f..d68ffec182e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,7 +13,7 @@ dnl LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER 
RESULTING FROM THE
 dnl USE OF THIS SOFTWARE.
 
 AC_PREREQ(2.59)
-AC_INIT([Multiboot], [2.0], [bug-g...@gnu.org])
+AC_INIT([Multiboot], [2.1], [bug-g...@gnu.org])
 AC_CONFIG_SRCDIR([doc/multiboot.texi])
 AC_CONFIG_HEADER([config.h])
 AM_INIT_AUTOMAKE
diff --git a/doc/multiboot.texi b/doc/multiboot.texi
index df8a0d056e76..900826b2e7e6 100644
--- a/doc/multiboot.texi
+++ b/doc/multiboot.texi
@@ -20,7 +20,7 @@ Copyright @copyright{} 1995,96 Bryan Ford 
<baford@@cs.utah.edu>
 
 Copyright @copyright{} 1995,96 Erich Stefan Boleyn <erich@@uruk.org>
 
-Copyright @copyright{} 1999,2000,2001,2002,2005,2006,2009,2010,2016 Free 
Software Foundation, Inc.
+Copyright @copyright{} 1999,2000,2001,2002,2005,2006,2009,2010,2016,2020 Free 
Software Foundation, Inc.
 
 @quotation
 Permission is granted to make and distribute verbatim copies of
@@ -356,6 +356,7 @@ executable header.
 * Module alignment tag::
 * EFI boot services tag::
 * Relocatable header tag::
+* Module load preferences tag::
 
 @end menu
 
@@ -675,6 +676,11 @@ u32     | size = 8          |
 
 If this tag is present modules must be page aligned.
 
+But if the module load preferences tag is present and its align member
+is nonzero, boot loader should choose the larger number between page
+size and the alignment specified in the module load preferences tag as
+the module load alignment.
+
 @node EFI boot services tag
 @subsection EFI boot services tag
 
@@ -730,8 +736,57 @@ Boot loader should follow it. @samp{0} means none, 
@samp{1} means
 load image at lowest possible address but not lower than min_addr
 and @samp{2} means load image at highest possible address but not
 higher than max_addr.
+
+@node Module load preferences tag
+@subsection Module load preferences tag
+
+@example
+@group
+        +-------------------+
+u16     | type = 11         |
+u16     | flags             |
+u32     | size = 24         |
+u32     | min_addr          |
+u32     | max_addr          |
+u32     | align             |
+u32     | preference        |
+        +-------------------+
+@end group
+@end example
+
+This tag indicates the load preferences of Multiboot2 modules.
+All of the address fields in this tag are physical addresses.
+
+The meaning of each field is as follows:
+
+@table @code
+@item min_addr
+Lowest possible physical address at which any modules should be
+loaded. The bootloader cannot load any part of any modules below
+this address.
+
+@item max_addr
+Highest possible physical address at which any loaded modules should
+end. The bootloader cannot load any part of any modules above this
+address.
+
+@item align
+Modules alignment in memory, e.g. 4096.
+
+If this field is nonzero and the module alignment tag is present,
+boot loader should choose the larger number between page size and this
+field as the module load alignment.
+
+@item preference
+It contains load address placement suggestion for boot loader.
+Boot loader should follow it. @samp{0} means none, @samp{1} means
+load modules at lowest possible address but not lower than min_addr
+and @samp{2} means load modules at highest possible address but not
+higher than max_addr.
 @end table
 
+This tag is independent to the relocatable header tag.
+
 @node Machine state
 @section MIPS machine state
 
diff --git a/doc/multiboot2.h b/doc/multiboot2.h
index b181607075b2..917bb6f2327a 100644
--- a/doc/multiboot2.h
+++ b/doc/multiboot2.h
@@ -75,6 +75,7 @@
 #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI32  8
 #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64  9
 #define MULTIBOOT_HEADER_TAG_RELOCATABLE  10
+#define MULTIBOOT_HEADER_TAG_MODULE_LOAD_PREFERENCES  11
 
 #define MULTIBOOT_ARCHITECTURE_I386  0
 #define MULTIBOOT_ARCHITECTURE_MIPS32  4
@@ -179,6 +180,17 @@ struct multiboot_header_tag_relocatable
   multiboot_uint32_t preference;
 };
 
+struct multiboot_header_tag_module_load_preferences
+{
+  multiboot_uint16_t type;
+  multiboot_uint16_t flags;
+  multiboot_uint32_t size;
+  multiboot_uint32_t min_addr;
+  multiboot_uint32_t max_addr;
+  multiboot_uint32_t align;
+  multiboot_uint32_t preference;
+};
+
 struct multiboot_color
 {
   multiboot_uint8_t red;
-- 
2.17.1


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to