diff --git a/qemu/softmmu/memory.c b/qemu/softmmu/memory.c index 96635a48..ccc93a49 100644 --- a/qemu/softmmu/memory.c +++ b/qemu/softmmu/memory.c @@ -82,6 +82,7 @@ typedef struct _mmio_cbs { void *user_data_read; uc_cb_mmio_write_t write; void *user_data_write; + MemoryRegionOps ops; } mmio_cbs; static uint64_t mmio_read_wrapper(struct uc_struct *uc, void *opaque, hwaddr addr, unsigned size) @@ -118,8 +119,8 @@ MemoryRegion *memory_map_io(struct uc_struct *uc, ram_addr_t begin, size_t size, void *user_data_read, void *user_data_write) { MemoryRegion *mmio = g_new(MemoryRegion, 1); - MemoryRegionOps *ops = g_new(MemoryRegionOps, 1); mmio_cbs* opaques = g_new(mmio_cbs, 1); + MemoryRegionOps *ops = &opaques->ops; opaques->read = read_cb; opaques->write = write_cb; opaques->user_data_read = user_data_read;