Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LXGts-0004F2-A7 for qemu-devel@nongnu.org; Wed, 11 Feb 2009 10:21:20 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LXGtr-0004EH-KH for qemu-devel@nongnu.org; Wed, 11 Feb 2009 10:21:19 -0500 Received: from [199.232.76.173] (port=52357 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LXGtr-0004Dz-86 for qemu-devel@nongnu.org; Wed, 11 Feb 2009 10:21:19 -0500 Received: from savannah.gnu.org ([199.232.41.3]:40305 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LXGtq-0002Fx-RG for qemu-devel@nongnu.org; Wed, 11 Feb 2009 10:21:18 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LXGtp-0004sZ-Sg for qemu-devel@nongnu.org; Wed, 11 Feb 2009 15:21:18 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LXGto-0004sS-Vd for qemu-devel@nongnu.org; Wed, 11 Feb 2009 15:21:17 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Wed, 11 Feb 2009 15:21:17 +0000 Subject: [Qemu-devel] [6604] qemu: warn if PCI region is not power of two (Marcelo Tosatti) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6604 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6604 Author: aliguori Date: 2009-02-11 15:21:16 +0000 (Wed, 11 Feb 2009) Log Message: ----------- qemu: warn if PCI region is not power of two (Marcelo Tosatti) Otherwise the PCI size for such regions can be calculated erroneously. Signed-off-by: Marcelo Tosatti Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/hw/pci.c Modified: trunk/hw/pci.c =================================================================== --- trunk/hw/pci.c 2009-02-11 15:21:10 UTC (rev 6603) +++ trunk/hw/pci.c 2009-02-11 15:21:16 UTC (rev 6604) @@ -247,6 +247,13 @@ if ((unsigned int)region_num >= PCI_NUM_REGIONS) return; + + if (size & (size-1)) { + fprintf(stderr, "ERROR: PCI region size must be pow2 " + "type=0x%x, size=0x%x\n", type, size); + exit(1); + } + r = &pci_dev->io_regions[region_num]; r->addr = -1; r->size = size;