mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-27 03:51:57 -06:00
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>
This commit is contained in:
parent
10b7e74bf2
commit
eed2bacfd2
2 changed files with 17 additions and 1 deletions
10
memory.c
10
memory.c
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue