Received: from list by lists.gnu.org with archive (Exim 4.71) id 1afQpx-0007p4-Gj for mharc-grub-devel@gnu.org; Mon, 14 Mar 2016 07:39:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afQpu-0007l2-Ks for grub-devel@gnu.org; Mon, 14 Mar 2016 07:38:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afQpr-00071a-E4 for grub-devel@gnu.org; Mon, 14 Mar 2016 07:38:58 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:29507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afQpr-00071O-8R for grub-devel@gnu.org; Mon, 14 Mar 2016 07:38:55 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u2EBce1f012169 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 14 Mar 2016 11:38:42 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.13.8/8.13.8) with ESMTP id u2EBceYP023004 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 14 Mar 2016 11:38:40 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id u2EBca43017367; Mon, 14 Mar 2016 11:38:38 GMT Received: from olila.local.net-space.pl (/10.175.211.128) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 14 Mar 2016 04:38:36 -0700 Date: Mon, 14 Mar 2016 12:38:30 +0100 From: Daniel Kiper To: "Vladimir 'phcoder' Serbinenko" Subject: Re: [GRUB2 PATCH v3 4/4] multiboot2: Add support for relocatable images Message-ID: <20160314113830.GQ3500@olila.local.net-space.pl> References: <1456937500-7855-1-git-send-email-daniel.kiper@oracle.com> <1456937500-7855-5-git-send-email-daniel.kiper@oracle.com> <20160311160635.GB3500@olila.local.net-space.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserv0022.oracle.com [141.146.126.234] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 Cc: "jgross@suse.com" , "grub-devel@gnu.org" , "eric.snowberg@oracle.com" , "arvidjaar@gmail.com" , "andrew.cooper3@citrix.com" , "cardoe@cardoe.com" , "pgnet.dev@gmail.com" , "roy.franz@linaro.org" , "ning.sun@intel.com" , "david.vrabel@citrix.com" , "jbeulich@suse.com" , "stefano.stabellini@eu.citrix.com" , "xen-devel@lists.xenproject.org" , "qiaowei.ren@intel.com" , "richard.l.maliszewski@intel.com" , "gang.wei@intel.com" , "fu.wei@linaro.org" , "seth.goldberg@oracle.com" X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Mar 2016 11:38:59 -0000 On Fri, Mar 11, 2016 at 05:13:19PM +0100, Vladimir 'phcoder' Serbinenko wrote: > > > > + if (relocatable) > > > > + { > > > > + if (base_addr > min_addr) > > > > + grub_multiboot_payload_eip += base_addr - min_addr; > > > > + else > > > > + grub_multiboot_payload_eip -= min_addr - base_addr; > > > > + } > > > > + > > > > > > > Why is it relative to min_addr? Sounds like it should be just an offset > > > > Ugh... IIRC, it has meaning but I forgot what. I will check it. > > However, this means that I must put comment here. > > > > Is it possible that you have confused link address and minimal loading address? Yep, you are right. Fortunately it is quite easy to fix and probably do not require any changes in Xen image. > How is entry usually specified in ELF? IIRC, there is no such thing per se. However, I think that we should calculate link base address using following formula: link_base_addr = ~0; for (i = 0; i < ehdr->e_phnum; i++) link_base_addr = min(link_base_addr, phdr(i)->p_paddr); > How do you suggest it should be done in mb headers? I think that we can use multiboot_header_tag_address.load_addr as link_base_addr. Daniel