Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LLigd-0008RR-Qs for qemu-devel@nongnu.org; Sat, 10 Jan 2009 13:35:55 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LLigb-0008R0-Ht for qemu-devel@nongnu.org; Sat, 10 Jan 2009 13:35:54 -0500 Received: from [199.232.76.173] (port=45902 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LLigb-0008Qx-BO for qemu-devel@nongnu.org; Sat, 10 Jan 2009 13:35:53 -0500 Received: from hall.aurel32.net ([88.191.82.174]:42648) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LLiga-0006N2-Vc for qemu-devel@nongnu.org; Sat, 10 Jan 2009 13:35:53 -0500 Received: from aurel32 by hall.aurel32.net with local (Exim 4.69) (envelope-from ) id 1LLigW-0006Uw-6l for qemu-devel@nongnu.org; Sat, 10 Jan 2009 19:35:48 +0100 Date: Sat, 10 Jan 2009 19:35:48 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH][RFC] elf loader: use the virtual address Message-ID: <20090110183548.GB10225@hall.aurel32.net> References: <20090109154756.GA27086@volta.aurel32.net> <761ea48b0901090757j7277ecbfo74dd1b6415fbeaa8@mail.gmail.com> <49677A28.5030602@aurel32.net> <200901091638.59346.paul@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <200901091638.59346.paul@codesourcery.com> Sender: Aurelien Jarno Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Fri, Jan 09, 2009 at 03:38:58PM -0800, Paul Brook wrote: > > For PowerPC, the kernel needs to be started with address translation > > enabled (that's even true for the firmware), and thus the kernel loaded > > at the virtual address. > > This sounds wrong. > > Surely we should be loading it at the paddr with translation disabled, hat's > the whole point of having both paddr and vaddr in the ELF headers. If the ppc > kernel isn't setting p_paddr to the load address then what is it setting it > to? It was set to the same value as the virtual address (0xc0000000), and it is now set to 0x00000000. > > /* address_offset is hack for kernel images that are > > linked at the wrong physical address. */ > > - addr = ph->p_paddr + address_offset; > > + addr = ph->p_vaddr + address_offset; > > > As all the other kernels/bios I have looked have the same virtual and > > physical address, I don't think it will break other targets. > > This will definitely break things. In particular bare metal applications built > for the Luminary Micro boards (and probably any other system that uses XIP > from flash). I also have several non-linux OS and bootloaders that rely on > the current elf loader behavior. > It's standard practice to use the paddr when loading an image. This si > consistent with gdb and several boot loaders. > If we want to mimic bootloaders, both quik and yaboot are using p_vaddr. -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net