From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mm2bE-0002pR-8I for qemu-devel@nongnu.org; Fri, 11 Sep 2009 05:39:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mm2b9-0002om-4W for qemu-devel@nongnu.org; Fri, 11 Sep 2009 05:39:23 -0400 Received: from [199.232.76.173] (port=46849 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mm2b8-0002oV-RO for qemu-devel@nongnu.org; Fri, 11 Sep 2009 05:39:18 -0400 Received: from mail.gmx.net ([213.165.64.20]:34717) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1Mm2b8-0004BS-9P for qemu-devel@nongnu.org; Fri, 11 Sep 2009 05:39:18 -0400 Content-Type: text/plain; charset="iso-8859-1" Date: Fri, 11 Sep 2009 11:39:13 +0200 From: "Johannes Luber" Message-ID: <20090911093913.324670@gmx.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] target_phys_addr_t definition List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Hi, I've been looking through the sources and stumbled over targphys.h, which contains: /* target_phys_addr_t is the type of a physical address (its size can be different from 'target_ulong'). We have sizeof(target_phys_addr) = max(sizeof(unsigned long), sizeof(size_of_target_physical_address)) because we must pass a host pointer to memory operations in some cases */ #if TARGET_PHYS_ADDR_BITS == 32 typedef uint32_t target_phys_addr_t; #define TARGET_PHYS_ADDR_MAX UINT32_MAX #define TARGET_FMT_plx "%08x" #elif TARGET_PHYS_ADDR_BITS == 64 typedef uint64_t target_phys_addr_t; #define TARGET_PHYS_ADDR_MAX UINT64_MAX #define TARGET_FMT_plx "%016" PRIx64 #endif The comment says "sizeof(target_phys_addr) = max(...)" yet I don't the actual definition depending on the host at all. This means that on 64 bit hosts things are going wrong. sizeof(uint32_t) will be always 4 and actually using sizeof(unsigned long) will still result on 64-bit Windows in 4, despite pointer having 8 bytes. As the comment remarks this won't work with physical pointers which reference pages beyond the 4 GB limit (unless the pointers don't have always some high bits set). So my question is: Does Qemu support 64-bit compilation for hosts correctly? Best regards, Johannes -- Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02