Le sam. 13 févr. 2016 06:30, Andrei Borzenkov <arvidj...@gmail.com> a
écrit :

> 13.02.2016 00:35, Eric Snowberg пишет:
> > OBP available region contains grub. Start at grub_phys_end.
> >
> > This prevents a problem where grub was being overwritten since
> > grub_phys_start does not start at a zero offset within the memory
> > map.
> >
> > Signed-off-by: Eric Snowberg <eric.snowb...@oracle.com>
> > ---
> >  grub-core/loader/sparc64/ieee1275/linux.c |   16 ++++++++--------
> >  1 files changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/grub-core/loader/sparc64/ieee1275/linux.c
> b/grub-core/loader/sparc64/ieee1275/linux.c
> > index d44d7a1..67ef048 100644
> > --- a/grub-core/loader/sparc64/ieee1275/linux.c
> > +++ b/grub-core/loader/sparc64/ieee1275/linux.c
> > @@ -203,20 +203,20 @@ alloc_phys_choose (grub_uint64_t addr,
> grub_uint64_t len,
> >    if (addr + ctx->size >= end)
> >      return 0;
> >
> > -  if (addr >= grub_phys_start && addr < grub_phys_end)
> > -    {
> > -      addr = ALIGN_UP (grub_phys_end, FOUR_MB);
> > -      if (addr + ctx->size >= end)
> > -     return 0;
> > -    }
> > -  if ((addr + ctx->size) >= grub_phys_start
> > -      && (addr + ctx->size) < grub_phys_end)
> > +  /* OBP available region contains grub. Start at grub_phys_end. */
> > +  /* grub_phys_start does not start at the beginning of the memory
> region */
> > +  if ((grub_phys_start >= addr && grub_phys_end < end) ||
> > +      (addr > grub_phys_start && addr < grub_phys_end))
>
> What about
>
> a) overlapping regions?
>
> addr < grub_phys_start < end < grub_phys_end
>
> Good catch. Condition should have been
grub_phys_start >= addr && grub_phys_start < end) || (addr >
grub_phys_start && addr < grub_phys_end))
My pattern matching algorithm failed and I thought it was standard check
for segment intersection but it wasn't. I'll fix this


>
> b) is is possible for requested region to fit before grub?
>
There is only 16KiB of memory before GRUB but thinking about it again, it's
16 KiB of virtual memory, not physical. What about attached patch?

>
>
> addr < end < grub_phys_start
>
> >      {
> >        addr = ALIGN_UP (grub_phys_end, FOUR_MB);
> >        if (addr + ctx->size >= end)
> >       return 0;
> >      }
> >
> > +  grub_dprintf("loader",
> > +    "addr = 0x%lx grub_phys_start = 0x%lx grub_phys_end = 0x%lx\n",
> > +    addr, grub_phys_start, grub_phys_end);
> > +
> >    if (loaded)
> >      {
> >        grub_addr_t linux_end = ALIGN_UP (linux_paddr + linux_size,
> FOUR_MB);
> >
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>

Attachment: filetree.diff (1)
Description: Binary data

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to