On 23 April 2013 22:02, Paolo Bonzini <[email protected]> wrote:
> Il 23/04/2013 20:00, Peter Maydell ha scritto:
>> NB: I don't think we should call it memory_region_get_address()
>> though -- that implies a non-existent parallel to the current
>> memory_region_set_address().
>
> Hmm, good point. address_space_get_region_addr()?
Maybe we should make this parallel-ish to memory_region_find()
(which finds an MR within an AS by addr/size)?
Actually, I think I'd favour cleaning up some of the existing
API which has parameters named "address_space" which are
MemoryRegion*s. I think these probably predate the AddressSpace
type and should be updated to use it (and be renamed to fit too).
So how about:
MemoryRegionSection memory_region_find(MemoryRegion *address_space,
hwaddr addr, uint64_t size);
becomes
MemoryRegionSection address_space_find_region_by_addr(
AddressSpace *address_space,
hwaddr addr, uint64_t size);
(bit of a mouthful, but never mind)
void memory_global_sync_dirty_bitmap(MemoryRegion *address_space);
becomes
void address_space_sync_dirty_bitmap(AddressSpace *address_space);
(in both cases the first thing the implementation does is call
memory_region_to_address_space() to get the AddressSpace* anyway.)
and our new function is
MemoryRegionSection address_space_find_region(AddressSpace *as,
MemoryRegion *mr);
?
(we don't have to do the tidyup first, but the new function
signature makes more sense viewed in the light of the others)
thanks
-- PMM