diff --git a/qemu/exec.c b/qemu/exec.c index 5c9418d3..81bf58a9 100644 --- a/qemu/exec.c +++ b/qemu/exec.c @@ -2861,12 +2861,22 @@ bool cpu_physical_memory_is_io(AddressSpace *as, hwaddr phys_addr) memory_region_is_romd(mr)); } -void qemu_ram_foreach_block(struct uc_struct *uc, RAMBlockIterFunc func, void *opaque) +int qemu_ram_foreach_block(struct uc_struct *uc, RAMBlockIterFunc func, void *opaque) { RAMBlock *block; + int ret = 0; + // Unicorn: commented out + //rcu_read_lock(); QLIST_FOREACH(block, &uc->ram_list.blocks, next) { - func(block->host, block->offset, block->used_length, opaque); + ret = func(block->idstr, block->host, block->offset, + block->used_length, opaque); + if (ret) { + break; + } } + // Unicorn: commented out + //rcu_read_unlock(); + return ret; } #endif diff --git a/qemu/include/exec/cpu-common.h b/qemu/include/exec/cpu-common.h index 4a066246..6ba425db 100644 --- a/qemu/include/exec/cpu-common.h +++ b/qemu/include/exec/cpu-common.h @@ -116,10 +116,10 @@ void cpu_flush_icache_range(AddressSpace *as, hwaddr start, int len); extern struct MemoryRegion io_mem_rom; extern struct MemoryRegion io_mem_notdirty; -typedef void (RAMBlockIterFunc)(void *host_addr, +typedef int (RAMBlockIterFunc)(const char *block_name, void *host_addr, ram_addr_t offset, ram_addr_t length, void *opaque); -void qemu_ram_foreach_block(struct uc_struct *uc, RAMBlockIterFunc func, void *opaque); +int qemu_ram_foreach_block(struct uc_struct *uc, RAMBlockIterFunc func, void *opaque); #endif