qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Save/load PC speaker internal state


From: Jan Kiszka
Subject: Re: [Qemu-devel] [PATCH] Save/load PC speaker internal state
Date: Mon, 27 Aug 2012 19:27:13 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

On 2012-08-27 14:21, Pavel Dovgaluk wrote:
> 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<address@hidden>
> ---
>  hw/pcspk.c |   18 ++++++++++++++++++
>  1 files changed, 18 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/pcspk.c b/hw/pcspk.c
> index e430324..3fb3dd1 100644
> --- a/hw/pcspk.c
> +++ b/hw/pcspk.c
> @@ -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),

Can be regenerated on load.

> +        VMSTATE_UINT32(pit_count, PCSpkState),
> +        VMSTATE_UINT32(samples, PCSpkState),

Same here.

> +        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);
> +

This function is for legacy users only. You have to register the vmstate
via pcspk_class_initfn (set vmsd of the device class).

>      memory_region_init_io(&s->ioport, &pcspk_io_ops, s, "elcr", 1);
>      isa_register_ioport(dev, &s->ioport, s->iobase);
> 
> 
> 
> 

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux



reply via email to

[Prev in Thread] Current Thread [Next in Thread]