[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [GRUB2 PATCH v3 4/4] multiboot2: Add support for relocatable images
From: |
Daniel Kiper |
Subject: |
Re: [GRUB2 PATCH v3 4/4] multiboot2: Add support for relocatable images |
Date: |
Mon, 14 Mar 2016 12:38:30 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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
- Re: [GRUB2 PATCH v3 1/4] i386/relocator: Add grub_relocator64_efi relocator, (continued)
[GRUB2 PATCH v3 4/4] multiboot2: Add support for relocatable images, Daniel Kiper, 2016/03/02
Re: [GRUB2 PATCH v3 4/4] multiboot2: Add support for relocatable images, Vladimir 'phcoder' Serbinenko, 2016/03/10
[GRUB2 PATCH v3 3/4] multiboot2: Do not pass memory maps to image if EFI boot services are enabled, Daniel Kiper, 2016/03/02
Re: [GRUB2 PATCH v3 0/4] multiboot2: Add two extensions, Daniel Kiper, 2016/03/09