Hi all, Please correct me if I’m wrong.
I made some changes to IDE emulation (add some extra structures to “struct IDEState") and want to save these info to files when VM shutdowns. So I can reload these info from files next time when VM starts. According to my understanding, one IDEState structure is corresponding to one disk for VM and all available drives are probed/initialised by ide_init2() in hw/ide.c (I used qemu v0.11) during VM startup. It seemed that IDEState structure are saved to QEMUFile structure via pci_ide_save(), but I can only trace up to register_savevm(), where pci_ide_save() is registered as a callback. I can’t find where exactly this function starts execution or being called. My questions are: (1). Does QEMUFile structure represent a running VM instance, through which I can access the IDE drive (struct IDEState) pointers ? (2). When does qemu execute pci_ide_save()? (3). How does qemu handle VM shutdown? It seems ACPI event is sent to VM so guest OS will shutdown in the way like real OS running on real hardware. But how and where does qemu exactly handle this? I think I need to add my codes here. Any hints, suggestions would be appreciated. Thanks. Huaicheng Li