Skip to content

Commit 39c153b

Browse files
author
Anthony Liguori
committed
Merge remote-tracking branch 'afaerber/tags/qom-cpu-for-anthony' into staging
QOM CPUState refactorings / X86CPU * Fix for X86CPU model field of qemu32/qemu64 CPU models * Bug fix for longjmp on FreeBSD * Removal of unused function * Confinement of clone syscall infrastructure to linux-user # gpg: Signature made Wed 09 Oct 2013 03:40:51 AM PDT using RSA key ID 3E7E013F # gpg: Can't check signature: public key not found # By Andreas Färber (2) and others # Via Andreas Färber * afaerber/tags/qom-cpu-for-anthony: cpu: Drop cpu_model_str from CPU_COMMON cpu: Move cpu_copy() into linux-user cputlb: Remove dead function tlb_update_dirty() cpu-exec: Also reload CPUClass *cc after longjmp return in cpu_exec() target-i386: Set model=6 on qemu64 & qemu32 CPU models
2 parents e8f2f59 + 51fb256 commit 39c153b

File tree

18 files changed

+46
-77
lines changed

18 files changed

+46
-77
lines changed

cpu-exec.c

+4
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,10 @@ int cpu_exec(CPUArchState *env)
681681
* local variables as longjmp is marked 'noreturn'. */
682682
cpu = current_cpu;
683683
env = cpu->env_ptr;
684+
#if !(defined(CONFIG_USER_ONLY) && \
685+
(defined(TARGET_M68K) || defined(TARGET_PPC) || defined(TARGET_S390X)))
686+
cc = CPU_GET_CLASS(cpu);
687+
#endif
684688
}
685689
} /* for(;;) */
686690

cputlb.c

-15
Original file line numberDiff line numberDiff line change
@@ -169,21 +169,6 @@ static inline ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr)
169169
return ram_addr;
170170
}
171171

172-
static inline void tlb_update_dirty(CPUTLBEntry *tlb_entry)
173-
{
174-
ram_addr_t ram_addr;
175-
void *p;
176-
177-
if (tlb_is_dirty_ram(tlb_entry)) {
178-
p = (void *)(uintptr_t)((tlb_entry->addr_write & TARGET_PAGE_MASK)
179-
+ tlb_entry->addend);
180-
ram_addr = qemu_ram_addr_from_host_nofail(p);
181-
if (!cpu_physical_memory_is_dirty(ram_addr)) {
182-
tlb_entry->addr_write |= TLB_NOTDIRTY;
183-
}
184-
}
185-
}
186-
187172
void cpu_tlb_reset_dirty_all(ram_addr_t start1, ram_addr_t length)
188173
{
189174
CPUState *cpu;

exec.c

-32
Original file line numberDiff line numberDiff line change
@@ -625,38 +625,6 @@ void cpu_abort(CPUArchState *env, const char *fmt, ...)
625625
abort();
626626
}
627627

628-
CPUArchState *cpu_copy(CPUArchState *env)
629-
{
630-
CPUArchState *new_env = cpu_init(env->cpu_model_str);
631-
#if defined(TARGET_HAS_ICE)
632-
CPUBreakpoint *bp;
633-
CPUWatchpoint *wp;
634-
#endif
635-
636-
/* Reset non arch specific state */
637-
cpu_reset(ENV_GET_CPU(new_env));
638-
639-
/* Copy arch specific state into the new CPU */
640-
memcpy(new_env, env, sizeof(CPUArchState));
641-
642-
/* Clone all break/watchpoints.
643-
Note: Once we support ptrace with hw-debug register access, make sure
644-
BP_CPU break/watchpoints are handled correctly on clone. */
645-
QTAILQ_INIT(&env->breakpoints);
646-
QTAILQ_INIT(&env->watchpoints);
647-
#if defined(TARGET_HAS_ICE)
648-
QTAILQ_FOREACH(bp, &env->breakpoints, entry) {
649-
cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL);
650-
}
651-
QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
652-
cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1,
653-
wp->flags, NULL);
654-
}
655-
#endif
656-
657-
return new_env;
658-
}
659-
660628
#if !defined(CONFIG_USER_ONLY)
661629
static void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t end,
662630
uintptr_t length)

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

include/hw/i386/pc.h

+8
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,14 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t);
230230
.driver = "e1000",\
231231
.property = "mitigation",\
232232
.value = "off",\
233+
},{\
234+
.driver = "qemu64-" TYPE_X86_CPU,\
235+
.property = "model",\
236+
.value = stringify(2),\
237+
},{\
238+
.driver = "qemu32-" TYPE_X86_CPU,\
239+
.property = "model",\
240+
.value = stringify(3),\
233241
}
234242

235243
#define PC_COMPAT_1_5 \

linux-user/main.c

+32-1
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;
@@ -3285,6 +3285,37 @@ void init_task_state(TaskState *ts)
32853285
ts->sigqueue_table[i].next = NULL;
32863286
}
32873287

3288+
CPUArchState *cpu_copy(CPUArchState *env)
3289+
{
3290+
CPUArchState *new_env = cpu_init(cpu_model);
3291+
#if defined(TARGET_HAS_ICE)
3292+
CPUBreakpoint *bp;
3293+
CPUWatchpoint *wp;
3294+
#endif
3295+
3296+
/* Reset non arch specific state */
3297+
cpu_reset(ENV_GET_CPU(new_env));
3298+
3299+
memcpy(new_env, env, sizeof(CPUArchState));
3300+
3301+
/* Clone all break/watchpoints.
3302+
Note: Once we support ptrace with hw-debug register access, make sure
3303+
BP_CPU break/watchpoints are handled correctly on clone. */
3304+
QTAILQ_INIT(&env->breakpoints);
3305+
QTAILQ_INIT(&env->watchpoints);
3306+
#if defined(TARGET_HAS_ICE)
3307+
QTAILQ_FOREACH(bp, &env->breakpoints, entry) {
3308+
cpu_breakpoint_insert(new_env, bp->pc, bp->flags, NULL);
3309+
}
3310+
QTAILQ_FOREACH(wp, &env->watchpoints, entry) {
3311+
cpu_watchpoint_insert(new_env, wp->vaddr, (~wp->len_mask) + 1,
3312+
wp->flags, NULL);
3313+
}
3314+
#endif
3315+
3316+
return new_env;
3317+
}
3318+
32883319
static void handle_arg_help(const char *arg)
32893320
{
32903321
usage();

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

+2-5
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ static x86_def_t builtin_x86_defs[] = {
545545
.level = 4,
546546
.vendor = CPUID_VENDOR_AMD,
547547
.family = 6,
548-
.model = 2,
548+
.model = 6,
549549
.stepping = 3,
550550
.features[FEAT_1_EDX] =
551551
PPRO_FEATURES |
@@ -648,7 +648,7 @@ static x86_def_t builtin_x86_defs[] = {
648648
.level = 4,
649649
.vendor = CPUID_VENDOR_INTEL,
650650
.family = 6,
651-
.model = 3,
651+
.model = 6,
652652
.stepping = 3,
653653
.features[FEAT_1_EDX] =
654654
PPRO_FEATURES,
@@ -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)