diff --git a/hw/ide-isa.c b/hw/ide-isa.c index 705c24d670c3ae41109fb379d0656d4563a2e1b7..279474b30ea942d5dbd0e1ea4a91d60478fe8b93 100644 --- a/hw/ide-isa.c +++ b/hw/ide-isa.c @@ -33,13 +33,38 @@ /***********************************************************/ /* ISA IDE definitions */ +typedef struct ISAIDEState { + IDEBus *bus; +} ISAIDEState; + +static void isa_ide_save(QEMUFile* f, void *opaque) +{ + ISAIDEState *s = opaque; + + idebus_save(f, s->bus); + ide_save(f, &s->bus->ifs[0]); + ide_save(f, &s->bus->ifs[1]); +} + +static int isa_ide_load(QEMUFile* f, void *opaque, int version_id) +{ + ISAIDEState *s = opaque; + + idebus_load(f, s->bus, version_id); + ide_load(f, &s->bus->ifs[0], version_id); + ide_load(f, &s->bus->ifs[1], version_id); + return 0; +} + void isa_ide_init(int iobase, int iobase2, qemu_irq irq, BlockDriverState *hd0, BlockDriverState *hd1) { - IDEBus *bus; + ISAIDEState *s; - bus = qemu_mallocz(sizeof(*bus)); + s = qemu_mallocz(sizeof(*s)); + s->bus = qemu_mallocz(sizeof(IDEBus)); - ide_init2(bus, hd0, hd1, irq); - ide_init_ioport(bus, iobase, iobase2); + ide_init2(s->bus, hd0, hd1, irq); + ide_init_ioport(s->bus, iobase, iobase2); + register_savevm("isa-ide", 0, 3, isa_ide_save, isa_ide_load, s); }