[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/6] target-i386: Add a marker to end of the region
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PATCH 2/6] target-i386: Add a marker to end of the region zeroed on reset |
Date: |
Wed, 21 Sep 2016 15:26:40 -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.
Signed-off-by: Eduardo Habkost <address@hidden>
---
target-i386/cpu.c | 2 +-
target-i386/cpu.h | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 920b78f..26f0e59 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 27af9c3..604d591 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;
--
2.7.4
- [Qemu-devel] [PATCH 0/6] target-i386: Increase CPUID level/xlevel/xlevel2 automatically, Eduardo Habkost, 2016/09/21
- [Qemu-devel] [PATCH 1/6] target-i386: Remove unused X86CPUDefinition::xlevel2 field, Eduardo Habkost, 2016/09/21
- [Qemu-devel] [PATCH 2/6] target-i386: Add a marker to end of the region zeroed on reset,
Eduardo Habkost <=
- [Qemu-devel] [PATCH 4/6] tests: Test CPUID level handling for old machines, Eduardo Habkost, 2016/09/21
- [Qemu-devel] [PATCH 3/6] tests: Add test code for CPUID level/xlevel handling, Eduardo Habkost, 2016/09/21
- [Qemu-devel] [PATCH 6/6] target-i386: Enable CPUID[0x8000000A] if SVM is enabled, Eduardo Habkost, 2016/09/21
- [Qemu-devel] [PATCH 5/6] target-i386: Automatically set level/xlevel/xlevel2 when needed, Eduardo Habkost, 2016/09/21
Re: [Qemu-devel] [PATCH 0/6] target-i386: Increase CPUID level/xlevel/xlevel2 automatically, no-reply, 2016/09/21