All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH][RFC] elf loader: use the virtual address
@ 2009-01-09 15:47 Aurelien Jarno
  2009-01-09 15:57 ` Laurent Desnogues
  0 siblings, 1 reply; 6+ messages in thread
From: Aurelien Jarno @ 2009-01-09 15:47 UTC (permalink / raw)
  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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-01-10 18:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-09 15:47 [Qemu-devel] [PATCH][RFC] elf loader: use the virtual address Aurelien Jarno
2009-01-09 15:57 ` Laurent Desnogues
2009-01-09 16:24   ` Aurelien Jarno
2009-01-09 23:38     ` Paul Brook
2009-01-10  3:45       ` Edgar E. Iglesias
2009-01-10 18:35       ` Aurelien Jarno

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.