mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-07-07 14:00:40 +00:00
sparc: move adhoc CPUSPARCState initialization to realize time
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(). Backports commit 700549620b3ee15924f19b9eb79961655ce671c5 from qemu
This commit is contained in:
parent
0d7be1a913
commit
5a66d7f326
|
@ -99,7 +99,6 @@ static void sparc_cpu_parse_features(CPUState *cs, char *features,
|
||||||
|
|
||||||
static int cpu_sparc_register(struct uc_struct *uc, SPARCCPU *cpu, const char *cpu_model)
|
static int cpu_sparc_register(struct uc_struct *uc, SPARCCPU *cpu, const char *cpu_model)
|
||||||
{
|
{
|
||||||
CPUSPARCState *env = &cpu->env;
|
|
||||||
char *s = g_strdup(cpu_model);
|
char *s = g_strdup(cpu_model);
|
||||||
char *featurestr = strtok(s, ",");
|
char *featurestr = strtok(s, ",");
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
|
@ -113,19 +112,6 @@ static int cpu_sparc_register(struct uc_struct *uc, SPARCCPU *cpu, const char *c
|
||||||
return -1;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -849,16 +835,29 @@ static ObjectClass *sparc_cpu_class_by_name(struct uc_struct *uc, const char *cp
|
||||||
static int sparc_cpu_realizefn(struct uc_struct *uc, DeviceState *dev, Error **errp)
|
static int sparc_cpu_realizefn(struct uc_struct *uc, DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
SPARCCPUClass *scc = SPARC_CPU_GET_CLASS(uc, dev);
|
SPARCCPUClass *scc = SPARC_CPU_GET_CLASS(uc, dev);
|
||||||
#if defined(CONFIG_USER_ONLY)
|
|
||||||
SPARCCPU *cpu = SPARC_CPU(uc, dev);
|
SPARCCPU *cpu = SPARC_CPU(uc, dev);
|
||||||
SPARCCPUClass *scc = SPARC_CPU_GET_CLASS(uc, obj);
|
|
||||||
CPUSPARCState *env = &cpu->env;
|
CPUSPARCState *env = &cpu->env;
|
||||||
|
|
||||||
|
#if defined(CONFIG_USER_ONLY)
|
||||||
if ((env->def.features & CPU_FEATURE_FLOAT)) {
|
if ((env->def.features & CPU_FEATURE_FLOAT)) {
|
||||||
env->def.features |= CPU_FEATURE_FLOAT128;
|
env->def.features |= CPU_FEATURE_FLOAT128;
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
||||||
|
|
||||||
qemu_init_vcpu(CPU(dev));
|
qemu_init_vcpu(CPU(dev));
|
||||||
|
|
||||||
scc->parent_realize(uc, dev, errp);
|
scc->parent_realize(uc, dev, errp);
|
||||||
|
|
Loading…
Reference in a new issue