[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH for-2.11 v3 05/25] sparc: move adhoc CPUSPARCState i
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH for-2.11 v3 05/25] sparc: move adhoc CPUSPARCState initialization to realize time |
Date: |
Thu, 24 Aug 2017 18:31:28 +0200 |
SPARCCPU::env was initialized from previously set properties
(with help of sparc_cpu_parse_features) in cpu_sparc_register().
However there is not reason to keep it there as this task is
typically done at realize time. So move post properties
initialization into sparc_cpu_realizefn, which brings
cpu_sparc_init() closer to cpu_generic_init().
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
---
CC: Mark Cave-Ayland <address@hidden>
CC: Artyom Tarasenko <address@hidden>
---
target/sparc/cpu.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
index 82ab5ad..9dfc150 100644
--- a/target/sparc/cpu.c
+++ b/target/sparc/cpu.c
@@ -109,7 +109,6 @@ static void sparc_cpu_parse_features(CPUState *cs, char
*features,
static int cpu_sparc_register(SPARCCPU *cpu, const char *cpu_model)
{
- CPUSPARCState *env = &cpu->env;
char *s = g_strdup(cpu_model);
char *featurestr = strtok(s, ",");
Error *err = NULL;
@@ -122,19 +121,6 @@ static int cpu_sparc_register(SPARCCPU *cpu, const char
*cpu_model)
return -1;
}
- env->version = env->def.iu_version;
- env->fsr = env->def.fpu_version;
- env->nwindows = env->def.nwindows;
-#if !defined(TARGET_SPARC64)
- env->mmuregs[0] |= env->def.mmu_version;
- cpu_sparc_set_id(env, 0);
- env->mxccregs[7] |= env->def.mxcc_version;
-#else
- env->mmu_version = env->def.mmu_version;
- env->maxtl = env->def.maxtl;
- env->version |= env->def.maxtl << 8;
- env->version |= env->def.nwindows - 1;
-#endif
return 0;
}
@@ -816,15 +802,29 @@ static void sparc_cpu_realizefn(DeviceState *dev, Error
**errp)
CPUState *cs = CPU(dev);
SPARCCPUClass *scc = SPARC_CPU_GET_CLASS(dev);
Error *local_err = NULL;
-#if defined(CONFIG_USER_ONLY)
SPARCCPU *cpu = SPARC_CPU(dev);
CPUSPARCState *env = &cpu->env;
+#if defined(CONFIG_USER_ONLY)
if ((env->def.features & CPU_FEATURE_FLOAT)) {
env->def.features |= CPU_FEATURE_FLOAT128;
}
#endif
+ env->version = env->def.iu_version;
+ env->fsr = env->def.fpu_version;
+ env->nwindows = env->def.nwindows;
+#if !defined(TARGET_SPARC64)
+ env->mmuregs[0] |= env->def.mmu_version;
+ cpu_sparc_set_id(env, 0);
+ env->mxccregs[7] |= env->def.mxcc_version;
+#else
+ env->mmu_version = env->def.mmu_version;
+ env->maxtl = env->def.maxtl;
+ env->version |= env->def.maxtl << 8;
+ env->version |= env->def.nwindows - 1;
+#endif
+
cpu_exec_realizefn(cs, &local_err);
if (local_err != NULL) {
error_propagate(errp, local_err);
--
2.7.4
- [Qemu-devel] [PATCH for-2.11 v3 00/25] complete cpu QOMification and remove cpu_FOO_init() helpers, Igor Mammedov, 2017/08/24
- [Qemu-devel] [PATCH for-2.11 v3 01/25] qom: cpu: fix parsed feature string length, Igor Mammedov, 2017/08/24
- [Qemu-devel] [PATCH for-2.11 v3 02/25] sparc: convert cpu models to SPARC cpu subclasses, Igor Mammedov, 2017/08/24
- [Qemu-devel] [PATCH for-2.11 v3 04/25] sparc: convert cpu features to qdev properties, Igor Mammedov, 2017/08/24
- [Qemu-devel] [PATCH for-2.11 v3 03/25] sparc: embed sparc_def_t into CPUSPARCState, Igor Mammedov, 2017/08/24
- [Qemu-devel] [PATCH for-2.11 v3 05/25] sparc: move adhoc CPUSPARCState initialization to realize time,
Igor Mammedov <=
- [Qemu-devel] [PATCH for-2.11 v3 06/25] sparc: make cpu feature parsing property based, Igor Mammedov, 2017/08/24
- [Qemu-devel] [PATCH for-2.11 v3 07/25] sparc: replace cpu_sparc_init() with cpu_generic_init(), Igor Mammedov, 2017/08/24
- [Qemu-devel] [PATCH for-2.11 v3 09/25] alpha: replace cpu_alpha_init() with cpu_generic_init(), Igor Mammedov, 2017/08/24
- [Qemu-devel] [PATCH for-2.11 v3 13/25] nios2: replace cpu_nios2_init() with cpu_generic_init(), Igor Mammedov, 2017/08/24
- [Qemu-devel] [PATCH for-2.11 v3 10/25] hppa: replace cpu_hppa_init() with cpu_generic_init(), Igor Mammedov, 2017/08/24
- [Qemu-devel] [PATCH for-2.11 v3 08/25] s390x: replace cpu_s390x_init() with cpu_generic_init(), Igor Mammedov, 2017/08/24