On Tue, 21 Jul 2026 at 22:01, Mark Cave-Ayland
<[email protected]> wrote:
>
> On 18/07/2026 09:46, Peter Maydell wrote:
> >>>> Are you OK with this patch as it stands, or would you like me to
> >>>> change it?
>
> Sorry about the long delay getting to this one. Looking through the migration 
> code,
> the current approach uses get/put handlers for registers that need to do more 
> than
> just update value in the state. Longer term that code could do with an update 
> to use
> .post_load, but for now I think it makes sense to use the existing pattern,
> particularly as it keeps the separation between 32-bit and 64-bit.
>
> The following diff gives the same output in analyze-migration.py and I think 
> should
> solve the issue based upon your analysis:

Yes, that should also work. There's a minor bug in it, though:

> +static int put_cwp(QEMUFile *f, void *opaque, size_t size,
> +                   const VMStateField *field, JSONWriter *vmdesc)
> +{
> +    SPARCCPU *cpu = opaque;
> +    CPUSPARCState *env = &cpu->env;
> +    uint32_t val = cpu_get_cwp64(env);

This should be "val = env->cwp;" (cpu_get_cwp64() returns
"env->nwindows - 1 - env->cwp", but we just want the plain env->cwp
value because that's what we used to migrate and what the get_cwp()
function wants to see.)

With that change, the sanitizer is happy with the migration-test.

Do you plan to send your version as a proper patch?

thanks
-- PMM

Reply via email to