mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
PortioList: Store PortioList in device state
PortioList is an abstraction used for construction of MemoryRegionPortioList from MemoryRegionPortio. It can be used later to unmap created memory regions. It also requires proper cleanup because some of the memory inside is allocated dynamically. By moving PortioList ot device state we make it possible to cleanup later and avoid leaking memory. This change spans several target platforms. The following testcases cover all changed lines: qemu-system-ppc -M prep qemu-system-i386 -vga qxl qemu-system-i386 -M isapc -soundhw adlib -device ib700,id=watchdog0,bus=isa.0 Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
cc900d34e7
commit
848696bf35
9 changed files with 34 additions and 26 deletions
|
@ -108,15 +108,20 @@ void isa_register_portio_list(ISADevice *dev, uint16_t start,
|
|||
const MemoryRegionPortio *pio_start,
|
||||
void *opaque, const char *name)
|
||||
{
|
||||
PortioList *piolist = g_new(PortioList, 1);
|
||||
PortioList piolist;
|
||||
|
||||
/* START is how we should treat DEV, regardless of the actual
|
||||
contents of the portio array. This is how the old code
|
||||
actually handled e.g. the FDC device. */
|
||||
isa_init_ioport(dev, start);
|
||||
|
||||
portio_list_init(piolist, OBJECT(dev), pio_start, opaque, name);
|
||||
portio_list_add(piolist, isabus->address_space_io, start);
|
||||
/* FIXME: the device should store created PortioList in its state. Note
|
||||
that DEV can be NULL here and that single device can register several
|
||||
portio lists. Current implementation is leaking memory allocated
|
||||
in portio_list_init. The leak is not critical because it happens only
|
||||
at initialization time. */
|
||||
portio_list_init(&piolist, OBJECT(dev), pio_start, opaque, name);
|
||||
portio_list_add(&piolist, isabus->address_space_io, start);
|
||||
}
|
||||
|
||||
static void isa_device_init(Object *obj)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue