From aa0ce52b9760016ffa25910633a3d6b00b779358 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 18 Feb 2018 19:26:35 -0500 Subject: [PATCH] exec: Add missing atomic reads --- qemu/exec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qemu/exec.c b/qemu/exec.c index 387f04e2..8a0ad7ee 100644 --- a/qemu/exec.c +++ b/qemu/exec.c @@ -1630,7 +1630,8 @@ MemoryRegion *iotlb_to_region(CPUState *cpu, hwaddr index, MemTxAttrs attrs) { int asidx = cpu_asidx_from_attrs(cpu, attrs); CPUAddressSpace *cpuas = &cpu->cpu_ases[asidx]; - AddressSpaceDispatch *d = cpuas->memory_dispatch; + // Unicorn: uses atomic_read instead of atomic_rcu_read + AddressSpaceDispatch *d = atomic_read(&cpuas->memory_dispatch); MemoryRegionSection *sections = d->map.sections; return sections[index & ~TARGET_PAGE_MASK].mr; @@ -1693,7 +1694,8 @@ static void tcg_commit(MemoryListener *listener) * We reload the dispatch pointer now because cpu_reloading_memory_map() * may have split the RCU critical section. */ - d = cpuas->as->dispatch; + // Unicorn: uses atomic_read instead of atomic_rcu_read + d = atomic_read(&cpuas->as->dispatch); cpuas->memory_dispatch = d; tlb_flush(cpuas->cpu, 1); }