From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Iy9Sc-0004th-0h for qemu-devel@nongnu.org; Fri, 30 Nov 2007 12:15:30 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Iy9Sb-0004sU-D8 for qemu-devel@nongnu.org; Fri, 30 Nov 2007 12:15:29 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iy9Sb-0004sI-9M for qemu-devel@nongnu.org; Fri, 30 Nov 2007 12:15:29 -0500 Received: from mail.codesourcery.com ([65.74.133.4]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Iy9Sa-0001AM-TO for qemu-devel@nongnu.org; Fri, 30 Nov 2007 12:15:29 -0500 From: Paul Brook Subject: Re: [Qemu-devel] [PATCH] sh4: define explicitly that the target CPU is 32 bit Date: Fri, 30 Nov 2007 17:15:21 +0000 References: <20071130162329.GF28369@tapir> <200711301628.09857.paul@codesourcery.com> <20071130170002.GG28369@tapir> In-Reply-To: <20071130170002.GG28369@tapir> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200711301715.21956.paul@codesourcery.com> 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 On Friday 30 November 2007, Carlo Marcelo Arenas Belon wrote: > On Fri, Nov 30, 2007 at 04:28:09PM +0000, Paul Brook wrote: > > On Friday 30 November 2007, Carlo Marcelo Arenas Belon wrote: > > > The following patch enforces that the sh4 target is 32 bit to prevent > > > qemu to expand incorrectly to a 64 bit wide cpu if compiled in a 64 bit > > > host. > > > > This is wrong. As the comment in cpu-defs.h says, target_phys_addr_t may > > need to be bigger than the actual target address space. > > > > What exactly are you trying to fix? > > in a generic way, that the CPU width of the host (as defined by the size of > the type that is used to store a target_phys_addr_t) that is used to build > the emulator affects in any way the size of the emulated target physical > address size or its representation. > > in the sh4 specific case, it doesn't make sense for sh4 to print an access > error to a physical address that is 64 bit long when it is a 32 bit CPU and > that is what would happen unless the patch is applied. > > if anything the following definition from cpu-defs.h is invalid for a > representation of a 32 bit physical address : > > #define TARGET_FMT_plx "%016" PRIx64 Before you can fix that you probably need to fix the bits of qemu (TLB code) that store a host pointer in a phys_addr_t. Or at least distance TARGET_PHYS_ADDR_BITS from the definition of phys_addr_t, and include appropriate comments. In that case TARGET_PHYS_ADDR_BITS could be a precise value, rather than the next multiple of 32. e.g. I think sparc32 has a 40-bit physical address space. Paul