Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jPDRs-0002Og-EI for mharc-grub-devel@gnu.org; Thu, 16 Apr 2020 18:57:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48849) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jPDRp-0002LE-RF for grub-devel@gnu.org; Thu, 16 Apr 2020 18:57:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jPDRo-0001vi-8m for grub-devel@gnu.org; Thu, 16 Apr 2020 18:57:29 -0400 Received: from mga17.intel.com ([192.55.52.151]:49722) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jPDRo-0001us-0g for grub-devel@gnu.org; Thu, 16 Apr 2020 18:57:28 -0400 IronPort-SDR: MBqRbGhd+ELSgvjsoNh6W74+kkxNw5K9QGaLBBjz/+0J4ehS/hvW7HBaUaH+xHrjQA9AZtFqOf E2FIbAaJU7yg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2020 15:57:26 -0700 IronPort-SDR: wU7ki37KX1On0dwqTyw7A7qceXsSilNwS7YKoaaRKb54+e6M4JZu7HpvFxp95IJA2fIRqR9Tgd 0Kt+oDk1bm0w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,392,1580803200"; d="scan'208";a="428018786" Received: from zedchen-mobl.amr.corp.intel.com ([10.212.170.227]) by orsmga005.jf.intel.com with ESMTP; 16 Apr 2020 15:57:26 -0700 From: Zide Chen To: grub-devel@gnu.org Cc: Zide Chen Subject: [PATCH] multiboot2: Add module relocatable tag to support modules relocation Date: Thu, 16 Apr 2020 15:56:08 -0700 Message-Id: <20200416225609.1049-1-zide.chen@intel.com> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 192.55.52.151 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Apr 2020 22:57:31 -0000 Also change the name from "relocatable header tag" to "kernel relocatable tag" to make it less confusing. These two tags are independent from each other. Signed-off-by: Zide Chen --- doc/multiboot.texi | 51 +++++++++++++++++++++++++++++++++++++++++----- doc/multiboot2.h | 11 ++++++++++ 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/doc/multiboot.texi b/doc/multiboot.texi index df8a0d056e76..bf0150dc86a0 100644 --- a/doc/multiboot.texi +++ b/doc/multiboot.texi @@ -355,7 +355,8 @@ executable header. * Console header tags:: * Module alignment tag:: * EFI boot services tag:: -* Relocatable header tag:: +* Kernel relocatable tag:: +* Module relocatable tag:: @end menu @@ -691,8 +692,8 @@ u32 | size = 8 | This tag indicates that payload supports starting without terminating boot services. -@node Relocatable header tag -@subsection Relocatable header tag +@node Kernel relocatable tag +@subsection Kernel relocatable tag @example @group @@ -708,7 +709,7 @@ u32 | preference | @end group @end example -This tag indicates that image is relocatable. +This tag indicates that kernel image is relocatable. The meaning of each field is as follows: @@ -730,6 +731,46 @@ 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 relocatable tag +@subsection Module relocatable tag + +@example +@group + +-------------------+ +u16 | type = 11 | +u16 | flags | +u32 | size = 20 | +u32 | min_addr | +u32 | max_addr | +u32 | preference | + +-------------------+ +@end group +@end example + +This tag is independent to the kernel relocatable tag. 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 preference +It contains load address placement suggestion for Multiboot2 modules +Boot loader should follow it. @samp{0} means load modules not lower +than min_addr, and not higher than max_addr, but no preference on either +lower or higher address; @samp{1} means load modules at lowest possible +address but not lower than min_addr; @samp{2} means load modules at +highest possible address but not higher than max_addr. @end table @node Machine state @@ -1399,7 +1440,7 @@ u32 | load_base_addr | @end example This tag contains image load base physical address. It is -provided only if image has relocatable header tag. +provided only if image has kernel relocatable tag. @node Examples @chapter Examples diff --git a/doc/multiboot2.h b/doc/multiboot2.h index b181607075b2..d97d10c2691a 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_RELOCATABLE 11 #define MULTIBOOT_ARCHITECTURE_I386 0 #define MULTIBOOT_ARCHITECTURE_MIPS32 4 @@ -179,6 +180,16 @@ struct multiboot_header_tag_relocatable multiboot_uint32_t preference; }; +struct multiboot_header_tag_module_relocatable +{ + 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 preference; +}; + struct multiboot_color { multiboot_uint8_t red; -- 2.17.1