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.

Backports commit 5e992a8e337e710ea2d02f35668ac55a80e15f99 from qemu
This commit is contained in:
Eduardo Habkost 2018-02-26 03:58:08 -05:00 committed by Lioncash
parent c78d24b93c
commit 6861fe80cf
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 2 additions and 1 deletions

View file

@ -2806,7 +2806,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);

View file

@ -1101,6 +1101,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;