From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kjvdf-0004vu-Kj for qemu-devel@nongnu.org; Sun, 28 Sep 2008 08:44:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kjvdd-0004td-8m for qemu-devel@nongnu.org; Sun, 28 Sep 2008 08:44:39 -0400 Received: from [199.232.76.173] (port=42235 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kjvdd-0004tT-3e for qemu-devel@nongnu.org; Sun, 28 Sep 2008 08:44:37 -0400 Received: from fg-out-1718.google.com ([72.14.220.157]:8508) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kjvdc-0001mY-58 for qemu-devel@nongnu.org; Sun, 28 Sep 2008 08:44:36 -0400 Received: by fg-out-1718.google.com with SMTP id l26so2131402fgb.8 for ; Sun, 28 Sep 2008 05:44:31 -0700 (PDT) Date: Sun, 28 Sep 2008 14:44:29 +0200 From: Jindrich Makovicka Message-ID: <20080928144429.5781982d@holly> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] constant truncation warning in hw/pc.c for 32bit targets 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 Hi, for 32bit targets, the 0x100000000ULL start address of above-4G memory is truncated to zero. IMO the code for above-4G allocation could be #ifdef'ed only for 64 bit targets, as for 32bit it 1) miscompiles and 2) won't be used anyway: Index: hw/pc.c =================================================================== --- hw/pc.c (revision 5338) +++ hw/pc.c (working copy) @@ -747,7 +747,9 @@ BlockDriverState *fd[MAX_FD]; if (ram_size >= 0xe0000000 ) { +#if TARGET_PHYS_ADDR_BITS == 64 above_4g_mem_size = ram_size - 0xe0000000; +#endif below_4g_mem_size = 0xe0000000; } else { below_4g_mem_size = ram_size; @@ -798,6 +800,7 @@ below_4g_mem_size - 0x100000, ram_addr); +#if TARGET_PHYS_ADDR_BITS == 64 /* above 4giga memory allocation */ if (above_4g_mem_size > 0) { ram_addr = qemu_ram_alloc(above_4g_mem_size); @@ -805,6 +808,7 @@ above_4g_mem_size, ram_addr); } +#endif /* allocate VGA RAM */ Regards, -- Jindrich Makovicka