]> git.proxmox.com Git - mirror_qemu.git/commitdiff
target-i386: Add a marker to end of the region zeroed on reset
authorEduardo Habkost <ehabkost@redhat.com>
Fri, 24 Apr 2015 18:49:15 +0000 (15:49 -0300)
committerEduardo Habkost <ehabkost@redhat.com>
Tue, 27 Sep 2016 19:17:17 +0000 (16:17 -0300)
Instead of using cpuid_level, use an empty struct as a marker
(like we already did with {start,end}_init_save). This will avoid
accidentaly resetting the wrong fields if we change the field
ordering on CPUX86State.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
target-i386/cpu.c
target-i386/cpu.h

index 920b78fb309f39542455cd98770283699aa84fdb..26f0e59ab9bfd148ee37a1e91492c9634552721a 100644 (file)
@@ -2714,7 +2714,7 @@ static void x86_cpu_reset(CPUState *s)
 
     xcc->parent_reset(s);
 
-    memset(env, 0, offsetof(CPUX86State, cpuid_level));
+    memset(env, 0, offsetof(CPUX86State, end_reset_fields));
 
     tlb_flush(s, 1);
 
index 27af9c3f9ab8d241b26531f568043eee2e21a383..604d5918291fdaf4c97b764015e965a274bf862d 100644 (file)
@@ -1108,6 +1108,7 @@ typedef struct CPUX86State {
     CPU_COMMON
 
     /* Fields from here on are preserved across CPU reset. */
+    struct {} end_reset_fields;
 
     /* processor features (e.g. for CPUID insn) */
     uint32_t cpuid_level;