From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [RFC 08/20] cpu: move cpu_model_str to CPUState
Date: Tue, 18 Dec 2012 18:04:01 -0200 [thread overview]
Message-ID: <1355861053-11460-9-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1355861053-11460-1-git-send-email-ehabkost@redhat.com>
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(-)
diff --git a/cpu-defs.h b/cpu-defs.h
index 3669241..8b64a3d 100644
--- a/cpu-defs.h
+++ b/cpu-defs.h
@@ -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; \
diff --git a/exec.c b/exec.c
index 8e8a852..3919145 100644
--- a/exec.c
+++ b/exec.c
@@ -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)
diff --git a/include/qemu/cpu.h b/include/qemu/cpu.h
index 61b7698..b27b353 100644
--- a/include/qemu/cpu.h
+++ b/include/qemu/cpu.h
@@ -77,6 +77,7 @@ struct CPUState {
bool stop;
bool stopped;
+ const char *cpu_model_str; \
/* TODO Move common fields from CPUArchState here. */
};
diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index ef51296..5c88f33 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -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);
diff --git a/target-arm/helper.c b/target-arm/helper.c
index ab8b734..e14bbbe 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -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) {
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 00341c5..a0930be 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -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));
diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index 6b6f5dd..4d88bb0 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -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)) {
diff --git a/target-mips/translate.c b/target-mips/translate.c
index 65e6725..1c20570 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -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);
diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c
index ba35b17..e152a3a 100644
--- a/target-openrisc/cpu.c
+++ b/target-openrisc/cpu.c
@@ -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);
diff --git a/target-ppc/helper.c b/target-ppc/helper.c
index 48b19a7..4b80d4f 100644
--- a/target-ppc/helper.c
+++ b/target-ppc/helper.c
@@ -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);
diff --git a/target-s390x/helper.c b/target-s390x/helper.c
index b7b812a..80d62b9 100644
--- a/target-s390x/helper.c
+++ b/target-s390x/helper.c
@@ -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;
}
diff --git a/target-sh4/translate.c b/target-sh4/translate.c
index 86493e1..6795d01 100644
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -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);
diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c
index 882d306..2bbf24f 100644
--- a/target-sparc/cpu.c
+++ b/target-sparc/cpu.c
@@ -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;
diff --git a/target-unicore32/cpu.c b/target-unicore32/cpu.c
index 884c101..76750da 100644
--- a/target-unicore32/cpu.c
+++ b/target-unicore32/cpu.c
@@ -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;
--
1.7.11.7
next prev parent reply other threads:[~2012-12-18 20:02 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-18 20:03 [Qemu-devel] [RFC 00/20] generic_cpu_init() and generic_cpu_create() functions Eduardo Habkost
2012-12-18 20:03 ` [Qemu-devel] [RFC 01/20] qemu-common.h: "use" env parameter in no-op version of qemu_init_vcpu() Eduardo Habkost
2012-12-18 20:03 ` [Qemu-devel] [RFC 02/20] cpu: introduce CPU_GET_ENV macros Eduardo Habkost
2012-12-18 20:03 ` [Qemu-devel] [RFC 03/20] cpu: make cpu_init return CPUState QOM object Eduardo Habkost
2012-12-18 20:03 ` [Qemu-devel] [RFC 04/20] cpu: replace trivial old_cpu_init functions Eduardo Habkost
2012-12-18 20:03 ` [Qemu-devel] [RFC 05/20] alpha: convert cpu_init to QOM Eduardo Habkost
2012-12-18 20:03 ` [Qemu-devel] [RFC 06/20] m68k: " Eduardo Habkost
2012-12-18 20:04 ` [Qemu-devel] [RFC 07/20] target-unicore32: " Eduardo Habkost
2012-12-18 20:04 ` Eduardo Habkost [this message]
2012-12-18 20:04 ` [Qemu-devel] [RFC 09/20] cpu: introduce cpu_realize() Eduardo Habkost
2012-12-18 23:13 ` Andreas Färber
2012-12-18 20:04 ` [Qemu-devel] [RFC 10/20] cpu: introduce generic_cpu_init() & generic_cpu_create() functions Eduardo Habkost
2012-12-18 20:04 ` [Qemu-devel] [RFC 11/20] target-openrisc: implement CPU realize() method Eduardo Habkost
2012-12-18 20:04 ` [Qemu-devel] [RFC 12/20] hw/openrisc_sim.c: coding style/indentation fix Eduardo Habkost
2012-12-18 20:04 ` [Qemu-devel] [RFC 13/20] target-openrisc: replace cpu_openrisc_init() with generic_cpu_init() Eduardo Habkost
2012-12-18 20:04 ` [Qemu-devel] [RFC 14/20] target-arm: move final steps of cpu_arm_init() to realize function Eduardo Habkost
2012-12-18 20:04 ` [Qemu-devel] [RFC 15/20] target-arm: replace cpu_arm_init() with generic_cpu_init() Eduardo Habkost
2012-12-18 20:04 ` [Qemu-devel] [RFC 16/20] target-m68k: move final steps of cpu_m68k_init() to realize function Eduardo Habkost
2012-12-18 20:04 ` [Qemu-devel] [RFC 17/20] target-m68k: replace cpu_m68k_init() with generic_cpu_init() Eduardo Habkost
2012-12-18 20:04 ` [Qemu-devel] [RFC 18/20] target-unicore32: move final steps of uc32_cpu_init() to realize function Eduardo Habkost
2012-12-18 20:04 ` [Qemu-devel] [RFC 19/20] target-unicore32: replace uc32_cpu_init() with generic_cpu_init() Eduardo Habkost
2012-12-18 20:04 ` [Qemu-devel] [RFC 20/20] cpu: convert cpu_copy() to QOM Eduardo Habkost
2012-12-18 22:57 ` [Qemu-devel] [RFC 00/20] generic_cpu_init() and generic_cpu_create() functions Andreas Färber
2012-12-19 0:08 ` Eduardo Habkost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1355861053-11460-9-git-send-email-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).