From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1GcT9L-00043A-CC for mharc-grub-devel@gnu.org; Tue, 24 Oct 2006 16:45:27 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GcT9J-00040u-Ir for grub-devel@gnu.org; Tue, 24 Oct 2006 16:45:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GcT9I-0003zY-Tn for grub-devel@gnu.org; Tue, 24 Oct 2006 16:45:24 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GcT9I-0003zO-EB for grub-devel@gnu.org; Tue, 24 Oct 2006 16:45:24 -0400 Received: from [66.111.4.26] (helo=out2.smtp.messagingengine.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GcT9I-0002S6-I2 for grub-devel@gnu.org; Tue, 24 Oct 2006 16:45:24 -0400 Received: from db2.internal (db2.internal [10.202.2.12]) by frontend1.messagingengine.com (Postfix) with ESMTP id 14C97DB944B for ; Tue, 24 Oct 2006 16:45:23 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by db2.internal (MEProxy); Tue, 24 Oct 2006 16:45:25 -0400 X-Sasl-enc: /wfOjPva6dTE4lp3IznTWFxnk+kTD4u33phxcpBLfN7C 1161722725 Received: from basalt.austin.ibm.com (bi01p1.co.us.ibm.com [32.97.110.142]) by mail.messagingengine.com (Postfix) with ESMTP id 4B1031128E for ; Tue, 24 Oct 2006 16:45:25 -0400 (EDT) From: Hollis Blanchard To: The development of GRUB 2 In-Reply-To: <87iri91lug.fsf@night.trouble.net> References: <1160779061.21017.75.camel@basalt.austin.ibm.com> <200610141733.44320.okuji@enbug.org> <1161720181.23331.25.camel@basalt.austin.ibm.com> <87iri91lug.fsf@night.trouble.net> Content-Type: text/plain Date: Tue, 24 Oct 2006 15:45:22 -0500 Message-Id: <1161722722.23331.46.camel@basalt.austin.ibm.com> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 (2.6.3-1.fc5.5) Content-Transfer-Encoding: 7bit Subject: Re: [PATCH] generic ELF loading 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: Tue, 24 Oct 2006 20:45:25 -0000 On Tue, 2006-10-24 at 22:48 +0200, Johan Rydberg wrote: > Hollis Blanchard writes: > > >> The idea is very good. But I don't like that loaded areas are always allocated > >> from the heap. GRUB has a staging area for OS images on i386-pc, and I prefer > >> to load an image directly instead of consuming the heap. > > > > Actually I'm not using the heap, I'm just directly copying wherever > > phdr->p_paddr says to. That's not a good thing actually; in the future > > we should add some error checking to make sure we don't clobber GRUB > > itself. > > Have you looked at how EFI solves this? > > They keep track of all memory regions, and with each region is a > "memory type" associated. Whenever you allocate memory you change the > type of the region (from "free") to some that makes sense (could be > "loader data", "disk cache", ...). You can only allocate memory that > is marked "conventional", meaning it is considered free. The memory > region database is later feed to the operating system. We could do > the same. > > Is this case we could allocate the regions specified by the ELF image. > If any of the allocations fail we know there is something already > loaded there, or the image is faulty. That's a great point. Doing a "claim" (as described in my reply to Tristan) will return an error if the area is already claimed, so that will accomplish the check. On x86, the load hook will manually check to make sure the address is within the OS load area. -Hollis