From patchwork Tue Apr 5 11:41:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 89832 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 3504BB6EE9 for ; Tue, 5 Apr 2011 21:42:29 +1000 (EST) Received: from localhost ([127.0.0.1]:57209 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q74eP-0002r7-QL for incoming@patchwork.ozlabs.org; Tue, 05 Apr 2011 07:42:25 -0400 Received: from [140.186.70.92] (port=44822 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q74db-0002qz-Mk for qemu-devel@nongnu.org; Tue, 05 Apr 2011 07:41:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q74da-0003e7-JG for qemu-devel@nongnu.org; Tue, 05 Apr 2011 07:41:35 -0400 Received: from mail-fx0-f45.google.com ([209.85.161.45]:53698) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q74da-0003du-Ek for qemu-devel@nongnu.org; Tue, 05 Apr 2011 07:41:34 -0400 Received: by fxm2 with SMTP id 2so238360fxm.4 for ; Tue, 05 Apr 2011 04:41:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=VlxnByQXIriYGSZ09X2OGIf+uqd65+/xL5+knNteGf4=; b=VfenSWz8DlDRYyiVqR18TzccdA155kpzd9BWl4qU0reFG2PFtQlYJOabw8+LG/zIsH aE+0pwfwFmNmpWeDaLyTrJHgj8T7B/iiSChd3PqrxfdRHNISNmQPaVwibA6WOWTn4jGK nMWlFW4WVcxEwACJpaaJI7OQq2Xv4f28W+bmI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=IWqLKHn/65LIXNkvRCZeYenL+vUTWUUWa23I//M8GFTJ+nf8A52hoUVsoPqUoZO4D1 6BKMS/opj+OodPnTEjLLmgbheFURI9vpY/byxAglWky3IfUoBwABA4EmPWwe7io2VLId gunW5tHgxS012MjXqisZTY0i3csmR80r4o5e0= Received: by 10.223.75.1 with SMTP id w1mr198991faj.17.1302003693046; Tue, 05 Apr 2011 04:41:33 -0700 (PDT) Received: from localhost (proxy.se.axis.com [195.60.68.148]) by mx.google.com with ESMTPS id y9sm90295faj.0.2011.04.05.04.41.31 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 05 Apr 2011 04:41:32 -0700 (PDT) Date: Tue, 5 Apr 2011 13:41:29 +0200 From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Message-ID: <20110405114129.GA23638@edde.se.axis.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.45 Subject: [Qemu-devel] [PATCH] exec: Handle registrations of the entire address space 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 Hi, While experimenting with some odd stuff I ran into trouble when registering the entire address space. The following patch fixes the problem for me. Cheers commit f9a9a0d305ff774efd289ab88be427d1da05edfb Author: Edgar E. Iglesias Date: Tue Apr 5 13:00:36 2011 +0200 exec: Handle registrations of the entire address space Signed-off-by: Edgar E. Iglesias diff --git a/exec.c b/exec.c index 964ce31..983c0db 100644 --- a/exec.c +++ b/exec.c @@ -2611,6 +2611,7 @@ void cpu_register_physical_memory_offset(target_phys_addr_t start_addr, ram_addr_t orig_size = size; subpage_t *subpage; + assert(size); cpu_notify_set_memory(start_addr, size, phys_offset); if (phys_offset == IO_MEM_UNASSIGNED) { @@ -2619,7 +2620,9 @@ void cpu_register_physical_memory_offset(target_phys_addr_t start_addr, region_offset &= TARGET_PAGE_MASK; size = (size + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK; end_addr = start_addr + (target_phys_addr_t)size; - for(addr = start_addr; addr != end_addr; addr += TARGET_PAGE_SIZE) { + + addr = start_addr; + do { p = phys_page_find(addr >> TARGET_PAGE_BITS); if (p && p->phys_offset != IO_MEM_UNASSIGNED) { ram_addr_t orig_memory = p->phys_offset; @@ -2671,7 +2674,8 @@ void cpu_register_physical_memory_offset(target_phys_addr_t start_addr, } } region_offset += TARGET_PAGE_SIZE; - } + addr += TARGET_PAGE_SIZE; + } while (addr != end_addr); /* since each CPU stores ram addresses in its TLB cache, we must reset the modified entries */