On 3/25/26 2:17 PM, Philippe Mathieu-Daudé wrote:
> The x86 target is the single one using the VMSTATE_UINTTL_SUB_ARRAY
> macro. Inline it to avoid further uses of this legacy macro on other
> targets.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> include/migration/cpu.h | 4 ----
> target/i386/machine.c | 6 +++++-
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/include/migration/cpu.h b/include/migration/cpu.h
> index 82a81b5d895..ea411d863ad 100644
> --- a/include/migration/cpu.h
> +++ b/include/migration/cpu.h
> @@ -12,16 +12,12 @@
> VMSTATE_UINT64_V(_f, _s, _v)
> #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v) \
> VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v)
> -#define VMSTATE_UINTTL_SUB_ARRAY(_f, _s, _start, _num) \
> - VMSTATE_UINT64_SUB_ARRAY(_f, _s, _start, _num)
> #define vmstate_info_uinttl vmstate_info_uint64
> #else
> #define VMSTATE_UINTTL_V(_f, _s, _v) \
> VMSTATE_UINT32_V(_f, _s, _v)
> #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v) \
> VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v)
> -#define VMSTATE_UINTTL_SUB_ARRAY(_f, _s, _start, _num) \
> - VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num)
> #define vmstate_info_uinttl vmstate_info_uint32
> #endif
>
> diff --git a/target/i386/machine.c b/target/i386/machine.c
> index 1f5c517e562..16b65bddcdd 100644
> --- a/target/i386/machine.c
> +++ b/target/i386/machine.c
> @@ -1770,7 +1770,11 @@ const VMStateDescription vmstate_x86_cpu = {
> .pre_save = cpu_pre_save,
> .post_load = cpu_post_load,
> .fields = (const VMStateField[]) {
> - VMSTATE_UINTTL_SUB_ARRAY(env.regs, X86CPU, 0, CPU_NB_REGS),
> +#if TARGET_LONG_BITS == 64
> + VMSTATE_UINT64_SUB_ARRAY(env.regs, X86CPU, 0, CPU_NB_REGS),
> +#else
> + VMSTATE_UINT32_SUB_ARRAY(env.regs, X86CPU, 0, CPU_NB_REGS),
> +#endif
> VMSTATE_UINTTL(env.eip, X86CPU),
> VMSTATE_UINTTL(env.eflags, X86CPU),
> VMSTATE_UINT32(env.hflags, X86CPU),
I think it would be better to exclude this patch, and treat
VMSTATE_UINTTL_SUB_ARRAY with a generic approach, similar to what we
talked about VMSTATE_UINTTL*.
In short, to add a field to VMStateField, with .target_long = true, that
indicates to migration code that size should be read from .size /
target_long_bits().
Regards,
Pierrick