[haiku-commits] Re: haiku: hrev47798 - headers/private/system src/system/boot/loader

  • From: pulkomandy <pulkomandy@xxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 2 Sep 2014 19:09:01 +0200

On Tue, Sep 02, 2014 at 06:51:45PM +0200, Paweł Dziepak wrote:
> 2014-09-02 18:24 GMT+02:00 <pulkomandy@xxxxxxxxxxxxx>:
> <snip>
> 
> > diff --git a/src/system/boot/loader/elf.cpp
> > b/src/system/boot/loader/elf.cpp
> > index 7479463..ef06097 100644
> > --- a/src/system/boot/loader/elf.cpp
> > +++ b/src/system/boot/loader/elf.cpp
> >
> <snip>
> 
> > @@ -275,7 +277,8 @@ ELFLoader<Class>::Load(int fd, preloaded_image* _image)
> >         // inbetween.
> >         totalSize = secondRegion->start + secondRegion->size -
> > firstRegion->start;
> >         if (totalSize > image->text_region.size + image->data_region.size
> > -               + 16 * 1024) {
> > +               + 32 * 1024) {
> > +               dprintf("Too much space between segments %" B_PRIuSIZE
> > "!\n", totalSize);
> >                 status = B_BAD_DATA;
> >                 goto error1;
> >         }
> >
> 
> To be honest, I don't think that there is any point in having this check.
> IIRC ELF specification doesn't impose any limit on the amount of unused
> space between "text region" and "data region", so it is wrong to do that in
> our code.

It seems that the quite limited elf loader used at boot time expects to
be able to put each ELF file inside a single linear memory region, and
that needs reasonably close addresses for all sections in the file
(otherwise it would run out of address space quickly).

This is used only to load the kernel and the boot modules, and we can
control how these are built. Everything else will be loaded using a
better loader once the MMU is fully configured and can have more
flexible mappings.

-- 
Adrien.

Other related posts: