aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-12-09 02:22:57 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-12-09 02:22:57 +0000
commit01ba98161f954621bcf557ad8d5a0838d18000a1 (patch)
tree9f95161d17b12c2f2617b9441b8653891ee9b041
parent1b66074b2f93a5d3f337d2aab10504426e756e50 (diff)
downloadqemu-01ba98161f954621bcf557ad8d5a0838d18000a1.zip
qemu-01ba98161f954621bcf557ad8d5a0838d18000a1.tar.gz
qemu-01ba98161f954621bcf557ad8d5a0838d18000a1.tar.bz2
Handle cpu_model in copy_cpu(), by Kirill A. Shutemov.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3778 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--cpu-defs.h4
-rw-r--r--exec.c7
-rw-r--r--target-arm/helper.c1
-rw-r--r--target-i386/helper2.c1
-rw-r--r--target-m68k/helper.c4
-rw-r--r--target-mips/translate.c1
-rw-r--r--target-ppc/helper.c1
-rw-r--r--target-sparc/translate.c1
8 files changed, 12 insertions, 8 deletions
diff --git a/cpu-defs.h b/cpu-defs.h
index 139dca2..5e0f046 100644
--- a/cpu-defs.h
+++ b/cpu-defs.h
@@ -146,6 +146,8 @@ typedef struct CPUTLBEntry {
void *next_cpu; /* next CPU sharing TB cache */ \
int cpu_index; /* CPU index (informative) */ \
/* user data */ \
- void *opaque;
+ void *opaque; \
+ \
+ const char *cpu_model_str;
#endif
diff --git a/exec.c b/exec.c
index 046e967..3fe340a 100644
--- a/exec.c
+++ b/exec.c
@@ -1317,9 +1317,7 @@ void cpu_abort(CPUState *env, const char *fmt, ...)
CPUState *cpu_copy(CPUState *env)
{
-#if 0
- /* XXX: broken, must be handled by each CPU */
- CPUState *new_env = cpu_init();
+ CPUState *new_env = cpu_init(env->cpu_model_str);
/* preserve chaining and index */
CPUState *next_cpu = new_env->next_cpu;
int cpu_index = new_env->cpu_index;
@@ -1327,9 +1325,6 @@ CPUState *cpu_copy(CPUState *env)
new_env->next_cpu = next_cpu;
new_env->cpu_index = cpu_index;
return new_env;
-#else
- return NULL;
-#endif
}
#if !defined(CONFIG_USER_ONLY)
diff --git a/target-arm/helper.c b/target-arm/helper.c
index 40bdeb1..86470db 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -182,6 +182,7 @@ CPUARMState *cpu_arm_init(const char *cpu_model)
if (!env)
return NULL;
cpu_exec_init(env);
+ env->cpu_model_str = cpu_model;
env->cp15.c0_cpuid = id;
cpu_reset(env);
return env;
diff --git a/target-i386/helper2.c b/target-i386/helper2.c
index 67658e2..968d9dd 100644
--- a/target-i386/helper2.c
+++ b/target-i386/helper2.c
@@ -99,6 +99,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
if (!env)
return NULL;
cpu_exec_init(env);
+ env->cpu_model_str = cpu_model;
/* init various static tables */
if (!inited) {
diff --git a/target-m68k/helper.c b/target-m68k/helper.c
index f6b0cd6..c639648 100644
--- a/target-m68k/helper.c
+++ b/target-m68k/helper.c
@@ -126,11 +126,13 @@ CPUM68KState *cpu_m68k_init(const char *cpu_model)
return NULL;
cpu_exec_init(env);
+ env->cpu_model_str = cpu_model;
+
if (cpu_m68k_set_model(env, cpu_model) < 0) {
cpu_m68k_close(env);
return NULL;
}
-
+
cpu_reset(env);
return env;
}
diff --git a/target-mips/translate.c b/target-mips/translate.c
index c909463..abbf067 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -6786,6 +6786,7 @@ CPUMIPSState *cpu_mips_init (const char *cpu_model)
env->cpu_model = def;
cpu_exec_init(env);
+ env->cpu_model_str = cpu_model;
cpu_reset(env);
return env;
}
diff --git a/target-ppc/helper.c b/target-ppc/helper.c
index 7a32d4a..a808454 100644
--- a/target-ppc/helper.c
+++ b/target-ppc/helper.c
@@ -2976,6 +2976,7 @@ CPUPPCState *cpu_ppc_init (const char *cpu_model)
if (!env)
return NULL;
cpu_exec_init(env);
+ env->cpu_model_str = cpu_model;
cpu_ppc_register_internal(env, def);
cpu_ppc_reset(env);
return env;
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 37a0d29..ecec372 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -3792,6 +3792,7 @@ CPUSPARCState *cpu_sparc_init(const char *cpu_model)
if (!env)
return NULL;
cpu_exec_init(env);
+ env->cpu_model_str = cpu_model;
env->version = def->iu_version;
env->fsr = def->fpu_version;
#if !defined(TARGET_SPARC64)