Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LLJab-0003lW-E1 for qemu-devel@nongnu.org; Fri, 09 Jan 2009 10:48:01 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LLJaZ-0003lK-TB for qemu-devel@nongnu.org; Fri, 09 Jan 2009 10:48:00 -0500 Received: from [199.232.76.173] (port=39331 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LLJaZ-0003lH-Nk for qemu-devel@nongnu.org; Fri, 09 Jan 2009 10:47:59 -0500 Received: from hall.aurel32.net ([88.191.82.174]:39102) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LLJaZ-0002cn-9Y for qemu-devel@nongnu.org; Fri, 09 Jan 2009 10:47:59 -0500 Received: from volta.aurel32.net ([2002:52e8:2fb:1:21e:8cff:feb0:693b]) by hall.aurel32.net with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1LLJaX-00008m-LX for qemu-devel@nongnu.org; Fri, 09 Jan 2009 16:47:57 +0100 Received: from aurel32 by volta.aurel32.net with local (Exim 4.69) (envelope-from ) id 1LLJaW-0007Cy-Ni for qemu-devel@nongnu.org; Fri, 09 Jan 2009 16:47:56 +0100 Date: Fri, 9 Jan 2009 16:47:56 +0100 From: Aurelien Jarno Message-ID: <20090109154756.GA27086@volta.aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Subject: [Qemu-devel] [PATCH][RFC] elf loader: use the virtual address 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 Most Linux kernels have their physical address corresponding to they virtual address in the ELF header. This is however not true anymore for the PowerPC kernels (>= 2.6.25). 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. 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 is what is done in the patch below. Alternatively, we can add a new argument to the load_elf functions, to select between virtual and physical load address. Any opinon? diff --git a/elf_ops.h b/elf_ops.h index feea12f..19d1a5e 100644 --- a/elf_ops.h +++ b/elf_ops.h @@ -231,7 +231,7 @@ static int glue(load_elf, SZ)(int fd, int64_t address_offset, } /* 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; cpu_physical_memory_write_rom(addr, data, mem_size); -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net