aboutsummaryrefslogtreecommitdiff
path: root/hw/mips_mipssim.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/mips_mipssim.c')
-rw-r--r--hw/mips_mipssim.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/hw/mips_mipssim.c b/hw/mips_mipssim.c
index 1ea7b58..eb03047 100644
--- a/hw/mips_mipssim.c
+++ b/hw/mips_mipssim.c
@@ -46,7 +46,7 @@ static struct _loaderparams {
} loaderparams;
typedef struct ResetData {
- CPUMIPSState *env;
+ MIPSCPU *cpu;
uint64_t vector;
} ResetData;
@@ -105,9 +105,9 @@ static int64_t load_kernel(void)
static void main_cpu_reset(void *opaque)
{
ResetData *s = (ResetData *)opaque;
- CPUMIPSState *env = s->env;
+ CPUMIPSState *env = &s->cpu->env;
- cpu_state_reset(env);
+ cpu_reset(CPU(s->cpu));
env->active_tc.PC = s->vector & ~(target_ulong)1;
if (s->vector & 1) {
env->hflags |= MIPS_HFLAG_M16;
@@ -140,6 +140,7 @@ mips_mipssim_init (ram_addr_t ram_size,
MemoryRegion *address_space_mem = get_system_memory();
MemoryRegion *ram = g_new(MemoryRegion, 1);
MemoryRegion *bios = g_new(MemoryRegion, 1);
+ MIPSCPU *cpu;
CPUMIPSState *env;
ResetData *reset_info;
int bios_size;
@@ -152,13 +153,15 @@ mips_mipssim_init (ram_addr_t ram_size,
cpu_model = "24Kf";
#endif
}
- env = cpu_init(cpu_model);
- if (!env) {
+ cpu = cpu_mips_init(cpu_model);
+ if (cpu == NULL) {
fprintf(stderr, "Unable to find CPU definition\n");
exit(1);
}
+ env = &cpu->env;
+
reset_info = g_malloc0(sizeof(ResetData));
- reset_info->env = env;
+ reset_info->cpu = cpu;
reset_info->vector = env->active_tc.PC;
qemu_register_reset(main_cpu_reset, reset_info);