Received: from eggs.gnu.org ([2001:4830:134:3::10]:36671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiA1g-00047E-DS for qemu-devel@nongnu.org; Thu, 30 May 2013 17:04:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UiA1b-0001l2-Oc for qemu-devel@nongnu.org; Thu, 30 May 2013 17:04:48 -0400 Received: from mail-ea0-x229.google.com ([2a00:1450:4013:c01::229]:56461) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiA1b-0001kx-Ir for qemu-devel@nongnu.org; Thu, 30 May 2013 17:04:43 -0400 Received: by mail-ea0-f169.google.com with SMTP id m14so869854eaj.28 for ; Thu, 30 May 2013 14:04:43 -0700 (PDT) Received: from playground.lan (net-37-116-217-184.cust.dsl.vodafone.it. [37.116.217.184]) by mx.google.com with ESMTPSA id y2sm62707218eeu.2.2013.05.30.14.04.41 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 30 May 2013 14:04:42 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 30 May 2013 23:03:54 +0200 Message-Id: <1369947836-2638-21-git-send-email-pbonzini@redhat.com> In-Reply-To: <1369947836-2638-1-git-send-email-pbonzini@redhat.com> References: <1369947836-2638-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 20/22] exec: just use io_mem_read/io_mem_write for 8-byte I/O accesses List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org The memory API is able to split it in two 4-byte accesses. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- exec.c | 8 +------- include/exec/softmmu_template.h | 24 +----------------------- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/exec.c b/exec.c index 453946e..878f021 100644 --- a/exec.c +++ b/exec.c @@ -2263,13 +2263,7 @@ static inline uint64_t ldq_phys_internal(hwaddr addr, false); if (l < 8 || !memory_access_is_direct(section->mr, false)) { /* I/O case */ -#ifdef TARGET_WORDS_BIGENDIAN - val = io_mem_read(section->mr, addr1, 4) << 32; - val |= io_mem_read(section->mr, addr1 + 4, 4); -#else - val = io_mem_read(section->mr, addr1, 4); - val |= io_mem_read(section->mr, addr1 + 4, 4) << 32; -#endif + val = io_mem_read(section->mr, addr1, 8); #if defined(TARGET_WORDS_BIGENDIAN) if (endian == DEVICE_LITTLE_ENDIAN) { val = bswap64(val); diff --git a/include/exec/softmmu_template.h b/include/exec/softmmu_template.h index ca91fd0..292ca02 100644 --- a/include/exec/softmmu_template.h +++ b/include/exec/softmmu_template.h @@ -63,7 +63,6 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(CPUArchState *env, target_ulong addr, uintptr_t retaddr) { - DATA_TYPE res; MemoryRegion *mr = iotlb_to_region(physaddr); physaddr = (physaddr & TARGET_PAGE_MASK) + addr; @@ -73,18 +72,7 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(CPUArchState *env, } env->mem_io_vaddr = addr; -#if SHIFT <= 2 - res = io_mem_read(mr, physaddr, 1 << SHIFT); -#else -#ifdef TARGET_WORDS_BIGENDIAN - res = io_mem_read(mr, physaddr, 4) << 32; - res |= io_mem_read(mr, physaddr + 4, 4); -#else - res = io_mem_read(mr, physaddr, 4); - res |= io_mem_read(mr, physaddr + 4, 4) << 32; -#endif -#endif /* SHIFT > 2 */ - return res; + return io_mem_read(mr, physaddr, 1 << SHIFT); } /* handle all cases except unaligned access which span two pages */ @@ -221,17 +209,7 @@ static inline void glue(io_write, SUFFIX)(CPUArchState *env, env->mem_io_vaddr = addr; env->mem_io_pc = retaddr; -#if SHIFT <= 2 io_mem_write(mr, physaddr, val, 1 << SHIFT); -#else -#ifdef TARGET_WORDS_BIGENDIAN - io_mem_write(mr, physaddr, (val >> 32), 4); - io_mem_write(mr, physaddr + 4, (uint32_t)val, 4); -#else - io_mem_write(mr, physaddr, (uint32_t)val, 4); - io_mem_write(mr, physaddr + 4, val >> 32, 4); -#endif -#endif /* SHIFT > 2 */ } void glue(glue(helper_st, SUFFIX), MMUSUFFIX)(CPUArchState *env, -- 1.7.4.1