-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Il 26/05/2013 11:12, Jan Kiszka ha scritto: > On 2013-05-26 11:01, Paolo Bonzini wrote: >> Il 25/05/2013 13:30, Jan Kiszka ha scritto: >>> On 2013-05-25 13:20, Paolo Bonzini wrote: >>>> Il 25/05/2013 12:19, Jan Kiszka ha scritto: >>>>> addr -= section->offset_within_address_space; - len >>>>> = MIN(section->size - addr, len); >>>> ^^^^^^^^^^^^^ ^^^^ >>>> >>>> This is the size of a section minus an offset in the >>>> section. >>>> >>>>> + diff = int128_sub(section->mr->size, >>>>> int128_make64(addr)); >>>> ^^^^^^^^^^^^^^^^^ ^^^^ >>>> >>>> This is the size of a region minus the same offset in the >>>> section. >>>> >>>>> + len = MIN(int128_get64(diff), len); >>>>> >>>>> /* Compute offset within MemoryRegion */ addr += >>>>> section->offset_within_region; >>>> >>>> So this has to be moved above. >> >>> Right, fixed. >> >>>> Do you have a branch pushed somewhere that I can test >>>> against? >> >>> git://git.kiszka.org/qemu.git queues/ioport >> >> And another thing... in "ioport: Switch dispatching to memory >> core layer", could you put memory_region_iorange_read/write in >> mr->ops->read/write instead of adding an "if" in the dispatch >> routines? > > Not trivially because mr->opaque is passed to the read/write > handler, but memory_region_iorange_read/write needs the region. Can > add more data structures to handles this, but what does it buy us?
It's simpler, and I think it lets us remove ops->old_portio too. We can have something like typedef MemoryRegionPortioList { MemoryRegion mr; void *piolist_opaque; MemoryRegionPortio pio[]; } then you can set mr->opaque == mr. It's more similar to how other regions are implemented, e.g. subpages. Paolo -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJRolMGAAoJEBvWZb6bTYbym5wP/izYQtpCSLhiAe6LiyN5cSVj wMe+gSqhqyvi8Ho/GewilHlp1L0UKXQs18KhKqZbEtVETFdvKYoU+sJCPqWbRThW Gj62dfo1Zn814gnv/CxiebslcI5fiU2UrHtpW1oXBKCZWmLJrfZSJqT5K7o1Z8Y3 qRDcR2sIISIQgAxM/n2EbuJWq/v50BUCDOXgpT3eUrq3rvdQHbh/Ym+y8Zd74sXl VhK3UmP17ro0YPLtImForhrFutgavtgKuKCVvMTkD04ZLrWrW+QdXJmGl+LuCp+M L/ib7jaR/4uPJ1RiDPbZexKc956yRsA5gzvJo9kHE0B6IipM+uqVCbrfk96kWrAC Cg3qGn26cT/bc4zNF7NudJxAErVaHf220iJecoqFXNi6OwZTM6IgHlVH58l+yrRE swQlxqQHQoYEzm4ZzsuK9C9Y50Y4C6G0LzkEWeyvYi5UdbOxt/hl1yh0pdSnhSSx 47Hw28nZgceDpcySv/Deb3zBzw/Pxx1Z3wkTxMhVpZ6t3Bot/T9hmkGQyuFqvXWF cdrJEdYmJ2CEkmY2uwKUWCZeMzNtR+qfij+QlcI9RjFoVlmlOySJmBwR55Y7yu5m H4wRZjeQ8PtfpZH/NmmwkNPOxaghDTaUn9k9/rEQzCDM9b17ddovvDI8JYqo9oaa K1di55883LPNfkvycya3 =dJkN -----END PGP SIGNATURE-----