This partly reverts 2be3783328: First, the conversion neglected to update the opaque translation in fdc_pre_save/fdc_post_load which causes memory corruptions on vmsave/restore. And second, we can't apply a common translation here as DeviceState->fdctrl_t is different for sysbus and ISA. Signed-off-by: Jan Kiszka --- hw/fdc.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) *** NOTE *** 'git shortlog|grep "reset + vmsd"' shows 10 such conversions. I only briefly checked the first one, and it looks similar broken. Could someone have a second look at them? Maybe it is also better to define a vmsd opaque in DeviceInfo, which would also allow to solve this issue differently. diff --git a/hw/fdc.c b/hw/fdc.c index d2bfa71..1e1b827 100644 --- a/hw/fdc.c +++ b/hw/fdc.c @@ -1932,6 +1932,8 @@ static int fdctrl_init_common(fdctrl_t *fdctrl) DMA_register_channel(fdctrl->dma_chann, &fdctrl_transfer_handler, fdctrl); fdctrl_connect_drives(fdctrl); + vmstate_register(-1, &vmstate_fdc, fdctrl); + return 0; } @@ -1998,7 +2000,6 @@ static ISADeviceInfo isa_fdc_info = { .qdev.name = "isa-fdc", .qdev.size = sizeof(fdctrl_isabus_t), .qdev.no_user = 1, - .qdev.vmsd = &vmstate_fdc, .qdev.reset = fdctrl_external_reset_isa, .qdev.props = (Property[]) { DEFINE_PROP_DRIVE("driveA", fdctrl_isabus_t, state.drives[0].dinfo), @@ -2011,7 +2012,6 @@ static SysBusDeviceInfo sysbus_fdc_info = { .init = sysbus_fdc_init1, .qdev.name = "sysbus-fdc", .qdev.size = sizeof(fdctrl_sysbus_t), - .qdev.vmsd = &vmstate_fdc, .qdev.reset = fdctrl_external_reset_sysbus, .qdev.props = (Property[]) { DEFINE_PROP_DRIVE("driveA", fdctrl_sysbus_t, state.drives[0].dinfo), @@ -2024,7 +2024,6 @@ static SysBusDeviceInfo sun4m_fdc_info = { .init = sun4m_fdc_init1, .qdev.name = "SUNW,fdtwo", .qdev.size = sizeof(fdctrl_sysbus_t), - .qdev.vmsd = &vmstate_fdc, .qdev.reset = fdctrl_external_reset_sysbus, .qdev.props = (Property[]) { DEFINE_PROP_DRIVE("drive", fdctrl_sysbus_t, state.drives[0].dinfo),