From: "Laurent Desnogues" <laurent.desnogues@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH][RFC] elf loader: use the virtual address
Date: Fri, 9 Jan 2009 16:57:36 +0100 [thread overview]
Message-ID: <761ea48b0901090757j7277ecbfo74dd1b6415fbeaa8@mail.gmail.com> (raw)
In-Reply-To: <20090109154756.GA27086@volta.aurel32.net>
On Fri, Jan 9, 2009 at 4:47 PM, Aurelien Jarno <aurelien@aurel32.net> wrote:
> 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?
I wonder if some platforms don't use the address_offset parameter
to simulate that behaviour.
Anyway wouldn't a parameter be cleaner and allow more flexibility?
Laurent
> 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
>
>
>
next prev parent reply other threads:[~2009-01-09 16:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-09 15:47 [Qemu-devel] [PATCH][RFC] elf loader: use the virtual address Aurelien Jarno
2009-01-09 15:57 ` Laurent Desnogues [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=761ea48b0901090757j7277ecbfo74dd1b6415fbeaa8@mail.gmail.com \
--to=laurent.desnogues@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).