提交 51b2772f 编写于 作者: T ths

Fix CPU (re-)selection on reset.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2900 c046a42c-6fe2-441c-8c8c-71466251a162
上级 fdf41d22
...@@ -748,6 +748,7 @@ static void main_cpu_reset(void *opaque) ...@@ -748,6 +748,7 @@ static void main_cpu_reset(void *opaque)
{ {
CPUState *env = opaque; CPUState *env = opaque;
cpu_reset(env); cpu_reset(env);
cpu_mips_register(env, NULL);
/* The bootload does not need to be rewritten as it is located in a /* The bootload does not need to be rewritten as it is located in a
read only location. The kernel location and the arguments table read only location. The kernel location and the arguments table
......
...@@ -51,6 +51,7 @@ static void main_cpu_reset(void *opaque) ...@@ -51,6 +51,7 @@ static void main_cpu_reset(void *opaque)
{ {
CPUState *env = opaque; CPUState *env = opaque;
cpu_reset(env); cpu_reset(env);
cpu_mips_register(env, NULL);
} }
static static
......
...@@ -128,6 +128,7 @@ static void main_cpu_reset(void *opaque) ...@@ -128,6 +128,7 @@ static void main_cpu_reset(void *opaque)
{ {
CPUState *env = opaque; CPUState *env = opaque;
cpu_reset(env); cpu_reset(env);
cpu_mips_register(env, NULL);
if (env->kernel_filename) if (env->kernel_filename)
load_kernel (env, env->ram_size, env->kernel_filename, load_kernel (env, env->ram_size, env->kernel_filename,
......
...@@ -48,6 +48,8 @@ struct r4k_tlb_t { ...@@ -48,6 +48,8 @@ struct r4k_tlb_t {
target_ulong PFN[2]; target_ulong PFN[2];
}; };
typedef struct mips_def_t mips_def_t;
typedef struct CPUMIPSState CPUMIPSState; typedef struct CPUMIPSState CPUMIPSState;
struct CPUMIPSState { struct CPUMIPSState {
/* General integer registers */ /* General integer registers */
...@@ -295,6 +297,8 @@ struct CPUMIPSState { ...@@ -295,6 +297,8 @@ struct CPUMIPSState {
const char *kernel_cmdline; const char *kernel_cmdline;
const char *initrd_filename; const char *initrd_filename;
mips_def_t *cpu_model;
struct QEMUTimer *timer; /* Internal timer */ struct QEMUTimer *timer; /* Internal timer */
}; };
...@@ -308,7 +312,6 @@ void r4k_do_tlbwi (void); ...@@ -308,7 +312,6 @@ void r4k_do_tlbwi (void);
void r4k_do_tlbwr (void); void r4k_do_tlbwr (void);
void r4k_do_tlbp (void); void r4k_do_tlbp (void);
void r4k_do_tlbr (void); void r4k_do_tlbr (void);
typedef struct mips_def_t mips_def_t;
int mips_find_by_name (const unsigned char *name, mips_def_t **def); int mips_find_by_name (const unsigned char *name, mips_def_t **def);
void mips_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...)); void mips_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...));
int cpu_mips_register (CPUMIPSState *env, mips_def_t *def); int cpu_mips_register (CPUMIPSState *env, mips_def_t *def);
......
...@@ -206,13 +206,15 @@ static void r4k_mmu_init (CPUMIPSState *env, mips_def_t *def) ...@@ -206,13 +206,15 @@ static void r4k_mmu_init (CPUMIPSState *env, mips_def_t *def)
int cpu_mips_register (CPUMIPSState *env, mips_def_t *def) int cpu_mips_register (CPUMIPSState *env, mips_def_t *def)
{ {
if (!def)
def = env->cpu_model;
if (!def) if (!def)
cpu_abort(env, "Unable to find MIPS CPU definition\n"); cpu_abort(env, "Unable to find MIPS CPU definition\n");
env->cpu_model = def;
env->CP0_PRid = def->CP0_PRid; env->CP0_PRid = def->CP0_PRid;
#ifdef TARGET_WORDS_BIGENDIAN
env->CP0_Config0 = def->CP0_Config0 | (1 << CP0C0_BE);
#else
env->CP0_Config0 = def->CP0_Config0; env->CP0_Config0 = def->CP0_Config0;
#ifdef TARGET_WORDS_BIGENDIAN
env->CP0_Config0 |= (1 << CP0C0_BE);
#endif #endif
env->CP0_Config1 = def->CP0_Config1; env->CP0_Config1 = def->CP0_Config1;
env->CP0_Config2 = def->CP0_Config2; env->CP0_Config2 = def->CP0_Config2;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册