summaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-07-02 13:40:48 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2013-07-04 17:42:45 +0200
commit3ce10901ca8da9142dcdcde198fda1a4c290934c (patch)
tree1d2e886c106132afbdb9901db62062fbc525a5d7 /memory.c
parent46637be269aaaceb9867ffdf176e906401138fff (diff)
downloadqemu-3ce10901ca8da9142dcdcde198fda1a4c290934c.tar.gz
qemu-3ce10901ca8da9142dcdcde198fda1a4c290934c.tar.bz2
qemu-3ce10901ca8da9142dcdcde198fda1a4c290934c.zip
memory: introduce memory_region_present
This new API will avoid having too many memory_region_ref/unref in paths that currently use memory_region_find. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/memory.c b/memory.c
index e04d5196b0..24027c5077 100644
--- a/memory.c
+++ b/memory.c
@@ -1478,6 +1478,15 @@ static FlatRange *address_space_lookup(AddressSpace *as, AddrRange addr)
sizeof(FlatRange), cmp_flatrange_addr);
}
+bool memory_region_present(MemoryRegion *parent, hwaddr addr)
+{
+ MemoryRegion *mr = memory_region_find(parent, addr, 1).mr;
+ if (!mr) {
+ return false;
+ }
+ return true;
+}
+
MemoryRegionSection memory_region_find(MemoryRegion *mr,
hwaddr addr, uint64_t size)
{