aboutsummaryrefslogtreecommitdiff
path: root/hw/display/vga.c
diff options
context:
space:
mode:
authorKirill Batuzov <batuzovk@ispras.ru>2014-04-29 17:38:39 +0400
committerAndreas Färber <afaerber@suse.de>2014-05-05 20:58:33 +0200
commit848696bf353750899832c51005f1bd3540da5c29 (patch)
tree6936043a73c83a04f36c5c1cf4e58b94e2622d8b /hw/display/vga.c
parentcc900d34e7f298dd4b41c5626307de15416bb045 (diff)
downloadqemu-848696bf353750899832c51005f1bd3540da5c29.zip
qemu-848696bf353750899832c51005f1bd3540da5c29.tar.gz
qemu-848696bf353750899832c51005f1bd3540da5c29.tar.bz2
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>
Diffstat (limited to 'hw/display/vga.c')
-rw-r--r--hw/display/vga.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/hw/display/vga.c b/hw/display/vga.c
index c4c3238..8cd6afe 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -2355,8 +2355,6 @@ void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
{
MemoryRegion *vga_io_memory;
const MemoryRegionPortio *vga_ports, *vbe_ports;
- PortioList *vga_port_list = g_new(PortioList, 1);
- PortioList *vbe_port_list = g_new(PortioList, 1);
qemu_register_reset(vga_reset, s);
@@ -2371,13 +2369,13 @@ void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
1);
memory_region_set_coalescing(vga_io_memory);
if (init_vga_ports) {
- portio_list_init(vga_port_list, obj, vga_ports, s, "vga");
- portio_list_set_flush_coalesced(vga_port_list);
- portio_list_add(vga_port_list, address_space_io, 0x3b0);
+ portio_list_init(&s->vga_port_list, obj, vga_ports, s, "vga");
+ portio_list_set_flush_coalesced(&s->vga_port_list);
+ portio_list_add(&s->vga_port_list, address_space_io, 0x3b0);
}
if (vbe_ports) {
- portio_list_init(vbe_port_list, obj, vbe_ports, s, "vbe");
- portio_list_add(vbe_port_list, address_space_io, 0x1ce);
+ portio_list_init(&s->vbe_port_list, obj, vbe_ports, s, "vbe");
+ portio_list_add(&s->vbe_port_list, address_space_io, 0x1ce);
}
}