The function flatview_for_each_range() calls a callback for each range in a FlatView. Currently the callback gets the start and length of the range and the MemoryRegion involved, but not the offset within the MemoryRegion. Add this to the callback's arguments; we're going to want it for a new use in the next commit.
While we're editing the flatview_cb typedef, add names for the arguments that were missing names. Signed-off-by: Peter Maydell <peter.mayd...@linaro.org> --- include/exec/memory.h | 4 +++- softmmu/memory.c | 3 ++- tests/qtest/fuzz/generic_fuzz.c | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 54ccf1a5f09..0c3ddf2bb9a 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -778,7 +778,9 @@ static inline FlatView *address_space_to_flatview(AddressSpace *as) typedef int (*flatview_cb)(Int128 start, Int128 len, - const MemoryRegion*, void*); + const MemoryRegion *mr, + hwaddr offset_in_region, + void *opaque); void flatview_for_each_range(FlatView *fv, flatview_cb cb , void *opaque); diff --git a/softmmu/memory.c b/softmmu/memory.c index 9db47b7db6b..3cc78862c79 100644 --- a/softmmu/memory.c +++ b/softmmu/memory.c @@ -671,7 +671,8 @@ void flatview_for_each_range(FlatView *fv, flatview_cb cb , void *opaque) assert(cb); FOR_EACH_FLAT_RANGE(fr, fv) { - if (cb(fr->addr.start, fr->addr.size, fr->mr, opaque)) + if (cb(fr->addr.start, fr->addr.size, fr->mr, + fr->offset_in_region, opaque)) break; } } diff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuzz.c index ee8c17a04c4..c10a19316f5 100644 --- a/tests/qtest/fuzz/generic_fuzz.c +++ b/tests/qtest/fuzz/generic_fuzz.c @@ -96,7 +96,9 @@ struct get_io_cb_info { }; static int get_io_address_cb(Int128 start, Int128 size, - const MemoryRegion *mr, void *opaque) { + const MemoryRegion *mr, + hwaddr offset_in_region, + void *opaque) { struct get_io_cb_info *info = opaque; if (g_hash_table_lookup(fuzzable_memoryregions, mr)) { if (info->index == 0) { -- 2.20.1