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