grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PPC64 mlongcall gcc flag


From: Manoel
Subject: Re: PPC64 mlongcall gcc flag
Date: Thu, 06 Nov 2008 15:42:36 -0200

Humm..we should do something to prevent memory to be allocated above
32mb  (actually things can be above 32mb...but they cant be at a large
offset since the PowerPC branch instruction works with offsets not
absolute address). 

The thing is I was able to load the modules in P6 by changing the link
address to 0x200000.

Previously I had changed the load-base (from 0x4000 to 0x200000) address
since I was having trouble with memory overlapping and OF failed to put
the segments at the correct address. With it things worked in P5 but not
in P6 (with "relocated overflow"). That was resolved by passing
mlongcall flag to gcc (that changes a indirect branch to a direct
branch).

Now I changed back the load-base address to 0x4000 e put the grub link
address to 0x200000(same that yaboot use) and I was able to boot the P6
machine without using the mlongcall flag.

That must be a coincidence though, by changing the memory layout things
were allocated at a different place. The better solution would be to
guarantee things are allocated within the direct branch range.

On Thu, 2008-11-06 at 16:12 +0100, Robert Millan wrote:
> On Wed, Nov 05, 2008 at 11:25:15AM -0600, Hollis Blanchard wrote:
> > 
> > Module memory is allocated by grub_malloc(), but as you can see at
> > http://svn.savannah.gnu.org/viewvc/trunk/grub2/kern/ieee1275/init.c?revision=1806&root=grub&view=markup
> >  the GRUB heap capped at 4MB (I don't mean size, I mean the end of the 
> > heap).
> 
> It's not really capped at 4 MB.  It will cap it only when an heuristic tells 
> it
> there's still enough room for heap:
> 
>     /* Avoid claiming anything above HEAP_MAX_ADDR, if possible. */
>     if ((addr < HEAP_MAX_ADDR) &&                                /* if it's 
> too late, don't bother */
>         (addr + len > HEAP_MAX_ADDR) &&                                     
> /* if it wasn't available anyway, don't bother */
>         (total + (HEAP_MAX_ADDR - addr) > HEAP_MIN_SIZE))                   
> /* only limit ourselves when we can afford to */
> 
> Argueably, this is not my best piece of code...  today I'd have implemented a
> payload relocator (like the one used by loader/i386/pc/multiboot.c) just so we
> can happily use everything in /memory/available as heap.
> 
> And I'd even advice doing the same for powerpc (sharing code with i386 if
> possible).
> 
-- 
Best Regards,

Manoel Abranches <address@hidden>
IBM Linux Technology Center Brazil





reply via email to

[Prev in Thread] Current Thread [Next in Thread]