diff options
author | Igor Mammedov <imammedo@redhat.com> | 2014-06-02 15:25:06 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2014-06-19 16:41:47 +0300 |
commit | eed2bacfd2519e45498b585a147f11b0fd01c3c7 (patch) | |
tree | 8a78b44110e28a0ffc650258486fc4a990893609 /memory.c | |
parent | 10b7e74bf2de8587a8f9e15f216b87be43d6a7cf (diff) |
memory: add memory_region_is_mapped() API
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>
Diffstat (limited to 'memory.c')
-rw-r--r-- | memory.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -493,7 +493,7 @@ static AddressSpace *memory_region_to_address_space(MemoryRegion *mr) return as; } } - abort(); + return NULL; } /* Render a memory region into the global view. Ranges in @view obscure @@ -1593,6 +1593,11 @@ bool memory_region_present(MemoryRegion *container, hwaddr addr) 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) { @@ -1610,6 +1615,9 @@ MemoryRegionSection memory_region_find(MemoryRegion *mr, } 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); |