Save/load PC speaker internal state
PATCH 1/1 Save/load PC speaker internal state
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.
--- hw/pcspk.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-)
hw/pcspk.c +18 -0
@@ -159,10 +159,28 @@ static const MemoryRegionOps pcspk_io_ops = { }, }; +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), +VMSTATE_END_OF_LIST () + } +}; +static int pcspk_initfn (ISADevice *dev) {PCSpkState *s =DO_UPCAST (PCSpkState, dev, dev); +vmstate_register (NULL ,0 , &vmstate_spk, s); +memory_region_init_io (&s->ioport, &pcspk_io_ops, s,"elcr" ,1 );isa_register_ioport (dev, &s->ioport, s->iobase);
Am 27.08.2012 14:21, schrieb Pavel Dovgaluk:
Quoted 32 lines
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]>--- hw/pcspk.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-)hw/pcspk.c +15
-0@@ -159,10 +159,28 @@ static const MemoryRegionOps pcspk_io_ops = { }, }; +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), +VMSTATE_END_OF_LIST () + } +};
hw/pcspk.c static const MemoryRegionOps pcspk_io_ops = { · line 186
Quoted 10 lines
hw/pcspk.c +3
-0+static int pcspk_initfn (ISADevice *dev) {PCSpkState *s =DO_UPCAST (PCSpkState, dev, dev); +vmstate_register (NULL ,0 , &vmstate_spk, s); +memory_region_init_io (&s->ioport, &pcspk_io_ops, s,"elcr" ,1 );isa_register_ioport (dev, &s->ioport, s->iobase);
What about pc-1.0 etc. machines? Does this need to be backported to stable branches first for migration from v1.2 to work? Or is such incoming excess data silently ignored? Or any compat magic required on top?
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 9 lines · Andreas Färber
Am 27.08.2012 14:21, schrieb Pavel Dovgaluk:
Quoted 4 lines
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.
What about pc-1.0 etc. machines? Does this need to be backported to stable branches first for migration from v1.2 to work? Or is such incoming excess data silently ignored? Or any compat magic required on top?
Is there a way to detect if we have ever used the speaker? Otherwise, it is difficult to know if we should sent it or not.
Later, Juan.