From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LBJ7W-0006mI-03 for qemu-devel@nongnu.org; Fri, 12 Dec 2008 20:16:38 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LBJ7T-0006lu-BC for qemu-devel@nongnu.org; Fri, 12 Dec 2008 20:16:37 -0500 Received: from [199.232.76.173] (port=47393 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LBJ7T-0006lr-6V for qemu-devel@nongnu.org; Fri, 12 Dec 2008 20:16:35 -0500 Received: from mtaout01-winn.ispmail.ntl.com ([81.103.221.47]:34929) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LBJ7O-0002vY-2E for qemu-devel@nongnu.org; Fri, 12 Dec 2008 20:16:34 -0500 Date: Sat, 13 Dec 2008 01:18:03 +0000 From: Stuart Brady Subject: Re: [Qemu-devel] [5949] target-ppc: memory load/store rework Message-ID: <20081213011803.GC9457@miranda.arrow> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Cc: Aurelien Jarno On Mon, Dec 08, 2008 at 06:11:22PM +0000, Aurelien Jarno wrote: > - Don't swap values twice for bit-reverse load/store functions > in little endian mode. If I've read this correctly, it seems to me that we would still swap twice on little endian hosts when when emulating little endian mode or performing bit-reverse loads/stores. Bit-reverse loads/stores under little endian emulation on a little endian host would have actually resulted in *three* byteswaps! I'm not sure what the performance impact of this would be, but it's something that I've been wondering about while working on PA-RISC emulation, which will also need to provide a little endian mode. BTW, I'm wondering if it would be possible to optimise loads/stores with a different endianness to the host on targets that require word aligned addresses. Instead of swapping bytes when loading/storing words, addresses would be modified when loading/storing bytes. For 32-bit targets, what I'm suggesting is something similar to this (although I'm not saying that the casting is a good idea!) :- extern uint8_t memory[]; uint32_t ldul(target_ulong addr) { return *(uint32_t)&memory[addr]; } uint32_t lduw(target_ulong addr) { return *(uint16_t)&memory[addr ^ 2]; } uint32_t ldub(target_ulong addr) { return memory[addr ^ 3]; } (It looks as though MIPS Magnum emulation might require something like this for emulation of its big endian mode, anyway...) Cheers, -- Stuart Brady