From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYRim-00060H-7f for qemu-devel@nongnu.org; Sat, 26 May 2012 20:52:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SYRik-0004kY-Ex for qemu-devel@nongnu.org; Sat, 26 May 2012 20:52:35 -0400 Received: from mail-ob0-f173.google.com ([209.85.214.173]:49628) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYRik-0004kL-9o for qemu-devel@nongnu.org; Sat, 26 May 2012 20:52:34 -0400 Received: by obbwd20 with SMTP id wd20so4001004obb.4 for ; Sat, 26 May 2012 17:52:30 -0700 (PDT) Message-ID: <4FC17ACB.1060502@codemonkey.ws> Date: Sat, 26 May 2012 19:52:27 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <4F70C0E4.9000700@codemonkey.ws> <201205270017.34477@kevin-wolf.de> In-Reply-To: <201205270017.34477@kevin-wolf.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] fix multiboot loading if load_end_addr == 0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Scott Moser , qemu-devel@nongnu.org On 05/26/2012 05:17 PM, Kevin Wolf wrote: > Am Montag, 26. März 2012 21:27:00 schrieb Scott Moser: >> The previous multiboot load code did not treat the case where >> load_end_addr was 0 specially. The multiboot specification says the >> following: >> * load_end_addr >> Contains the physical address of the end of the data segment. >> (load_end_addr - load_addr) specifies how much data to load. This >> implies that the text and data segments must be consecutive in the >> OS image; this is true for existing a.out executable formats. If >> this field is zero, the boot loader assumes that the text and data >> segments occupy the whole OS image file. >> >> Signed-off-by: Scott Moser >> >> diff --git a/hw/multiboot.c b/hw/multiboot.c >> index b4484a3..b1e04c5 100644 >> --- a/hw/multiboot.c >> +++ b/hw/multiboot.c >> @@ -202,10 +202,16 @@ 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 = 0; >> mh_entry_addr = ldl_p(header+i+28); >> - mb_kernel_size = mh_bss_end_addr - mh_load_addr; >> + >> + if (mh_load_end_addr) { >> + mb_kernel_size = mh_bss_end_addr - mh_load_addr; >> + mb_load_size = mh_load_end_addr - mh_load_addr; >> + } else { >> + mb_kernel_size = kernel_file_size - mb_kernel_text_offset; >> + mb_load_size = mb_kernel_size; >> + } >> >> /* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_VBE. >> uint32_t mh_mode_type = ldl_p(header+i+32); > > > Anthony, what happened with this patch? It wasn't top posted so it got lost. > Can we still get it into 1.1? Yeah, I'll queue it. Regards, Anthony Liguori > > Kevin