From patchwork Sat Dec 19 20:15:20 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 41471 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5F6E3B6F18 for ; Sun, 20 Dec 2009 07:16:11 +1100 (EST) Received: from localhost ([127.0.0.1]:51356 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NM5ii-0004wD-4q for incoming@patchwork.ozlabs.org; Sat, 19 Dec 2009 15:16:08 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NM5iF-0004vi-II for qemu-devel@nongnu.org; Sat, 19 Dec 2009 15:15:39 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NM5iB-0004tw-Vx for qemu-devel@nongnu.org; Sat, 19 Dec 2009 15:15:39 -0500 Received: from [199.232.76.173] (port=51676 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NM5iB-0004tt-RE for qemu-devel@nongnu.org; Sat, 19 Dec 2009 15:15:35 -0500 Received: from mo-p00-ob.rzone.de ([81.169.146.161]:52859) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1NM5iB-00054z-Fo for qemu-devel@nongnu.org; Sat, 19 Dec 2009 15:15:35 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1261253733; l=1139; s=domk; d=kevin-wolf.de; h=Date:Subject:Cc:To:From:X-RZG-CLASS-ID:X-RZG-AUTH; bh=4R3PVzI1Lm+f3YH/zarKOyT2Vas=; b=EahgD6cRGwSJak/dBXOIZOc/3mAWzCYdjWvc6JzLRlX13su1qvGO5y55RQJkBWJMbty PCwkhYTMLrAxewsLkWLy/hxmFzKVd0fcnYffuDonzWC2jKot5yP2zCVWQAPusha8ggHBd A5JCoSU99rWbX9+9pmYcancwDJdzbF9iNgA= X-RZG-AUTH: :IW0NeWCjfulXIi4BrEKXhgYy2jE0QmIac4DjsXgwMU4hzYpVkmoCeg3Do0qpUw== X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain (p54A106CF.dip0.t-ipconnect.de [84.161.6.207]) by post.strato.de (fruni mo56) (RZmta 22.5) with ESMTP id 5029a9lBJIcXzQ ; Sat, 19 Dec 2009 21:15:25 +0100 (MET) From: Kevin Wolf To: qemu-devel@nongnu.org Date: Sat, 19 Dec 2009 21:15:20 +0100 Message-Id: <1261253720-6790-1-git-send-email-mail@kevin-wolf.de> X-Mailer: git-send-email 1.6.0.2 X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) Cc: Kevin Wolf , aurelien@aurel32.net Subject: [Qemu-devel] [FOR 0.12][PATCH] Multiboot support: Fix rom_copy X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org ROMs need to be loaded if they are anywhere in the requested area, not only at the very beginning. This fixes Multiboot with ELF kernels that have more than one program header. Signed-off-by: Kevin Wolf --- hw/loader.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hw/loader.c b/hw/loader.c index c7d43f6..2ceb8eb 100644 --- a/hw/loader.c +++ b/hw/loader.c @@ -698,6 +698,11 @@ static Rom *find_rom(target_phys_addr_t addr) return NULL; } +/* + * Copies memory from registered ROMs to dest. Any memory that is contained in + * a ROM between addr and addr + size is copied. Note that this can involve + * multiple ROMs, which need not start at addr and need not end at addr + size. + */ int rom_copy(uint8_t *dest, target_phys_addr_t addr, size_t size) { target_phys_addr_t end = addr + size; @@ -706,8 +711,6 @@ int rom_copy(uint8_t *dest, target_phys_addr_t addr, size_t size) Rom *rom; QTAILQ_FOREACH(rom, &roms, next) { - if (rom->addr > addr) - continue; if (rom->addr + rom->romsize < addr) continue; if (rom->addr > end)