diff options
author | Alexander Bulekov <alxndr@bu.edu> | 2020-10-23 11:07:30 -0400 |
---|---|---|
committer | Thomas Huth <thuth@redhat.com> | 2020-10-24 07:43:48 +0200 |
commit | fb5ef4eeecd88b583d5a6dc8f7dc217179cbfc98 (patch) | |
tree | 015e22472b9e1a7141dd6c72c6e58116180aead1 /softmmu/memory.c | |
parent | d232b87ec6e3a8a04db9b647f61a1e3a6855a58f (diff) |
memory: Add FlatView foreach function
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Message-Id: <20201023150746.107063-2-alxndr@bu.edu>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'softmmu/memory.c')
-rw-r--r-- | softmmu/memory.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/softmmu/memory.c b/softmmu/memory.c index 403ff3abc9..a5d1641820 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -656,6 +656,19 @@ static void render_memory_region(FlatView *view, } } +void flatview_for_each_range(FlatView *fv, flatview_cb cb , void *opaque) +{ + FlatRange *fr; + + assert(fv); + assert(cb); + + FOR_EACH_FLAT_RANGE(fr, fv) { + if (cb(fr->addr.start, fr->addr.size, fr->mr, opaque)) + break; + } +} + static MemoryRegion *memory_region_get_flatview_root(MemoryRegion *mr) { while (mr->enabled) { |