mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
sparc: embed sparc_def_t into CPUSPARCState
Make CPUSPARCState::def embedded so it would be allocated as part of cpu instance and we won't have to worry about cleaning def pointer up mannualy on cpu destruction. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <1503592308-93913-4-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
12a6c15ef3
commit
576e1c4c23
9 changed files with 34 additions and 41 deletions
|
@ -66,7 +66,7 @@ static void sparc_cpu_reset(CPUState *s)
|
|||
env->lsu = 0;
|
||||
#else
|
||||
env->mmuregs[0] &= ~(MMU_E | MMU_NF);
|
||||
env->mmuregs[0] |= env->def->mmu_bm;
|
||||
env->mmuregs[0] |= env->def.mmu_bm;
|
||||
#endif
|
||||
env->pc = 0;
|
||||
env->npc = env->pc + 4;
|
||||
|
@ -120,18 +120,18 @@ 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;
|
||||
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;
|
||||
env->mmuregs[0] |= env->def.mmu_version;
|
||||
cpu_sparc_set_id(env, 0);
|
||||
env->mxccregs[7] |= env->def->mxcc_version;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
@ -557,7 +557,7 @@ static void sparc_cpu_parse_features(CPUState *cs, char *features,
|
|||
Error **errp)
|
||||
{
|
||||
SPARCCPU *cpu = SPARC_CPU(cs);
|
||||
sparc_def_t *cpu_def = cpu->env.def;
|
||||
sparc_def_t *cpu_def = &cpu->env.def;
|
||||
char *featurestr;
|
||||
uint32_t plus_features = 0;
|
||||
uint32_t minus_features = 0;
|
||||
|
@ -818,8 +818,8 @@ static void sparc_cpu_realizefn(DeviceState *dev, Error **errp)
|
|||
SPARCCPU *cpu = SPARC_CPU(dev);
|
||||
CPUSPARCState *env = &cpu->env;
|
||||
|
||||
if ((env->def->features & CPU_FEATURE_FLOAT)) {
|
||||
env->def->features |= CPU_FEATURE_FLOAT128;
|
||||
if ((env->def.features & CPU_FEATURE_FLOAT)) {
|
||||
env->def.features |= CPU_FEATURE_FLOAT128;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -847,15 +847,9 @@ static void sparc_cpu_initfn(Object *obj)
|
|||
gen_intermediate_code_init(env);
|
||||
}
|
||||
|
||||
env->def = g_memdup(scc->cpu_def, sizeof(*scc->cpu_def));
|
||||
}
|
||||
|
||||
static void sparc_cpu_uninitfn(Object *obj)
|
||||
{
|
||||
SPARCCPU *cpu = SPARC_CPU(obj);
|
||||
CPUSPARCState *env = &cpu->env;
|
||||
|
||||
g_free(env->def);
|
||||
if (scc->cpu_def) {
|
||||
env->def = *scc->cpu_def;
|
||||
}
|
||||
}
|
||||
|
||||
static void sparc_cpu_class_init(ObjectClass *oc, void *data)
|
||||
|
@ -904,7 +898,6 @@ static const TypeInfo sparc_cpu_type_info = {
|
|||
.parent = TYPE_CPU,
|
||||
.instance_size = sizeof(SPARCCPU),
|
||||
.instance_init = sparc_cpu_initfn,
|
||||
.instance_finalize = sparc_cpu_uninitfn,
|
||||
.abstract = true,
|
||||
.class_size = sizeof(SPARCCPUClass),
|
||||
.class_init = sparc_cpu_class_init,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue