From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LLQwX-0000Rq-Ba for qemu-devel@nongnu.org; Fri, 09 Jan 2009 18:39:09 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LLQwV-0000Rc-Vk for qemu-devel@nongnu.org; Fri, 09 Jan 2009 18:39:08 -0500 Received: from [199.232.76.173] (port=38777 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LLQwV-0000RZ-P0 for qemu-devel@nongnu.org; Fri, 09 Jan 2009 18:39:07 -0500 Received: from mx20.gnu.org ([199.232.41.8]:65261) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LLQwV-0008AV-G6 for qemu-devel@nongnu.org; Fri, 09 Jan 2009 18:39:07 -0500 Received: from mail.codesourcery.com ([65.74.133.4]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LLQwU-0004Ph-1k for qemu-devel@nongnu.org; Fri, 09 Jan 2009 18:39:06 -0500 From: Paul Brook Subject: Re: [Qemu-devel] [PATCH][RFC] elf loader: use the virtual address Date: Fri, 9 Jan 2009 15:38:58 -0800 References: <20090109154756.GA27086@volta.aurel32.net> <761ea48b0901090757j7277ecbfo74dd1b6415fbeaa8@mail.gmail.com> <49677A28.5030602@aurel32.net> In-Reply-To: <49677A28.5030602@aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200901091638.59346.paul@codesourcery.com> 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 Cc: Aurelien Jarno > 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? > /* 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. See also http://lists.gnu.org/archive/html/qemu-devel/2008-10/msg00864.html Paul