which allows to check if MemoryRegion is already mapped.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
*/
bool memory_region_present(MemoryRegion *container, hwaddr addr);
+/**
+ * memory_region_is_mapped: returns true if #MemoryRegion is mapped
+ * into any address space.
+ *
+ * @mr: a #MemoryRegion which should be checked if it's mapped
+ */
+bool memory_region_is_mapped(MemoryRegion *mr);
+
/**
* memory_region_find: translate an address/size relative to a
* MemoryRegion into a #MemoryRegionSection.
return as;
}
}
- abort();
+ return NULL;
}
/* Render a memory region into the global view. Ranges in @view obscure
return true;
}
+bool memory_region_is_mapped(MemoryRegion *mr)
+{
+ return mr->container ? true : false;
+}
+
MemoryRegionSection memory_region_find(MemoryRegion *mr,
hwaddr addr, uint64_t size)
{
}
as = memory_region_to_address_space(root);
+ if (!as) {
+ return ret;
+ }
range = addrrange_make(int128_make64(addr), int128_make64(size));
view = address_space_get_flatview(as);