summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2015-04-24 15:49:15 -0300
committerEduardo Habkost <ehabkost@redhat.com>2016-09-27 16:17:17 -0300
commit5e992a8e337e710ea2d02f35668ac55a80e15f99 (patch)
treee644d74361c1e9699479d4d240f114eb158f0aa6
parent0456441b5eb6694a561ad5bb8dad52483e6a08d0 (diff)
downloadqemu-5e992a8e337e710ea2d02f35668ac55a80e15f99.tar.gz
qemu-5e992a8e337e710ea2d02f35668ac55a80e15f99.tar.bz2
qemu-5e992a8e337e710ea2d02f35668ac55a80e15f99.zip
target-i386: Add a marker to end of the region zeroed on reset
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>
-rw-r--r--target-i386/cpu.c2
-rw-r--r--target-i386/cpu.h1
2 files changed, 2 insertions, 1 deletions
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 920b78fb30..26f0e59ab9 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -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);
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index 27af9c3f9a..604d591829 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -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;