qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Alexander Graf <agraf@suse.de>
Cc: "René Rebe" <rene@exactcode.de>,
	"Justin M. Forbes" <jmforbes@linuxtx.org>,
	"Göran Weinholt" <goran@weinholt.se>,
	"qemu-devel Developers" <qemu-devel@nongnu.org>,
	qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] multiboot: Fix bss segment support
Date: Mon, 19 Dec 2011 16:01:27 -0600	[thread overview]
Message-ID: <4EEFB437.8050902@codemonkey.ws> (raw)
In-Reply-To: <0F9E6CB6-F6FB-4C3E-B828-370E1486B95E@suse.de>

On 12/19/2011 11:35 AM, Alexander Graf wrote:
>
> On 24.07.2011, at 17:55, Göran Weinholt wrote:
>
>> Multiboot images can specify a bss segment. The boot loader must clear
>> the memory of the bss and ensure that no modules or structures are
>> allocated inside it. Several fields are provided in the Multiboot
>> header that were previously not used properly. The header is now used
>> to determine how much data should be read from the image and how much
>> memory should be reserved to the bss segment.
>
> This patch breaks the OSX booter:
>
>    http://people.exactcode.de/~rene/mac/boot

How is this licensed?  Is there source available?

>
> It now fails in fread(). Please revert this change for 1.0.1 and/or provide a timely fix.

Is the patch incorrect in some way?  I don't see how it's reasonable to expect 
someone to fix a guest that cannot be legally run under QEMU.

If the patch is obviously incorrect, I'm all for reverting it, but I don't think 
we can reasonably ask people to debug OS X guest failures since OS X is clearly 
not allowed to run under QEMU.

Regards,

Anthony Liguori

>
> Alex
>
>>
>> Signed-off-by: Göran Weinholt<goran@weinholt.se>
>> ---
>> hw/multiboot.c |   14 +++++++++-----
>> 1 files changed, 9 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/multiboot.c b/hw/multiboot.c
>> index 2426e84..a1d3f41 100644
>> --- a/hw/multiboot.c
>> +++ b/hw/multiboot.c
>> @@ -198,11 +198,14 @@ int load_multiboot(void *fw_cfg,
>>      } else {
>>          /* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_ADDR. */
>>          uint32_t mh_header_addr = ldl_p(header+i+12);
>> +        uint32_t mh_load_end_addr = ldl_p(header+i+20);
>> +        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;
>>
>>          mh_entry_addr = ldl_p(header+i+28);
>> -        mb_kernel_size = kernel_file_size - mb_kernel_text_offset;
>> +        mb_kernel_size = mh_bss_end_addr - mh_load_addr;
>>
>>          /* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_VBE.
>>          uint32_t mh_mode_type = ldl_p(header+i+32);
>> @@ -212,17 +215,18 @@ int load_multiboot(void *fw_cfg,
>>
>>          mb_debug("multiboot: mh_header_addr = %#x\n", mh_header_addr);
>>          mb_debug("multiboot: mh_load_addr = %#x\n", mh_load_addr);
>> -        mb_debug("multiboot: mh_load_end_addr = %#x\n", ldl_p(header+i+20));
>> -        mb_debug("multiboot: mh_bss_end_addr = %#x\n", ldl_p(header+i+24));
>> +        mb_debug("multiboot: mh_load_end_addr = %#x\n", mh_load_end_addr);
>> +        mb_debug("multiboot: mh_bss_end_addr = %#x\n", mh_bss_end_addr);
>>          mb_debug("qemu: loading multiboot kernel (%#x bytes) at %#x\n",
>> -                 mb_kernel_size, mh_load_addr);
>> +                 mb_load_size, mh_load_addr);
>>
>>          mbs.mb_buf = qemu_malloc(mb_kernel_size);
>>          fseek(f, mb_kernel_text_offset, SEEK_SET);
>> -        if (fread(mbs.mb_buf, 1, mb_kernel_size, f) != mb_kernel_size) {
>> +        if (fread(mbs.mb_buf, 1, mb_load_size, f) != mb_load_size) {
>>              fprintf(stderr, "fread() failed\n");
>>              exit(1);
>>          }
>> +        memset(mbs.mb_buf + mb_load_size, 0, mb_kernel_size - mb_load_size);
>>          fclose(f);
>>      }
>>
>> --
>> 1.7.2.5
>>
>>
>
>

  reply	other threads:[~2011-12-19 22:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-24 15:55 [Qemu-devel] [PATCH v2] multiboot: Fix bss segment support Göran Weinholt
2011-07-24 16:20 ` malc
2011-07-29 14:36 ` Anthony Liguori
2011-12-19 17:35 ` Alexander Graf
2011-12-19 22:01   ` Anthony Liguori [this message]
2011-12-19 22:26     ` Alexander Graf
2011-12-20 11:53       ` Göran Weinholt
2011-12-20 14:07         ` Alexander Graf
2011-12-20 18:49           ` Göran Weinholt
2011-12-20 19:46             ` Alexander Graf
2012-01-23 11:34             ` Kevin Wolf

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=4EEFB437.8050902@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --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 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).