Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Ky8vu-0005dF-SL for mharc-grub-devel@gnu.org; Thu, 06 Nov 2008 12:46:14 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ky8vt-0005cD-3K for grub-devel@gnu.org; Thu, 06 Nov 2008 12:46:13 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ky8vr-0005bH-BC for grub-devel@gnu.org; Thu, 06 Nov 2008 12:46:12 -0500 Received: from [199.232.76.173] (port=43636 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ky8vr-0005bB-2v for grub-devel@gnu.org; Thu, 06 Nov 2008 12:46:11 -0500 Received: from igw2.br.ibm.com ([32.104.18.25]:38685) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ky8sX-00007U-1A; Thu, 06 Nov 2008 12:42:45 -0500 Received: from d24relay01.br.ibm.com (unknown [9.8.31.16]) by igw2.br.ibm.com (Postfix) with ESMTP id 8C07B17F63D; Thu, 6 Nov 2008 15:41:08 -0200 (BRDT) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.18.232.46]) by d24relay01.br.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id mA6HgI3k4173988; Thu, 6 Nov 2008 14:42:18 -0300 Received: from d24av01.br.ibm.com (loopback [127.0.0.1]) by d24av01.br.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id mA6HgdmO019058; Thu, 6 Nov 2008 15:42:39 -0200 Received: from [9.18.253.73] (manoel-laptop.br.ibm.com [9.18.253.73]) by d24av01.br.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id mA6HgdKJ019038; Thu, 6 Nov 2008 15:42:39 -0200 From: Manoel To: The development of GRUB 2 In-Reply-To: <20081106151246.GD24460@thorin> References: <1224622323.31194.81.camel@localhost.localdomain> <1224784802.9254.56.camel@manoel-laptop> <1224788935.16720.38.camel@localhost.localdomain> <1224885201.7358.53.camel@manoel-laptop> <1225127982.4991.7.camel@dv> <1225814725.6767.20.camel@manoel-laptop> <1225815138.15410.19.camel@localhost.localdomain> <1225822685.6767.28.camel@manoel-laptop> <1225842506.2997.21.camel@dv> <1225905915.26835.71.camel@localhost.localdomain> <20081106151246.GD24460@thorin> Content-Type: text/plain Date: Thu, 06 Nov 2008 15:42:36 -0200 Message-Id: <1225993356.6528.60.camel@manoel-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.24.1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Hollis Blanchard , Pavel Roskin , Carlos Roberto do Nascimento Costa , Segher Boessenkool Subject: Re: PPC64 mlongcall gcc flag X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Nov 2008 17:46:13 -0000 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 IBM Linux Technology Center Brazil