aboutsummaryrefslogtreecommitdiff
path: root/hw/xtensa_sim.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/xtensa_sim.c')
-rw-r--r--hw/xtensa_sim.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/hw/xtensa_sim.c b/hw/xtensa_sim.c
index c7e05dcf4e..1ce07fb899 100644
--- a/hw/xtensa_sim.c
+++ b/hw/xtensa_sim.c
@@ -37,9 +37,11 @@ static uint64_t translate_phys_addr(void *env, uint64_t addr)
return cpu_get_phys_page_debug(env, addr);
}
-static void sim_reset(void *env)
+static void sim_reset(void *opaque)
{
- cpu_state_reset(env);
+ XtensaCPU *cpu = opaque;
+
+ cpu_reset(CPU(cpu));
}
static void sim_init(ram_addr_t ram_size,
@@ -47,22 +49,25 @@ static void sim_init(ram_addr_t ram_size,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
{
+ XtensaCPU *cpu = NULL;
CPUXtensaState *env = NULL;
MemoryRegion *ram, *rom;
int n;
for (n = 0; n < smp_cpus; n++) {
- env = cpu_init(cpu_model);
- if (!env) {
+ cpu = cpu_xtensa_init(cpu_model);
+ if (cpu == NULL) {
fprintf(stderr, "Unable to find CPU definition\n");
exit(1);
}
+ env = &cpu->env;
+
env->sregs[PRID] = n;
- qemu_register_reset(sim_reset, env);
+ qemu_register_reset(sim_reset, cpu);
/* Need MMU initialized prior to ELF loading,
* so that ELF gets loaded into virtual addresses
*/
- sim_reset(env);
+ sim_reset(cpu);
}
ram = g_malloc(sizeof(*ram));