On 10/09/2012 06:45 PM, Bhushan Bharat-R65777 wrote:
>
> What about adding a API:
> void sysbus_mmio_map_to_mr(SysBusDevice *dev, int n, target_phys_addr_t addr,
> MemoryRegion *mr)
> {
> assert(n >= 0 && n < dev->num_mmio);
>
> if (dev->mmio[n].addr == addr) {
> /* ??? region already mapped here. */
> return;
> }
> if (dev->mmio[n].addr != (target_phys_addr_t)-1) {
> /* Unregister previous mapping. */
> memory_region_del_subregion(mr, dev->mmio[n].memory);
> }
> dev->mmio[n].addr = addr;
> memory_region_add_subregion(mr, addr, dev->mmio[n].memory);
> }
>
I think you can just use sysbus_mmio_get_region(). There are plenty of
other users, so there's precedent.
--
error compiling committee.c: too many arguments to function