From: Eduardo Habkost <ehabkost@redhat.com>
To: Anatol Pomozov <anatol.pomozov@gmail.com>
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
Richard Henderson <rth@twiddle.net>,
Paolo Bonzini <pbonzini@redhat.com>,
Alexander Graf <agraf@suse.de>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/4] multiboot: load any machine type of ELF
Date: Fri, 13 Oct 2017 20:21:14 -0300 [thread overview]
Message-ID: <20171013232114.GD3246@localhost.localdomain> (raw)
In-Reply-To: <CAOMFOmW+r86WHWPUMtG54BrAQXqSWZ67oF-6G697ox-7AKL4GA@mail.gmail.com>
On Fri, Oct 13, 2017 at 02:25:43PM -0700, Anatol Pomozov wrote:
> Hi
>
> On Fri, Oct 13, 2017 at 12:25 PM, Eduardo Habkost <ehabkost@redhat.com> wrote:
> > On Thu, Oct 12, 2017 at 04:54:37PM -0700, Anatol Pomozov wrote:
> >> x86 is not the only architecture supported by multiboot.
> >> For example GRUB supports MIPS architecture as well.
> >>
> >> Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
> >> ---
> >> hw/i386/multiboot.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
> >> index c9254f313e..7dacd6d827 100644
> >> --- a/hw/i386/multiboot.c
> >> +++ b/hw/i386/multiboot.c
> >> @@ -173,7 +173,7 @@ int load_multiboot(FWCfgState *fw_cfg,
> >> }
> >>
> >> kernel_size = load_elf(kernel_filename, NULL, NULL, &elf_entry,
> >> - &elf_low, &elf_high, 0, I386_ELF_MACHINE,
> >> + &elf_low, &elf_high, 0, EM_NONE,
> >> 0, 0);
> >
> > I assume we still want PC to reject non-x86 ELF files.
>
> Does multiboot spec states this restriction? I've heard that there are
> attempts to implement multiboot at ARM [1] [2]. Also multiboot2 spec
> mentions MIPS as one of the target architectures.
>
> [1] https://github.com/jncronin/rpi-boot/blob/master/MULTIBOOT-ARM
> [2] https://wiki.linaro.org/AndrePrzywara/Multiboot
I don't believe the spec restricts that, but I don't see why it
would be useful to load an ELF file that doesn't match the target
architecture (e.g. loading non-x86 ELF files on a x86 machine
like PC).
>
> > Isn't it
> > better to add a elf_machine argument to load_multiboot() so each
> > load_multiboot() caller can specify what's the expected
> > architecture?
> >
> >
> >> if (kernel_size < 0) {
> >> fprintf(stderr, "Error while loading elf kernel\n");
> >> --
> >> 2.15.0.rc0.271.g36b669edcc-goog
> >>
> >
> > --
> > Eduardo
--
Eduardo
next prev parent reply other threads:[~2017-10-13 23:21 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-12 23:54 [Qemu-devel] (no subject) Anatol Pomozov
2017-10-12 23:54 ` [Qemu-devel] [PATCH 1/4] multiboot: Change multiboot_info from array of bytes to a C struct Anatol Pomozov
2018-01-15 14:49 ` Kevin Wolf
2018-01-29 18:21 ` Anatol Pomozov
2018-01-29 20:02 ` Kevin Wolf
2018-02-09 21:48 ` Anatol Pomozov
2018-02-09 21:52 ` Anatol Pomozov
2018-02-12 13:33 ` Kevin Wolf
2018-02-12 13:37 ` Kevin Wolf
2017-10-12 23:54 ` [Qemu-devel] [PATCH 2/4] multiboot: load any machine type of ELF Anatol Pomozov
2017-10-13 19:25 ` Eduardo Habkost
2017-10-13 21:25 ` Anatol Pomozov
2017-10-13 23:21 ` Eduardo Habkost [this message]
2017-10-14 13:41 ` Peter Maydell
2017-10-16 8:27 ` Kevin Wolf
2017-10-16 18:38 ` Anatol Pomozov
2018-01-15 14:52 ` Kevin Wolf
2018-01-29 18:35 ` Anatol Pomozov
2017-10-12 23:54 ` [Qemu-devel] [PATCH 3/4] multiboot: load elf sections and section headers Anatol Pomozov
2017-10-18 17:22 ` Anatol Pomozov
2017-10-19 9:36 ` Kevin Wolf
2017-10-31 18:38 ` Anatol Pomozov
2017-11-17 21:33 ` Anatol Pomozov
2017-11-20 16:45 ` Kevin Wolf
2018-01-15 15:41 ` Kevin Wolf
2018-01-29 19:16 ` Anatol Pomozov
2017-10-12 23:54 ` [Qemu-devel] [PATCH 4/4] multiboot: make tests work with clang Anatol Pomozov
2017-10-13 8:01 ` Thomas Huth
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=20171013232114.GD3246@localhost.localdomain \
--to=ehabkost@redhat.com \
--cc=agraf@suse.de \
--cc=anatol.pomozov@gmail.com \
--cc=kwolf@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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 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.