From: Kevin Wolf <kwolf@redhat.com>
To: "Göran Weinholt" <goran@weinholt.se>
Cc: "René Rebe" <rene@exactcode.de>,
qemu-stable@nongnu.org, "Justin M. Forbes" <jmforbes@linuxtx.org>,
qemu-devel@nongnu.org, "Alexander Graf" <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH] multiboot: mh_load_end_addr and mh_bss_end_addr may be zero
Date: Tue, 31 Jan 2012 15:10:06 +0100 [thread overview]
Message-ID: <4F27F63E.9050307@redhat.com> (raw)
In-Reply-To: <87mx9ezir8.fsf@industria.weinholt.se>
Am 23.01.2012 13:49, schrieb Göran Weinholt:
> There are two special cases in the address fields of the multiboot
> format. If mh_load_end_addr is zero then the whole image file should
> be loaded and if mh_bss_end_addr is zero then there is no bss segment.
> With this change it is again possible to boot kernels where these
> fields are zero.
>
> Signed-off-by: Göran Weinholt <goran@weinholt.se>
> Tested-by: Alexander Graf <agraf@suse.de>
> ---
> hw/multiboot.c | 15 ++++++++++++++-
> 1 files changed, 14 insertions(+), 1 deletions(-)
>
> diff --git a/hw/multiboot.c b/hw/multiboot.c
> index b4484a3..db28328 100644
> --- a/hw/multiboot.c
> +++ b/hw/multiboot.c
> @@ -202,10 +202,23 @@ int load_multiboot(void *fw_cfg,
> uint32_t mh_bss_end_addr = ldl_p(header+i+24);
> mh_load_addr = ldl_p(header+i+16);
> uint32_t mb_kernel_text_offset = i - (mh_header_addr - mh_load_addr);
> - uint32_t mb_load_size = mh_load_end_addr - mh_load_addr;
> + uint32_t mb_load_size;
> +
> + /* A load end address of zero indicates that the whole file
> + * should be loaded. */
> + if (!mh_load_end_addr) {
> + mh_load_end_addr = kernel_file_size + mh_load_addr;
This is only right if the OS image starts at offset 0 in the image file.
IIUC, in the general case it starts at byte i - (mh_header_addr -
mh_load_addr), so you need to subtract this from kernel_file_size.
Kevin
next prev parent reply other threads:[~2012-01-31 14:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-23 12:49 [Qemu-devel] [PATCH] multiboot: mh_load_end_addr and mh_bss_end_addr may be zero Göran Weinholt
2012-01-31 14:10 ` Kevin Wolf [this message]
2012-02-01 0:44 ` Göran Weinholt
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=4F27F63E.9050307@redhat.com \
--to=kwolf@redhat.com \
--cc=agraf@suse.de \
--cc=goran@weinholt.se \
--cc=jmforbes@linuxtx.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=rene@exactcode.de \
/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.