mirror of
https://github.com/mii443/qemu.git
synced 2025-12-16 17:18:49 +00:00
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>
This commit is contained in:
9
memory.c
9
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user