Save/load PC speaker internal state
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 5 lines · Pavel Dovgaluk
Save PC speaker state to remove differences between system states after saving the snapshot and after loading it again. This patch is needed for deterministic replay of the execution.
Signed-off-by Pavel Dovgalyuk<[email protected]>
Hi Pavel; thanks for this patch. Couple of minor issues:
Review
Quoted 12 lines
(quoted diff) +12
-0+static const VMStateDescription vmstate_spk = { + .name = "pcspk", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT8_ARRAY(sample_buf, PCSpkState, PCSPK_BUF_LEN), + VMSTATE_UINT32(pit_count, PCSpkState), + VMSTATE_UINT32(samples, PCSpkState), + VMSTATE_UINT32(play_pos, PCSpkState), + VMSTATE_INT32(data_on, PCSpkState), + VMSTATE_INT32(dummy_refresh_clock, PCSpkState),
I think that you need also to update the types in the PCSpkState struct from int/unsigned int to int32_t/uint32_t, otherwise this won't compile on a 64 bit system.
Review
Quoted 10 lines
(quoted diff) +6
-0+ VMSTATE_END_OF_LIST() + } +}; + static int pcspk_initfn(ISADevice *dev) { PCSpkState *s = DO_UPCAST(PCSpkState, dev, dev); + vmstate_register(NULL, 0, &vmstate_spk, s); +
It's nicer to register the vmstate by setting
dc->vmsd = &vmstate_spk;
in pcspk_class_initfn(); then you don't need to explicitly call vmstate_register().
Quoted 2 lines
memory_region_init_io(&s->ioport, &pcspk_io_ops, s, "elcr", 1);
isa_register_ioport(dev, &s->ioport, s->iobase);-- PMM
Quoted 29 lines
-----Original Message-----
From: Peter Maydell [mailto:[email protected]]
Sent: Monday, August 27, 2012 4:50 PM
To: Pavel Dovgaluk
Cc: qemu-devel
Subject: Re: [Qemu-devel] [PATCH] Save/load PC speaker internal stateQuoted 5 lines · Pavel Dovgaluk
Save PC speaker state to remove differences between system states after saving the snapshot and after loading it again. This patch is needed for deterministic replay of the execution.
Signed-off-by Pavel Dovgalyuk<[email protected]>Hi Pavel; thanks for this patch. Couple of minor issues:
Review
Quoted 12 lines
(quoted diff) +12
-0+static const VMStateDescription vmstate_spk = { + .name = "pcspk", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT8_ARRAY(sample_buf, PCSpkState, PCSPK_BUF_LEN), + VMSTATE_UINT32(pit_count, PCSpkState), + VMSTATE_UINT32(samples, PCSpkState), + VMSTATE_UINT32(play_pos, PCSpkState), + VMSTATE_INT32(data_on, PCSpkState), + VMSTATE_INT32(dummy_refresh_clock, PCSpkState),
Quoted 3 lines
I think that you need also to update the types in the PCSpkState struct from int/unsigned int to int32_t/uint32_t, otherwise this won't compile on a 64 bit system.
Peter, Jan, thank you for the reviews. I've sent new version of the patch.
Pavel Dovgaluk