Received: from eggs.gnu.org ([140.186.70.92]:33576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rd4rb-0007rA-I8 for qemu-devel@nongnu.org; Tue, 20 Dec 2011 13:56:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rd4rY-0002gl-PE for qemu-devel@nongnu.org; Tue, 20 Dec 2011 13:56:35 -0500 From: =?utf-8?Q?G=C3=B6ran?= Weinholt References: <874o2bhdv5.fsf@industria.weinholt.se> <0F9E6CB6-F6FB-4C3E-B828-370E1486B95E@suse.de> <4EEFB437.8050902@codemonkey.ws> <529972F2-0826-4716-BCD0-E425C2F49EAA@suse.de> <87pqfja28l.fsf@industria.weinholt.se> Date: Tue, 20 Dec 2011 19:49:10 +0100 In-Reply-To: (Alexander Graf's message of "Tue, 20 Dec 2011 15:07:32 +0100") Message-ID: <878vm76puh.fsf@industria.weinholt.se> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Subject: Re: [Qemu-devel] [PATCH v2] multiboot: Fix bss segment support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Kevin Wolf , =?utf-8?Q?Ren=C3=A9?= Rebe , "Justin M. Forbes" , qemu-devel Developers , qemu-stable@nongnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Alexander Graf writes: > Yes, this patch makes things work again :). Thanks a lot! > > The only thing I could nitpick on would be the coding style - checkpatch.= pl complains :). Could you please resend with braces? > Justin, Please also queue this for 1.0-stable when it comes in its final = form. > > Tested-by: Alexander Graf Thanks for testing it. Here it is, with braces this time. From=202a2df801d68a76fb2210e556652fb2e17e0f6711 Mon Sep 17 00:00:00 2001 From: =3D?UTF-8?q?G=3DC3=3DB6ran=3D20Weinholt?=3D Date: Tue, 20 Dec 2011 19:36:10 +0100 Subject: [PATCH] multiboot: mh_load_end_addr and mh_bss_end_addr may be zero MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit 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=C3=B6ran Weinholt Tested-by: Alexander Graf =2D-- 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 =2D-- a/hw/multiboot.c +++ b/hw/multiboot.c @@ -202,10 +202,23 @@ int load_multiboot(void *fw_cfg, uint32_t mh_bss_end_addr =3D ldl_p(header+i+24); mh_load_addr =3D ldl_p(header+i+16); uint32_t mb_kernel_text_offset =3D i - (mh_header_addr - mh_load_a= ddr); =2D uint32_t mb_load_size =3D 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 =3D kernel_file_size + mh_load_addr; + } + + /* A bss end address of zero indicates that there is no bss + * segment. */ + if (!mh_bss_end_addr) { + mh_bss_end_addr =3D mh_load_end_addr; + } =20 mh_entry_addr =3D ldl_p(header+i+28); mb_kernel_size =3D mh_bss_end_addr - mh_load_addr; + mb_load_size =3D mh_load_end_addr - mh_load_addr; =20 /* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_VBE. uint32_t mh_mode_type =3D ldl_p(header+i+32); =2D-=20 1.7.2.5 =2D-=20 G=C3=B6ran Weinholt --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAEBAgAGBQJO8NinAAoJEOM+YaLpuMOibe8P/3s07s71I3yZY9lHNtD2ik1k i7BzmF0LcwT/ceAP9/dyAz3hxBEefg7Cl5iqB58SZYWC/sP4hxmuTQnaIgUDkLjL XN0eSJwQxdNPjwoELl7z7EBO2qX1z0SwptcXBKqzw4q5XbRxpLoqKm1ClOq8S1gs RlhmGbI/wCXGW6OZh7FQ8gZgnRVYWasNJd8NqOwADJOyeSSZuMbLjh2o+5djBrc5 paTjP9VroeuaP1DBp9bPMYIt8lKV9uZ/ewu9T7ZqlpTqKDzV5Ucwxm9Dg6CY+jJv RPozcdDgBeN8FSG6DpT5JOloT8FA+MXr8QRQEDIzTT/FhJjAmoQmVghkGb9ZHv0G WsKyk1UPcNzB6Br8EV1m7tRE1soTS1FTZoN4vRm69oLRxy07ESHePD3+mKxpexDF iGEVUSZvncS8ZbL7tTTXsg5v9rnhyZWy/xktuHG40lv+fiT56FbXWMNK9hIEdlAJ 19qLL6miD9I0oNAcHsExsGSHQVN2SxCVnI4C6qWCSGvg9PwwN0ftNLllJMDkT/qc enHU+cNyRPlhGnNV2wUA1gXU0gmgX6qaeFEd1XSPhsBeFV4IxWDZyWFZ41ADYfWM WHX+PFVRSNdxHyyfFI5t4ACvUzDG57suyeYmQ2XAMGOc18lnNgAlxaptirAln28u hkFwHH7NRe9RpQ6SVcqd =+zFp -----END PGP SIGNATURE----- --=-=-=--