For that I would need to find all the addresses in an AddressSpace
that alias vecbase, so that we can call rom_ptr() on all of them.
I think something like this would work:
hwaddr xlat, len;
RCU_READ_LOCK_GUARD();
FlatView *fv = address_space_to_flatview(s->as);
MemoryRegion *main_mr = flatview_translate(fv, vecbase, &xlat, &len,
false, MEMTXATTRS_UNSPECIFIED);
flatview_for_each_range(fv, callback_fn, ...);
where callback_fn() does:
if (mr != main_mr) {
return;
}
do arithmetic with flatview range start and len, etc to figure
out the overall address in the AS corresponding to vecbase
rom = rom_ptr(that_addr);
...
Does this seem like it would work ? Is there a nicer way ?