From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Vladimir 'phcoder' Serbinenko" Subject: Re: [GRUB2 PATCH v3 4/4] multiboot2: Add support for relocatable images Date: Fri, 11 Mar 2016 17:13:19 +0100 Message-ID: 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: multipart/mixed; boundary="===============7899491322800714243==" Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1aePgo-0005OM-Bf for xen-devel@lists.xenproject.org; Fri, 11 Mar 2016 16:13:22 +0000 Received: by mail-wm0-f66.google.com with SMTP id n205so3301608wmf.2 for ; Fri, 11 Mar 2016 08:13:20 -0800 (PST) In-Reply-To: <20160311160635.GB3500@olila.local.net-space.pl> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: Daniel Kiper 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" List-Id: xen-devel@lists.xenproject.org --===============7899491322800714243== Content-Type: multipart/alternative; boundary=001a114228329bb385052dc83511 --001a114228329bb385052dc83511 Content-Type: text/plain; charset=UTF-8 > > > > > + 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? How is entry usually specified in ELF? How do you suggest it should be done in mb headers? > > > from base addr. What do ET_DYN files use? > > I will take a look. > > Daniel > -- Regards Vladimir 'phcoder' Serbinenko --001a114228329bb385052dc83511 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

> > +=C2=A0 if (relocatable)
> > +=C2=A0 =C2=A0 {
> > +=C2=A0 =C2=A0 =C2=A0 if (base_addr > min_addr)
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0grub_multiboot_payload_eip +=3D base_= addr - min_addr;
> > +=C2=A0 =C2=A0 =C2=A0 else
> > +=C2=A0 =C2=A0 =C2=A0 =C2=A0grub_multiboot_payload_eip -=3D min_a= ddr - base_addr;
> > +=C2=A0 =C2=A0 }
> > +
> >
> Why is it relative to min_addr? Sounds like it should be just an offse= t

Ugh... IIRC, it has meaning but I forgot what. I will check it.
However, this means that I must put comment here.
=C2= =A0
Is it possible that you have confused link address and minima= l loading address? How is entry usually specified in ELF? How do you sugges= t it should be done in mb headers?

> from base addr. What do ET_DYN files use?

I will take a look.

Daniel


--
Regards
Vladimir 'phcoder' Serbinenk= o

--001a114228329bb385052dc83511-- --===============7899491322800714243== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwOi8vbGlzdHMueGVuLm9y Zy94ZW4tZGV2ZWwK --===============7899491322800714243==--