From: "Blue Swirl" <blauwirbel@gmail.com>
To: "J. Mayer" <l_indien@magic.fr>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC, PATCH] Support for loading 32 bit ELF files for 64 bit linux-user
Date: Sun, 7 Oct 2007 17:38:51 +0300 [thread overview]
Message-ID: <f43fc5580710070738s74623fbeu5fa3193f5f63d05d@mail.gmail.com> (raw)
In-Reply-To: <1191765716.9976.17.camel@rapid>
On 10/7/07, J. Mayer <l_indien@magic.fr> wrote:
> On Sun, 2007-10-07 at 15:45 +0300, Blue Swirl wrote:
> > Hi,
>
> Hi,
>
> > This patch adds support for loading a 32 bit ELF file in the 64 bit
> > user mode emulator. This means that qemu-sparc64 can be used to
> > execute 32 bit ELF files containing V9 instructions (SPARC32PLUS).
> > This format is used by Solaris/Sparc and maybe by Debian in the
> > future.
> >
> > Other targets shouldn't be affected, but I have done only compile
> > testing. Any comments?
>
> The idea of loading 32 bits executables on 64 bits target seems great.
> Then, I got two remarks about this patch:
> - it seems that it does not take care about my patch. As I was to commit
> it today, I wonder if I still should do it. But then, your patch lacks
> some bugifxes (start_data not properly computed and TARGET_LONG_BITS !=
> HOST_LONG_BITS problems).
Well, I thought that you had already applied the patch.
> - it seems that quite all the ELF loader code is affected by your patch.
> I think (maybe too naively) that adding functions to read the ELF infos
> should be sufficient, ie add a read_elf_ehdr, ..., functions and a few
> patches in the create_elf_table function. Then, all informations nedded
> to load a 32 bits executable can be kept into the 64 bits structures. As
> the kernel does not duplicate the code to handle this case, I think Qemu
> loader should be kept as simple as the kernel one, and the elfload_ops.h
> seems to me to be useless. In fact, Qemu loader could (should ?) even be
> the same code than the kernel one with just a few helpers for endianness
> swaps and the needed fixes to avoid confusions between host_long and
> target_long...
Sparc64 Linux handles 32 bit ELF binaries (both V8 = 32 bit insn and
V9 = 64 bit insn) in arch/sparc64/kernel/binfmt_elf32.c, which
#includes fs/binfmt_elf.c.
64 bit V9 binaries are handled by fs/binfmt_elf.c.
In Qemu we can't do it like this, because V9 instruction emulator must
be used to handle also the 32 bit ELF. The same effect could be
achieved in Qemu for example by adding new file elfload_32.c, which
would include elfload.c after defining the ELF classes etc. This would
need some rearranging in elfload.c so that the ELF parameters can be
overridden. I'm not sure this would be much cleaner than my version
using glue().
next prev parent reply other threads:[~2007-10-07 14:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-07 12:45 [Qemu-devel] [RFC, PATCH] Support for loading 32 bit ELF files for 64 bit linux-user Blue Swirl
2007-10-07 14:01 ` J. Mayer
2007-10-07 14:38 ` Blue Swirl [this message]
2007-10-07 14:49 ` J. Mayer
2007-10-07 15:15 ` Blue Swirl
2007-10-07 15:46 ` J. Mayer
2007-10-07 16:21 ` Thiemo Seufer
2007-10-07 17:07 ` Blue Swirl
2007-10-07 17:35 ` 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=f43fc5580710070738s74623fbeu5fa3193f5f63d05d@mail.gmail.com \
--to=blauwirbel@gmail.com \
--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).