qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thiemo Seufer <ths@networkno.de>
To: "J. Mayer" <l_indien@magic.fr>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] RFC: cleanups in ELF loader
Date: Mon, 1 Oct 2007 04:35:22 +0100	[thread overview]
Message-ID: <20071001033522.GG13317@networkno.de> (raw)
In-Reply-To: <1191206541.29900.166.camel@rapid>

J. Mayer wrote:
> On Sun, 2007-09-30 at 17:09 +0200, J. Mayer wrote:
> > On Sun, 2007-09-30 at 14:38 +0100, Thiemo Seufer wrote:
> > > J. Mayer wrote:
> > > > Following what I've done in the syscalls emulation routines, it appeared
> > > > to me that there seems to be a lot of confusions between host and target
> > > > long in the ELF loader.
> > > 
> > > But the ELF fields are tied to the ELFCLASS of the supported ABI, not to
> > > the register width of the machine emulation. If anything they should
> > > become the ELF types.
> > > 
> > > (Your approach will e.g. break down for MIPS N32, where "long" is smaller
> > > thant the register width, and the ABI uses ELFCLASS32.)
> > 
> > OK, I will try to rework this.
> 
> I did check in the linux kernel and it appears that all variables I
> changed from unsigned long to target_ulong seem to be unsigned long in the
> kernel. This looks fine for me as they are addresses in the process virtual address space, 
> so they should fit in a target_ulong, whatever the target registers size could be.

As long as eventual sign extensions are done properly this is ok.
(Some places in the kernel have casts to elf_greg_t for that purpose.)

> What seems bugged to me (but I did not make any change in that part) is
> the auxiliary vectors generation. This seems to me to be the only place
> where Linux explicitelly uses elf_addr_t so Qemu should do the same.
> Then, it seems that my patch is not so bad and should not break anything
> but is not complete as it does not fix the auxiliary vectors.
> 
> Do you agree with this, or did I miss something else ?

The kernel loader (fs/binfmt_elf.c) is somewhat geared towards single
ABI architectures. PowerPC, MIPS, SPARC etc. have all their own kludge
(in arch/$ARCH/kernel/binfmt_elf*.c) to redefine some essential bits
and then #include fs/binfmt_elf.c.

The whole thing looks a bit scary, I'm not sure we should import it in
Qemu. OTOH it is generally a good idea to stay in sync with the kernel
implementation.


Thiemo

  reply	other threads:[~2007-10-01  3:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-30  1:39 [Qemu-devel] RFC: cleanups in ELF loader J. Mayer
2007-09-30  2:15 ` Edgar E. Iglesias
2007-09-30  2:28   ` J. Mayer
2007-09-30  2:38     ` Edgar E. Iglesias
2007-09-30 13:38 ` Thiemo Seufer
2007-09-30 15:09   ` J. Mayer
2007-10-01  2:42     ` J. Mayer
2007-10-01  3:35       ` Thiemo Seufer [this message]
2007-10-04  3:26         ` J. Mayer
2007-10-04 11:20           ` Thiemo Seufer
2007-10-05 12:38             ` J. Mayer

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=20071001033522.GG13317@networkno.de \
    --to=ths@networkno.de \
    --cc=l_indien@magic.fr \
    --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).