Obtain memory mapping after hooks are called

This commit is contained in:
mio
2022-08-14 12:42:34 +02:00
parent ffb047fe37
commit 8303328aa8

View File

@@ -1977,7 +1977,7 @@ store_helper(CPUArchState *env, target_ulong addr, uint64_t val,
size_t size = memop_size(op);
struct hook *hook;
bool handled;
MemoryRegion *mr = memory_mapping(uc, addr);
MemoryRegion *mr;
if (!uc->size_recur_mem) { // disabling write callback if in recursive call
// Unicorn: callback on memory write
@@ -1994,6 +1994,9 @@ store_helper(CPUArchState *env, target_ulong addr, uint64_t val,
}
}
// Load the latest memory mapping.
mr = memory_mapping(uc, addr);
// Unicorn: callback on invalid memory
if (mr == NULL) {
handled = false;