qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v4 1/9] target-avr: AVR cores support is added.


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v4 1/9] target-avr: AVR cores support is added. 1. basic CPU structure 2. registers 3. no instructions
Date: Tue, 7 Jun 2016 07:28:43 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0

On 06/06/2016 11:32 PM, Michael Rolnik wrote:
> Hi Richard,
> 
> /Consider making the vm save state reflect the actual hardware format.  That
> way you can change the qemu internal format while retaining migration
> compatibility./
> 
> How it can be done? how can I modify a value passed to VMSTATE_UINT32?

There are two different ways.  You can see both of them in use in target-i386.

The first is to manually describe the field, using custom get and put fields.
For example:

static const VMStateInfo vmstate_fpreg = {
    .name = "fpreg",
    .get  = get_fpreg,
    .put  = put_fpreg,
};


The second is to reserve extra space for the external representation and then
use the pre_save / post_load hooks.  For i386, see the cpu_pre_save, where we
take the fpus, fpstt, and fptags fields and store them into the fpus_vmstate
field.  It is then the vmstate field that is mentioned in vmstate_x86_cpu.

I personally prefer the get/put fields, but I admit they can be tricky to use.


r~



reply via email to

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