Skip to content

Commit 51fb256

Browse files
committed
cpu: Drop cpu_model_str from CPU_COMMON
Since this is only read in cpu_copy() and linux-user has a global cpu_model, drop the field from generic code. Signed-off-by: Andreas Färber <[email protected]>
1 parent 30ba0ee commit 51fb256

File tree

14 files changed

+2
-29
lines changed

14 files changed

+2
-29
lines changed

include/exec/cpu-defs.h

-2
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,5 @@ typedef struct CPUWatchpoint {
178178
\
179179
/* user data */ \
180180
void *opaque; \
181-
\
182-
const char *cpu_model_str;
183181

184182
#endif

linux-user/main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const char *filename;
4242
const char *argv0;
4343
int gdbstub_port;
4444
envlist_t *envlist;
45-
const char *cpu_model;
45+
static const char *cpu_model;
4646
unsigned long mmap_min_addr;
4747
#if defined(CONFIG_USE_GUEST_BASE)
4848
unsigned long guest_base;
@@ -3287,7 +3287,7 @@ void init_task_state(TaskState *ts)
32873287

32883288
CPUArchState *cpu_copy(CPUArchState *env)
32893289
{
3290-
CPUArchState *new_env = cpu_init(env->cpu_model_str);
3290+
CPUArchState *new_env = cpu_init(cpu_model);
32913291
#if defined(TARGET_HAS_ICE)
32923292
CPUBreakpoint *bp;
32933293
CPUWatchpoint *wp;

target-alpha/cpu.c

-4
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ static ObjectClass *alpha_cpu_class_by_name(const char *cpu_model)
131131
AlphaCPU *cpu_alpha_init(const char *cpu_model)
132132
{
133133
AlphaCPU *cpu;
134-
CPUAlphaState *env;
135134
ObjectClass *cpu_class;
136135

137136
cpu_class = alpha_cpu_class_by_name(cpu_model);
@@ -140,9 +139,6 @@ AlphaCPU *cpu_alpha_init(const char *cpu_model)
140139
cpu_class = object_class_by_name(TYPE("ev67"));
141140
}
142141
cpu = ALPHA_CPU(object_new(object_class_get_name(cpu_class)));
143-
env = &cpu->env;
144-
145-
env->cpu_model_str = cpu_model;
146142

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

target-arm/helper.c

-3
Original file line numberDiff line numberDiff line change
@@ -1749,16 +1749,13 @@ void register_cp_regs_for_features(ARMCPU *cpu)
17491749
ARMCPU *cpu_arm_init(const char *cpu_model)
17501750
{
17511751
ARMCPU *cpu;
1752-
CPUARMState *env;
17531752
ObjectClass *oc;
17541753

17551754
oc = cpu_class_by_name(TYPE_ARM_CPU, cpu_model);
17561755
if (!oc) {
17571756
return NULL;
17581757
}
17591758
cpu = ARM_CPU(object_new(object_class_get_name(oc)));
1760-
env = &cpu->env;
1761-
env->cpu_model_str = cpu_model;
17621759

17631760
/* TODO this should be set centrally, once possible */
17641761
object_property_set_bool(OBJECT(cpu), true, "realized", NULL);

target-i386/cpu.c

-3
Original file line numberDiff line numberDiff line change
@@ -1899,7 +1899,6 @@ X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridge,
18991899
Error **errp)
19001900
{
19011901
X86CPU *cpu = NULL;
1902-
CPUX86State *env;
19031902
gchar **model_pieces;
19041903
char *name, *features;
19051904
char *typename;
@@ -1922,8 +1921,6 @@ X86CPU *cpu_x86_create(const char *cpu_model, DeviceState *icc_bridge,
19221921
qdev_set_parent_bus(DEVICE(cpu), qdev_get_child_bus(icc_bridge, "icc"));
19231922
object_unref(OBJECT(cpu));
19241923
#endif
1925-
env = &cpu->env;
1926-
env->cpu_model_str = cpu_model;
19271924

19281925
cpu_x86_register(cpu, name, &error);
19291926
if (error) {

target-m68k/helper.c

-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ M68kCPU *cpu_m68k_init(const char *cpu_model)
110110
}
111111
cpu = M68K_CPU(object_new(object_class_get_name(oc)));
112112
env = &cpu->env;
113-
env->cpu_model_str = cpu_model;
114113

115114
register_m68k_insns(env);
116115

target-mips/translate.c

-1
Original file line numberDiff line numberDiff line change
@@ -15907,7 +15907,6 @@ MIPSCPU *cpu_mips_init(const char *cpu_model)
1590715907
cpu = MIPS_CPU(object_new(TYPE_MIPS_CPU));
1590815908
env = &cpu->env;
1590915909
env->cpu_model = def;
15910-
env->cpu_model_str = cpu_model;
1591115910

1591215911
#ifndef CONFIG_USER_ONLY
1591315912
mmu_init(env, def);

target-moxie/cpu.c

-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ MoxieCPU *cpu_moxie_init(const char *cpu_model)
138138
return NULL;
139139
}
140140
cpu = MOXIE_CPU(object_new(object_class_get_name(oc)));
141-
cpu->env.cpu_model_str = cpu_model;
142141

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

target-openrisc/cpu.c

-1
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ OpenRISCCPU *cpu_openrisc_init(const char *cpu_model)
209209
return NULL;
210210
}
211211
cpu = OPENRISC_CPU(object_new(object_class_get_name(oc)));
212-
cpu->env.cpu_model_str = cpu_model;
213212

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

target-ppc/translate_init.c

-3
Original file line numberDiff line numberDiff line change
@@ -8267,7 +8267,6 @@ static ObjectClass *ppc_cpu_class_by_name(const char *name)
82678267
PowerPCCPU *cpu_ppc_init(const char *cpu_model)
82688268
{
82698269
PowerPCCPU *cpu;
8270-
CPUPPCState *env;
82718270
ObjectClass *oc;
82728271
Error *err = NULL;
82738272

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

82798278
cpu = POWERPC_CPU(object_new(object_class_get_name(oc)));
8280-
env = &cpu->env;
8281-
env->cpu_model_str = cpu_model;
82828279

82838280
object_property_set_bool(OBJECT(cpu), true, "realized", &err);
82848281
if (err != NULL) {

target-s390x/helper.c

-3
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,8 @@ void s390x_cpu_timer(void *opaque)
7373
S390CPU *cpu_s390x_init(const char *cpu_model)
7474
{
7575
S390CPU *cpu;
76-
CPUS390XState *env;
7776

7877
cpu = S390_CPU(object_new(TYPE_S390_CPU));
79-
env = &cpu->env;
80-
env->cpu_model_str = cpu_model;
8178

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

target-sh4/cpu.c

-3
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,13 @@ static ObjectClass *superh_cpu_class_by_name(const char *cpu_model)
144144
SuperHCPU *cpu_sh4_init(const char *cpu_model)
145145
{
146146
SuperHCPU *cpu;
147-
CPUSH4State *env;
148147
ObjectClass *oc;
149148

150149
oc = superh_cpu_class_by_name(cpu_model);
151150
if (oc == NULL) {
152151
return NULL;
153152
}
154153
cpu = SUPERH_CPU(object_new(object_class_get_name(oc)));
155-
env = &cpu->env;
156-
env->cpu_model_str = cpu_model;
157154

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

target-sparc/cpu.c

-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ static int cpu_sparc_register(CPUSPARCState *env, const char *cpu_model)
8484
env->def->features |= CPU_FEATURE_FLOAT128;
8585
}
8686
#endif
87-
env->cpu_model_str = cpu_model;
8887
env->version = def->iu_version;
8988
env->fsr = def->fpu_version;
9089
env->nwindows = def->nwindows;

target-unicore32/helper.c

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ CPUUniCore32State *uc32_cpu_init(const char *cpu_model)
3737
}
3838
cpu = UNICORE32_CPU(object_new(object_class_get_name(oc)));
3939
env = &cpu->env;
40-
env->cpu_model_str = cpu_model;
4140

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

0 commit comments

Comments
 (0)