@@ -204,7 +204,6 @@ typedef struct CPUWatchpoint {
/* user data */ \
void *opaque; \
\
- const char *cpu_model_str; \
struct KVMState *kvm_state; \
struct kvm_run *kvm_run; \
int kvm_fd; \
@@ -526,7 +526,8 @@ void cpu_abort(CPUArchState *env, const char *fmt, ...)
CPUArchState *cpu_copy(CPUArchState *env)
{
- CPUArchState *new_env = CPU_GET_ENV(cpu_init(env->cpu_model_str));
+ CPUState *old_cpu = ENV_GET_CPU(env);
+ CPUArchState *new_env = CPU_GET_ENV(cpu_init(old_cpu->cpu_model_str));
CPUArchState *next_cpu = new_env->next_cpu;
int cpu_index = new_env->cpu_index;
#if defined(TARGET_HAS_ICE)
@@ -77,6 +77,7 @@ struct CPUState {
bool stop;
bool stopped;
+ const char *cpu_model_str; \
/* TODO Move common fields from CPUArchState here. */
};
@@ -3543,7 +3543,7 @@ CPUState *cpu_alpha_init(const char *cpu_model)
}
env->implver = implver;
env->amask = amask;
- env->cpu_model_str = cpu_model;
+ CPU(cpu)->cpu_model_str = cpu_model;
qemu_init_vcpu(env);
return CPU(cpu);
@@ -1268,7 +1268,7 @@ ARMCPU *cpu_arm_init(const char *cpu_model)
}
cpu = ARM_CPU(object_new(cpu_model));
env = &cpu->env;
- env->cpu_model_str = cpu_model;
+ CPU(cpu)->cpu_model_str = cpu_model;
arm_cpu_realize(cpu);
if (tcg_enabled() && !inited) {
@@ -1240,12 +1240,10 @@ int cpu_x86_get_descr_debug(CPUX86State *env, unsigned int selector,
X86CPU *cpu_x86_init(const char *cpu_model)
{
X86CPU *cpu;
- CPUX86State *env;
Error *error = NULL;
cpu = X86_CPU(object_new(TYPE_X86_CPU));
- env = &cpu->env;
- env->cpu_model_str = cpu_model;
+ CPU(cpu)->cpu_model_str = cpu_model;
if (cpu_x86_register(cpu, cpu_model) < 0) {
object_delete(OBJECT(cpu));
@@ -115,7 +115,7 @@ CPUState *cpu_m68k_init(const char *cpu_model)
m68k_tcg_init();
}
- env->cpu_model_str = cpu_model;
+ CPU(cpu)->cpu_model_str = cpu_model;
register_m68k_insns(env);
if (m68k_feature(env, M68K_FEATURE_CF_FPU)) {
@@ -15862,7 +15862,7 @@ MIPSCPU *cpu_mips_init(const char *cpu_model)
cpu = MIPS_CPU(object_new(TYPE_MIPS_CPU));
env = &cpu->env;
env->cpu_model = def;
- env->cpu_model_str = cpu_model;
+ CPU(cpu)->cpu_model_str = cpu_model;
#ifndef CONFIG_USER_ONLY
mmu_init(env, def);
@@ -163,7 +163,7 @@ OpenRISCCPU *cpu_openrisc_init(const char *cpu_model)
return NULL;
}
cpu = OPENRISC_CPU(object_new(cpu_model));
- cpu->env.cpu_model_str = cpu_model;
+ CPU(cpu)->cpu_model_str = cpu_model;
openrisc_cpu_realize(OBJECT(cpu), NULL);
@@ -41,7 +41,7 @@ PowerPCCPU *cpu_ppc_init(const char *cpu_model)
ppc_translate_init();
}
- env->cpu_model_str = cpu_model;
+ CPU(cpu)->cpu_model_str = cpu_model;
cpu_ppc_register_internal(env, def);
qemu_init_vcpu(env);
@@ -84,7 +84,7 @@ S390CPU *cpu_s390x_init(const char *cpu_model)
s390x_translate_init();
}
- env->cpu_model_str = cpu_model;
+ CPU(cpu)->cpu_model_str = cpu_model;
qemu_init_vcpu(env);
return cpu;
}
@@ -252,7 +252,7 @@ SuperHCPU *cpu_sh4_init(const char *cpu_model)
env = &cpu->env;
env->features = def->features;
sh4_translate_init();
- env->cpu_model_str = cpu_model;
+ CPU(cpu)->cpu_model_str = cpu_model;
cpu_reset(CPU(cpu));
cpu_register(env, def);
qemu_init_vcpu(env);
@@ -89,7 +89,7 @@ static int cpu_sparc_register(CPUSPARCState *env, const char *cpu_model)
env->def->features |= CPU_FEATURE_FLOAT128;
}
#endif
- env->cpu_model_str = cpu_model;
+ ENV_GET_CPU(env)->cpu_model_str = cpu_model;
env->version = def->iu_version;
env->fsr = def->fpu_version;
env->nwindows = def->nwindows;
@@ -67,7 +67,7 @@ static void uc32_cpu_initfn(Object *obj)
CPUUniCore32State *env = &cpu->env;
cpu_exec_init(env);
- env->cpu_model_str = object_get_typename(obj);
+ CPU(cpu)->cpu_model_str = object_get_typename(obj);
#ifdef CONFIG_USER_ONLY
env->uncached_asr = ASR_MODE_USER;
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- cpu-defs.h | 1 - exec.c | 3 ++- include/qemu/cpu.h | 1 + target-alpha/translate.c | 2 +- target-arm/helper.c | 2 +- target-i386/helper.c | 4 +--- target-m68k/helper.c | 2 +- target-mips/translate.c | 2 +- target-openrisc/cpu.c | 2 +- target-ppc/helper.c | 2 +- target-s390x/helper.c | 2 +- target-sh4/translate.c | 2 +- target-sparc/cpu.c | 2 +- target-unicore32/cpu.c | 2 +- 14 files changed, 14 insertions(+), 15 deletions(-)