Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jWoi6-0004XT-KS for mharc-grub-devel@gnu.org; Thu, 07 May 2020 18:09:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWoi5-0004XL-Lq for grub-devel@gnu.org; Thu, 07 May 2020 18:09:41 -0400 Received: from mga14.intel.com ([192.55.52.115]:63386) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jWoi3-0005NV-Mb for grub-devel@gnu.org; Thu, 07 May 2020 18:09:40 -0400 IronPort-SDR: Rp+YiYoi3KTwDcfk/W4cOCUP4VQvHjKEJY80ZT+QAFPpMb8kh3IDWLaTwTC+n2WxXGqozieMCC kp3syZAlExvQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 May 2020 15:09:32 -0700 IronPort-SDR: aVXFLpS97wul/LjVbme4u73wUir5FKLfvXDTAFrTQhMcVT9dfAbljPljoUOuWTbGJKDG0bLfAp V4CNM06fcxmQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,365,1583222400"; d="scan'208";a="295871336" Received: from smmorton-mobl.amr.corp.intel.com (HELO zedchen-MOBL.amr.corp.intel.com) ([10.212.29.80]) by fmsmga002.fm.intel.com with ESMTP; 07 May 2020 15:09:30 -0700 From: Zide Chen To: grub-devel@gnu.org Cc: Zide Chen Subject: [MULTIBOOT2 SPEC PATCH V2] multiboot2: Add module load and preference tag Date: Thu, 7 May 2020 15:09:23 -0700 Message-Id: <20200507220923.271-1-zide.chen@intel.com> X-Mailer: git-send-email 2.26.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=192.55.52.115; envelope-from=zide.chen@intel.com; helo=mga14.intel.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/07 17:31:32 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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, 07 May 2020 22:09:41 -0000 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. Signed-off-by: Zide Chen --- doc/multiboot.texi | 41 +++++++++++++++++++++++++++++++++++++++++ doc/multiboot2.h | 11 +++++++++++ 2 files changed, 52 insertions(+) diff --git a/doc/multiboot.texi b/doc/multiboot.texi index df8a0d056e76..758ef7fd1e2d 100644 --- a/doc/multiboot.texi +++ b/doc/multiboot.texi @@ -356,6 +356,7 @@ executable header. * Module alignment tag:: * EFI boot services tag:: * Relocatable header tag:: +* Module load preferences tag:: @end menu @@ -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 load preferences tag +@subsection Module load preferences 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 relocatable header 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 boot loader. +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 diff --git a/doc/multiboot2.h b/doc/multiboot2.h index b181607075b2..a68013ad932f 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,16 @@ 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 preference; +}; + struct multiboot_color { multiboot_uint8_t red; -- 2.17.1