Commit 01ba98161f954621bcf557ad8d5a0838d18000a1

Authored by ths
1 parent 1b66074b

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
cpu-defs.h
... ... @@ -146,6 +146,8 @@ typedef struct CPUTLBEntry {
146 146 void *next_cpu; /* next CPU sharing TB cache */ \
147 147 int cpu_index; /* CPU index (informative) */ \
148 148 /* user data */ \
149   - void *opaque;
  149 + void *opaque; \
  150 + \
  151 + const char *cpu_model_str;
150 152  
151 153 #endif
... ...
... ... @@ -1317,9 +1317,7 @@ void cpu_abort(CPUState *env, const char *fmt, ...)
1317 1317  
1318 1318 CPUState *cpu_copy(CPUState *env)
1319 1319 {
1320   -#if 0
1321   - /* XXX: broken, must be handled by each CPU */
1322   - CPUState *new_env = cpu_init();
  1320 + CPUState *new_env = cpu_init(env->cpu_model_str);
1323 1321 /* preserve chaining and index */
1324 1322 CPUState *next_cpu = new_env->next_cpu;
1325 1323 int cpu_index = new_env->cpu_index;
... ... @@ -1327,9 +1325,6 @@ CPUState *cpu_copy(CPUState *env)
1327 1325 new_env->next_cpu = next_cpu;
1328 1326 new_env->cpu_index = cpu_index;
1329 1327 return new_env;
1330   -#else
1331   - return NULL;
1332   -#endif
1333 1328 }
1334 1329  
1335 1330 #if !defined(CONFIG_USER_ONLY)
... ...
target-arm/helper.c
... ... @@ -182,6 +182,7 @@ CPUARMState *cpu_arm_init(const char *cpu_model)
182 182 if (!env)
183 183 return NULL;
184 184 cpu_exec_init(env);
  185 + env->cpu_model_str = cpu_model;
185 186 env->cp15.c0_cpuid = id;
186 187 cpu_reset(env);
187 188 return env;
... ...
target-i386/helper2.c
... ... @@ -99,6 +99,7 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
99 99 if (!env)
100 100 return NULL;
101 101 cpu_exec_init(env);
  102 + env->cpu_model_str = cpu_model;
102 103  
103 104 /* init various static tables */
104 105 if (!inited) {
... ...
target-m68k/helper.c
... ... @@ -126,11 +126,13 @@ CPUM68KState *cpu_m68k_init(const char *cpu_model)
126 126 return NULL;
127 127 cpu_exec_init(env);
128 128  
  129 + env->cpu_model_str = cpu_model;
  130 +
129 131 if (cpu_m68k_set_model(env, cpu_model) < 0) {
130 132 cpu_m68k_close(env);
131 133 return NULL;
132 134 }
133   -
  135 +
134 136 cpu_reset(env);
135 137 return env;
136 138 }
... ...
target-mips/translate.c
... ... @@ -6786,6 +6786,7 @@ CPUMIPSState *cpu_mips_init (const char *cpu_model)
6786 6786 env->cpu_model = def;
6787 6787  
6788 6788 cpu_exec_init(env);
  6789 + env->cpu_model_str = cpu_model;
6789 6790 cpu_reset(env);
6790 6791 return env;
6791 6792 }
... ...
target-ppc/helper.c
... ... @@ -2976,6 +2976,7 @@ CPUPPCState *cpu_ppc_init (const char *cpu_model)
2976 2976 if (!env)
2977 2977 return NULL;
2978 2978 cpu_exec_init(env);
  2979 + env->cpu_model_str = cpu_model;
2979 2980 cpu_ppc_register_internal(env, def);
2980 2981 cpu_ppc_reset(env);
2981 2982 return env;
... ...
target-sparc/translate.c
... ... @@ -3792,6 +3792,7 @@ CPUSPARCState *cpu_sparc_init(const char *cpu_model)
3792 3792 if (!env)
3793 3793 return NULL;
3794 3794 cpu_exec_init(env);
  3795 + env->cpu_model_str = cpu_model;
3795 3796 env->version = def->iu_version;
3796 3797 env->fsr = def->fpu_version;
3797 3798 #if !defined(TARGET_SPARC64)
... ...