qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC 08/20] cpu: move cpu_model_str to CPUState


From: Eduardo Habkost
Subject: [Qemu-devel] [RFC 08/20] cpu: move cpu_model_str to CPUState
Date: Tue, 18 Dec 2012 18:04:01 -0200

Signed-off-by: Eduardo Habkost <address@hidden>
---
 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]