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>
This commit is contained in:
Eduardo Habkost 2015-04-24 15:49:15 -03:00
parent 0456441b5e
commit 5e992a8e33
2 changed files with 2 additions and 1 deletions

View File

@ -2714,7 +2714,7 @@ static void x86_cpu_reset(CPUState *s)
xcc->parent_reset(s); xcc->parent_reset(s);
memset(env, 0, offsetof(CPUX86State, cpuid_level)); memset(env, 0, offsetof(CPUX86State, end_reset_fields));
tlb_flush(s, 1); tlb_flush(s, 1);

View File

@ -1108,6 +1108,7 @@ typedef struct CPUX86State {
CPU_COMMON CPU_COMMON
/* Fields from here on are preserved across CPU reset. */ /* Fields from here on are preserved across CPU reset. */
struct {} end_reset_fields;
/* processor features (e.g. for CPUID insn) */ /* processor features (e.g. for CPUID insn) */
uint32_t cpuid_level; uint32_t cpuid_level;