From 547e9201c52629eef71b0eb8cb48dacc50bcf759 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 22 Jul 2013 15:54:36 +0200 Subject: memory: pass MemoryRegion to access_with_adjusted_size The accessors all use a MemoryRegion opaque value. Avoid going uselessly through void*. Signed-off-by: Paolo Bonzini Reviewed-by: Anthony Liguori Message-id: 1374501278-31549-27-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori --- memory.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'memory.c') diff --git a/memory.c b/memory.c index 73fce9f40f..8bb61f2886 100644 --- a/memory.c +++ b/memory.c @@ -369,28 +369,26 @@ static void adjust_endianness(MemoryRegion *mr, uint64_t *data, unsigned size) } } -static void memory_region_oldmmio_read_accessor(void *opaque, +static void memory_region_oldmmio_read_accessor(MemoryRegion *mr, hwaddr addr, uint64_t *value, unsigned size, unsigned shift, uint64_t mask) { - MemoryRegion *mr = opaque; uint64_t tmp; tmp = mr->ops->old_mmio.read[ctz32(size)](mr->opaque, addr); *value |= (tmp & mask) << shift; } -static void memory_region_read_accessor(void *opaque, +static void memory_region_read_accessor(MemoryRegion *mr, hwaddr addr, uint64_t *value, unsigned size, unsigned shift, uint64_t mask) { - MemoryRegion *mr = opaque; uint64_t tmp; if (mr->flush_coalesced_mmio) { @@ -400,28 +398,26 @@ static void memory_region_read_accessor(void *opaque, *value |= (tmp & mask) << shift; } -static void memory_region_oldmmio_write_accessor(void *opaque, +static void memory_region_oldmmio_write_accessor(MemoryRegion *mr, hwaddr addr, uint64_t *value, unsigned size, unsigned shift, uint64_t mask) { - MemoryRegion *mr = opaque; uint64_t tmp; tmp = (*value >> shift) & mask; mr->ops->old_mmio.write[ctz32(size)](mr->opaque, addr, tmp); } -static void memory_region_write_accessor(void *opaque, +static void memory_region_write_accessor(MemoryRegion *mr, hwaddr addr, uint64_t *value, unsigned size, unsigned shift, uint64_t mask) { - MemoryRegion *mr = opaque; uint64_t tmp; if (mr->flush_coalesced_mmio) { @@ -436,13 +432,13 @@ static void access_with_adjusted_size(hwaddr addr, unsigned size, unsigned access_size_min, unsigned access_size_max, - void (*access)(void *opaque, + void (*access)(MemoryRegion *mr, hwaddr addr, uint64_t *value, unsigned size, unsigned shift, uint64_t mask), - void *opaque) + MemoryRegion *mr) { uint64_t access_mask; unsigned access_size; @@ -460,10 +456,10 @@ static void access_with_adjusted_size(hwaddr addr, access_mask = -1ULL >> (64 - access_size * 8); for (i = 0; i < size; i += access_size) { #ifdef TARGET_WORDS_BIGENDIAN - access(opaque, addr + i, value, access_size, + access(mr, addr + i, value, access_size, (size - access_size - i) * 8, access_mask); #else - access(opaque, addr + i, value, access_size, i * 8, access_mask); + access(mr, addr + i, value, access_size, i * 8, access_mask); #endif } } -- cgit v1.2.3