qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH][RFC] elf loader: use the virtual address


From: Aurelien Jarno
Subject: [Qemu-devel] [PATCH][RFC] elf loader: use the virtual address
Date: Fri, 9 Jan 2009 16:47:56 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

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
 `. `'   address@hidden         | address@hidden
   `-    people.debian.org/~aurel32 | www.aurel32.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]