Skip to content

Commit

Permalink
cpu: Move cpu_model_str from CPU_COMMON to CPUState
Browse files Browse the repository at this point in the history
Since this is only read in cpu_copy(), move the field assignment into
linux-user.

Signed-off-by: Andreas Färber <afaerber@suse.de>
  • Loading branch information
afaerber committed Aug 31, 2013
1 parent 1a61d9a commit 5cb259f
Show file tree
Hide file tree
Showing 16 changed files with 5 additions and 28 deletions.
2 changes: 0 additions & 2 deletions include/exec/cpu-defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,5 @@ typedef struct CPUWatchpoint {
\
/* user data */ \
void *opaque; \
\
const char *cpu_model_str;

#endif
2 changes: 2 additions & 0 deletions include/qom/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ struct CPUState {
uint32_t interrupt_request;
int singlestep_enabled;

const char *model_str;

void *env_ptr; /* CPUArchState */
struct TranslationBlock *current_tb;
struct GDBRegisterState *gdb_regs;
Expand Down
3 changes: 2 additions & 1 deletion linux-user/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

CPUArchState *cpu_copy(CPUArchState *env)
{
CPUArchState *new_env = cpu_init(env->cpu_model_str);
CPUState *cpu = ENV_GET_CPU(env);
CPUArchState *new_env = cpu_init(cpu->model_str);
#if defined(TARGET_HAS_ICE)
CPUBreakpoint *bp;
CPUWatchpoint *wp;
Expand Down
1 change: 1 addition & 0 deletions linux-user/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3641,6 +3641,7 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
cpu = ENV_GET_CPU(env);
cpu->model_str = cpu_model;
cpu_reset(cpu);

thread_cpu = cpu;
Expand Down
4 changes: 0 additions & 4 deletions target-alpha/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model)
AlphaCPU *cpu_alpha_init(const char *cpu_model)
{
AlphaCPU *cpu;
CPUAlphaState *env;
ObjectClass *cpu_class;

cpu_class = alpha_cpu_class_by_name(cpu_model);
Expand All @@ -140,9 +139,6 @@ AlphaCPU *cpu_alpha_init(const char *cpu_model)
cpu_class = object_class_by_name(TYPE("ev67"));
}
cpu = ALPHA_CPU(object_new(object_class_get_name(cpu_class)));
env = &cpu->env;

env->cpu_model_str = cpu_model;

object_property_set_bool(OBJECT(cpu), true, "realized", NULL);

Expand Down
3 changes: 0 additions & 3 deletions target-arm/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1748,16 +1748,13 @@ void register_cp_regs_for_features(ARMCPU *cpu)
ARMCPU *cpu_arm_init(const char *cpu_model)
{
ARMCPU *cpu;
CPUARMState *env;
ObjectClass *oc;

oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model);
if (!oc) {
return NULL;
}
cpu = ARM_CPU(object_new(object_class_get_name(oc)));
env = &cpu->env;
env->cpu_model_str = cpu_model;

/* TODO this should be set centrally, once possible */
object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
Expand Down
3 changes: 0 additions & 3 deletions target-i386/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1784,7 +1784,6 @@ X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridge,
Error **errp)
{
X86CPU *cpu = NULL;
CPUX86State *env;
gchar **model_pieces;
char *name, *features;
char *typename;
Expand All @@ -1807,8 +1806,6 @@ X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridge,
qdev_set_parent_bus(DEVICE(cpu), qdev_get_child_bus(icc_bridge, "icc"));
object_unref(OBJECT(cpu));
#endif
env = &cpu->env;
env->cpu_model_str = cpu_model;

cpu_x86_register(cpu, name, &error);
if (error) {
Expand Down
1 change: 0 additions & 1 deletion target-m68k/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ M68kCPU *cpu_m68k_init(const char *cpu_model)
}
cpu = M68K_CPU(object_new(object_class_get_name(oc)));
env = &cpu->env;
env->cpu_model_str = cpu_model;

register_m68k_insns(env);

Expand Down
1 change: 0 additions & 1 deletion target-mips/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -15907,7 +15907,6 @@ 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;

#ifndef CONFIG_USER_ONLY
mmu_init(env, def);
Expand Down
1 change: 0 additions & 1 deletion target-moxie/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ MoxieCPU *cpu_moxie_init(const char *cpu_model)
return NULL;
}
cpu = MOXIE_CPU(object_new(object_class_get_name(oc)));
cpu->env.cpu_model_str = cpu_model;

object_property_set_bool(OBJECT(cpu), true, "realized", NULL);

Expand Down
1 change: 0 additions & 1 deletion target-openrisc/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ OpenRISCCPU *cpu_openrisc_init(const char *cpu_model)
return NULL;
}
cpu = OPENRISC_CPU(object_new(object_class_get_name(oc)));
cpu->env.cpu_model_str = cpu_model;

object_property_set_bool(OBJECT(cpu), true, "realized", NULL);

Expand Down
3 changes: 0 additions & 3 deletions target-ppc/translate_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -8267,7 +8267,6 @@ static ObjectClass *ppc_cpu_class_by_name(const char *name)
PowerPCCPU *cpu_ppc_init(const char *cpu_model)
{
PowerPCCPU *cpu;
CPUPPCState *env;
ObjectClass *oc;
Error *err = NULL;

Expand All @@ -8277,8 +8276,6 @@ PowerPCCPU *cpu_ppc_init(const char *cpu_model)
}

cpu = POWERPC_CPU(object_new(object_class_get_name(oc)));
env = &cpu->env;
env->cpu_model_str = cpu_model;

object_property_set_bool(OBJECT(cpu), true, "realized", &err);
if (err != NULL) {
Expand Down
3 changes: 0 additions & 3 deletions target-s390x/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,8 @@ void s390x_cpu_timer(void *opaque)
S390CPU *cpu_s390x_init(const char *cpu_model)
{
S390CPU *cpu;
CPUS390XState *env;

cpu = S390_CPU(object_new(TYPE_S390_CPU));
env = &cpu->env;
env->cpu_model_str = cpu_model;

object_property_set_bool(OBJECT(cpu), true, "realized", NULL);

Expand Down
3 changes: 0 additions & 3 deletions target-sh4/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,13 @@ static ObjectClass *superh_cpu_class_by_name(const char *cpu_model)
SuperHCPU *cpu_sh4_init(const char *cpu_model)
{
SuperHCPU *cpu;
CPUSH4State *env;
ObjectClass *oc;

oc = superh_cpu_class_by_name(cpu_model);
if (oc == NULL) {
return NULL;
}
cpu = SUPERH_CPU(object_new(object_class_get_name(oc)));
env = &cpu->env;
env->cpu_model_str = cpu_model;

object_property_set_bool(OBJECT(cpu), true, "realized", NULL);

Expand Down
1 change: 0 additions & 1 deletion target-sparc/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ 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->version = def->iu_version;
env->fsr = def->fpu_version;
env->nwindows = def->nwindows;
Expand Down
1 change: 0 additions & 1 deletion target-unicore32/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ CPUUniCore32State *uc32_cpu_init(const char *cpu_model)
}
cpu = UNICORE32_CPU(object_new(object_class_get_name(oc)));
env = &cpu->env;
env->cpu_model_str = cpu_model;

object_property_set_bool(OBJECT(cpu), true, "realized", NULL);

Expand Down

0 comments on commit 5cb259f

Please sign in to comment.