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.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id:
20210318174823.18066-4-peter.maydell@linaro.org
* @start: start address of the range within the FlatView
* @len: length of the range in bytes
* @mr: MemoryRegion covering this range
+ * @offset_in_region: offset of the first byte of the range within @mr
* @opaque: data pointer passed to flatview_for_each_range()
*
* Returns: true to stop the iteration, false to keep going.
typedef bool (*flatview_cb)(Int128 start,
Int128 len,
const MemoryRegion *mr,
+ hwaddr offset_in_region,
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;
+ }
}
}
};
static bool 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) {