exec: just use io_mem_read/io_mem_write for 8-byte I/O accesses
The memory API is able to split it in two 4-byte accesses. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
968a5627c8
commit
a649b9168c
8
exec.c
8
exec.c
@ -2263,13 +2263,7 @@ static inline uint64_t ldq_phys_internal(hwaddr addr,
|
|||||||
false);
|
false);
|
||||||
if (l < 8 || !memory_access_is_direct(section->mr, false)) {
|
if (l < 8 || !memory_access_is_direct(section->mr, false)) {
|
||||||
/* I/O case */
|
/* I/O case */
|
||||||
#ifdef TARGET_WORDS_BIGENDIAN
|
val = io_mem_read(section->mr, addr1, 8);
|
||||||
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
|
|
||||||
#if defined(TARGET_WORDS_BIGENDIAN)
|
#if defined(TARGET_WORDS_BIGENDIAN)
|
||||||
if (endian == DEVICE_LITTLE_ENDIAN) {
|
if (endian == DEVICE_LITTLE_ENDIAN) {
|
||||||
val = bswap64(val);
|
val = bswap64(val);
|
||||||
|
@ -63,7 +63,6 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(CPUArchState *env,
|
|||||||
target_ulong addr,
|
target_ulong addr,
|
||||||
uintptr_t retaddr)
|
uintptr_t retaddr)
|
||||||
{
|
{
|
||||||
DATA_TYPE res;
|
|
||||||
MemoryRegion *mr = iotlb_to_region(physaddr);
|
MemoryRegion *mr = iotlb_to_region(physaddr);
|
||||||
|
|
||||||
physaddr = (physaddr & TARGET_PAGE_MASK) + addr;
|
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;
|
env->mem_io_vaddr = addr;
|
||||||
#if SHIFT <= 2
|
return io_mem_read(mr, physaddr, 1 << SHIFT);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* handle all cases except unaligned access which span two pages */
|
/* 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_vaddr = addr;
|
||||||
env->mem_io_pc = retaddr;
|
env->mem_io_pc = retaddr;
|
||||||
#if SHIFT <= 2
|
|
||||||
io_mem_write(mr, physaddr, val, 1 << SHIFT);
|
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,
|
void glue(glue(helper_st, SUFFIX), MMUSUFFIX)(CPUArchState *env,
|
||||||
|
Loading…
Reference in New Issue
Block a user