As expected, this is taking longer than expected, so I'm releasing something
less complete than I'd have liked. Not even all of the PC machine is
converted, but the difficult parts are (cirrus). It appears to work well.
The major change compared to v1 is the introduction of
memory_region_init_alias(), which defines a memory region in terms of another.
With the current API, the ability to alias is provided by address arithmetic
on ram_addr_t:
ram_addr = qemu_ram_alloc(...);
cpu_register_physical_memory(..., ram_addr, size, ...);
/* alias: */
cpu_register_physical_memory(..., ram_addr + offset, another_size, ...);
With the new API, you have to create an alias:
memory_region_init_ram(&mem, ...);
memory_region_register_subregion(...,&mem);
/* alias: */
memory_region_init_alias(&alias, ...,&mem, offset, another_size);
memory_region_register_subregion(...,&alias);
The patchset is somewhat churny. One of the reasons is that we move from a
handle/pointer scheme in ram_addr_t to an object constructor/destructor scheme.
Another is that region size becomes a property of a region instead of being
maintained externally. Also, container memory regions must be passed around,
though we don't do that as well as we should.
Todo:
- eliminate calls to get_system_memory() (where we ignore the bus hierarchy)
- add PCI APIs for the VGA window
- support the PIO address space using the memory API (allowing simplified
PCI BAR registration)
- convert 440FX
- convert everything else